From f21646b3968f98b2ba20ec1298d6072ab490823a Mon Sep 17 00:00:00 2001 From: Tushar Dave Date: Sun, 26 Mar 2023 15:00:35 +0530 Subject: [PATCH 01/21] fix flutter install command : pub get -> pub add --- .../overview/platforms/wizard/flutter/step2.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step2.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step2.svelte index 7d7dc3551..a47e93a8d 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step2.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step2.svelte @@ -5,7 +5,7 @@ const example1 = `dependencies: appwrite: ^${$versions['client-flutter']}`; - const example2 = `pub get appwrite`; + const example2 = `flutter pub add appwrite`; From de2439b2af1046bae80af8fdc9a58d04c041bfff Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 12 Apr 2023 11:27:06 +0200 Subject: [PATCH 02/21] fix: attribute defaults --- src/lib/elements/forms/inputNumber.svelte | 2 +- src/lib/elements/forms/inputURL.svelte | 34 ++++++++++++++---- .../attributes/boolean.svelte | 22 ++++++------ .../attributes/datetime.svelte | 2 +- .../attributes/edit.svelte | 27 +++++--------- .../attributes/email.svelte | 3 +- .../attributes/enum.svelte | 32 ++++++++++------- .../attributes/float.svelte | 6 ++-- .../attributes/integer.svelte | 4 +-- .../attributes/ip.svelte | 3 +- .../attributes/relationship.svelte | 2 -- .../attributes/string.svelte | 36 ++++++++++--------- .../attributes/url.svelte | 7 ++-- .../attributes/boolean.svelte | 4 +-- .../attributes/enum.svelte | 4 +-- .../attributes/integer.svelte | 4 +-- .../attributes/string.svelte | 7 ++-- 17 files changed, 105 insertions(+), 94 deletions(-) diff --git a/src/lib/elements/forms/inputNumber.svelte b/src/lib/elements/forms/inputNumber.svelte index 7c36615e0..5110e4eea 100644 --- a/src/lib/elements/forms/inputNumber.svelte +++ b/src/lib/elements/forms/inputNumber.svelte @@ -84,7 +84,7 @@ bind:value bind:this={element} on:invalid={handleInvalid} - style:--amount-of-buttons={required ? 0 : 1.75} /> + style:--amount-of-buttons={nullable && !required ? 1.75 : 0} />
    {#if nullable && !required} diff --git a/src/lib/elements/forms/inputURL.svelte b/src/lib/elements/forms/inputURL.svelte index 848bc5532..5c7a1178a 100644 --- a/src/lib/elements/forms/inputURL.svelte +++ b/src/lib/elements/forms/inputURL.svelte @@ -1,6 +1,8 @@ @@ -66,9 +74,21 @@ type="url" autocomplete={autocomplete ? 'on' : 'off'} bind:value - on:input={handleInput} bind:this={element} on:invalid={handleInvalid} /> +
      + {#if maxlength} +
    • + +
    • + {/if} + {#if nullable && !required} +
    • + +
    • + {/if} +
    {#if error} {error} diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte index 7dea3b464..ffa3e61f4 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte @@ -34,8 +34,7 @@ - + placeholder="Select a value" + disabled={data.required || data.array} + options={[ + { label: 'NULL', value: null }, + { label: 'True', value: true }, + { label: 'False', value: false } + ]} + bind:value={data.default} /> Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte index 4315f1319..21886dc1f 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte @@ -48,7 +48,7 @@ id="default" label="Default value" bind:value={data.default} - disabled={data.required} /> + disabled={data.required || data.array} /> Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte index 72bb2eaf7..6d38653c3 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte @@ -71,25 +71,14 @@ {#if selectedAttribute?.type !== 'relationship'} -
    - - -
    -
    -
    + {/if} {#if option} + disabled={data.required || data.array} + nullable={!data.required && !data.array} /> Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte index a8e166a2a..5996689ea 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte @@ -36,8 +36,7 @@ - - Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte index 9e07b3e87..57e7ae51b 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte @@ -54,9 +54,8 @@ } - - - + + Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte index d68ef0976..d92032f82 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte @@ -56,7 +56,6 @@ - + disabled={data.required || data.array} + nullable={!data.required && !data.array} /> Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte index b59473958..3bba15ad6 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte @@ -48,7 +48,8 @@ label="Default value" placeholder="Enter value" bind:value={data.default} - disabled={data.required || data.array} /> + disabled={data.required || data.array} + nullable={!data.required && !data.array} /> Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte index f847e0ebd..501ee1dc5 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte @@ -98,7 +98,6 @@ }); // Reactive statements - $: getCollections(search).then((res) => (collectionList = res)); $: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? []; @@ -219,7 +218,6 @@ placeholder="Select a relation" options={relationshipType} disabled={editing} /> -
    diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte index bbf9175bd..d7acb0e6c 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte @@ -34,8 +34,7 @@ - + disabled={data.required || data.array} + nullable={!data.required && !data.array} /> Indicate whether this is a required attribute diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/boolean.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/boolean.svelte index 6e6e02e7a..fb18a51fc 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/boolean.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/boolean.svelte @@ -7,7 +7,6 @@ export let value: boolean; export let attribute: Models.AttributeBoolean; export let optionalText: string | undefined = undefined; - export let disabled = false; + bind:value /> diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/enum.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/enum.svelte index 7a5103da8..9f88aaa57 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/enum.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/enum.svelte @@ -7,7 +7,6 @@ export let value: string; export let attribute: Models.AttributeEnum; export let optionalText: string | undefined = undefined; - export let disabled = false; $: options = [ ...attribute.elements.map((element) => { @@ -31,5 +30,4 @@ {optionalText} required={attribute.required} placeholder="Select a value" - showLabel={!!label?.length} - {disabled} /> + showLabel={!!label?.length} /> diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/integer.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/integer.svelte index d490f0e3d..22360ff6f 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/integer.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/integer.svelte @@ -17,5 +17,5 @@ required={attribute.required} min={attribute.min} max={attribute.max} - bind:value - step={attribute.type === 'double' ? 'any' : 1} /> + step={attribute.type === 'double' ? 'any' : 1} + bind:value /> diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/string.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/string.svelte index ecb1c613e..d5c32fa59 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/string.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/string.svelte @@ -7,30 +7,27 @@ export let value: string; export let attribute: Models.AttributeString; export let optionalText: string | undefined = undefined; - export let disabled = false; {#if attribute.size >= 50} {:else} {/if} From 7c820d129ccef2f40ff7d35cd35d63569b9b6108 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 12 Apr 2023 11:40:42 +0200 Subject: [PATCH 03/21] fix: editing attributes --- .../attributes/edit.svelte | 3 +-- .../attributes/float.svelte | 16 ++++++++++++++-- .../attributes/integer.svelte | 14 ++++++++++++-- .../attributes/string.svelte | 2 +- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte index 6d38653c3..e4ea11990 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/edit.svelte @@ -77,14 +77,13 @@ placeholder="Enter Key" bind:value={selectedAttribute.key} autofocus - required readonly /> {/if} {#if option} (option = null)} /> {/if} diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte index 57e7ae51b..b641880d0 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte @@ -54,8 +54,20 @@ } - - + + - - + + {#if data.size >= 50} Date: Wed, 12 Apr 2023 15:10:36 +0200 Subject: [PATCH 04/21] fix: url not bein nullable --- .../document-[document]/attributes/url.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/url.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/url.svelte index cbff896fa..b745348d9 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/url.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/url.svelte @@ -15,5 +15,6 @@ {optionalText} placeholder="Enter URL" showLabel={!!label?.length} + nullable={!attribute.required} required={attribute.required} bind:value /> From f7a7e6fc7f77576db14cfe8d7bbb877688c17dd8 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Thu, 13 Apr 2023 14:30:16 +0100 Subject: [PATCH 05/21] fix: copy scrolling to bottom --- src/lib/helpers/copy.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/helpers/copy.ts b/src/lib/helpers/copy.ts index 6399995ea..4c3779ffc 100644 --- a/src/lib/helpers/copy.ts +++ b/src/lib/helpers/copy.ts @@ -11,6 +11,12 @@ async function securedCopy(value: string) { function unsecuredCopy(value: string) { const textArea = document.createElement('textarea'); textArea.value = value; + + // Avoid scrolling to bottom + textArea.style.top = '0'; + textArea.style.left = '0'; + textArea.style.position = 'fixed'; + document.body.appendChild(textArea); textArea.focus(); textArea.select(); From fe7a830502ecdbc5349d21124c21268c83ae7036 Mon Sep 17 00:00:00 2001 From: Arman Date: Fri, 14 Apr 2023 13:21:09 +0200 Subject: [PATCH 06/21] chore-bump-css-0.0.6-rc.10 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7dc7a540..46a843438 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "dependencies": { "@analytics/google-analytics": "^1.0.5", "@appwrite.io/console": "0.1.0", - "@appwrite.io/pink": "^0.0.6-rc.9", + "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", "@sentry/tracing": "^7.44.2", @@ -156,9 +156,9 @@ } }, "node_modules/@appwrite.io/pink": { - "version": "0.0.6-rc.9", - "resolved": "https://registry.npmjs.org/@appwrite.io/pink/-/pink-0.0.6-rc.9.tgz", - "integrity": "sha512-8Z8+az4dO5CWA8LyXlqad3FG39+g88mQaVqS1t0MuStC3fI2hzyJF9rA50QwabefXiMidE3FiRlrUyu+6QCGJg==", + "version": "0.0.6-rc.10", + "resolved": "https://registry.npmjs.org/@appwrite.io/pink/-/pink-0.0.6-rc.10.tgz", + "integrity": "sha512-mhpgjQVfQvghItgcCzsHN0Ynn4U9JNg8HlSJ+HVDUi/bNHxmlm7XdNJE6s65LMJ6LfepROn6zZMHquANvGfNDg==", "dependencies": { "@appwrite.io/pink-icons": "*", "normalize.css": "^8.0.1", diff --git a/package.json b/package.json index d56a93ff7..0e7ec8d6e 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "dependencies": { "@analytics/google-analytics": "^1.0.5", "@appwrite.io/console": "0.1.0", - "@appwrite.io/pink": "^0.0.6-rc.9", + "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", "@sentry/tracing": "^7.44.2", From e0bfc2da8e2eb0f5cb6f61452fe5c05336efeb8e Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Fri, 14 Apr 2023 18:21:20 +0100 Subject: [PATCH 07/21] fix: non-expiring api key disallowing name updates --- .../console/project-[project]/overview/keys/[key]/+page.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/console/project-[project]/overview/keys/[key]/+page.ts b/src/routes/console/project-[project]/overview/keys/[key]/+page.ts index 1c8f8a44d..e235ed2d6 100644 --- a/src/routes/console/project-[project]/overview/keys/[key]/+page.ts +++ b/src/routes/console/project-[project]/overview/keys/[key]/+page.ts @@ -10,6 +10,8 @@ export const load: PageLoad = async ({ params, depends }) => { const key = await sdk.forConsole.projects.getKey(params.project, params.key); if (key.expire) { key.expire = new Date(key.expire).toISOString().slice(0, 23); + } else { + key.expire = undefined; } return { From 89403ea1c9de895ea57991de3a94782b2f071b3b Mon Sep 17 00:00:00 2001 From: Akshay Rana Date: Sun, 16 Apr 2023 11:52:56 +0530 Subject: [PATCH 08/21] fixed: reset custom validity on re-render if required checkbox field unchecked in inputSelect form element --- src/lib/elements/forms/inputSelect.svelte | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index 0b3663529..ef5f70b72 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -35,6 +35,10 @@ element.setCustomValidity(''); } + $: if (element && !required){ + element.setCustomValidity(''); + } + $: if (value) { error = null; } From b933f88c2660fc1cb7b93195e5e289a9107aa4e0 Mon Sep 17 00:00:00 2001 From: Akshay Rana Date: Sun, 16 Apr 2023 12:41:08 +0530 Subject: [PATCH 09/21] fixed lint issue --- src/lib/elements/forms/inputSelect.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index ef5f70b72..f89ec26f0 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -35,10 +35,10 @@ element.setCustomValidity(''); } - $: if (element && !required){ + $: if (element && !required) { element.setCustomValidity(''); } - + $: if (value) { error = null; } From 8d855e53e3f6b4884877bd888ed82e55b7b8659e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 17 Apr 2023 11:46:32 +0400 Subject: [PATCH 10/21] feat: update select validation for boolean attributes --- src/lib/elements/forms/inputSelect.svelte | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index 0b3663529..85633d9f9 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -27,15 +27,28 @@ error = element.validationMessage; }; - $: if (element && required && !value) { + const isValid = (value: string | number | boolean) => { + if (typeof value === 'boolean') { + if (value === null || value === undefined) return false; + else return true; + } + + if (!value) { + return false; + } + + return true; + }; + + $: if (element && required && !isValid(value)) { element.setCustomValidity('This field is required'); } - $: if (element && required && value) { + $: if (element && required && isValid(value)) { element.setCustomValidity(''); } - $: if (value) { + $: if (isValid(value)) { error = null; } From 9a90fba3b00facc5ebf98521870fd782f495220a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 17 Apr 2023 12:00:36 +0400 Subject: [PATCH 11/21] feat: update select validation for boolean attributes --- src/lib/elements/forms/inputSelect.svelte | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index 85633d9f9..bbab9e44d 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -28,13 +28,14 @@ }; const isValid = (value: string | number | boolean) => { - if (typeof value === 'boolean') { - if (value === null || value === undefined) return false; - else return true; - } + if (value === null) return false; - if (!value) { - return false; + if (value === undefined) return false; + + if (typeof value !== 'boolean') { + if (!value) { + return false; + } } return true; From cb0ec96b36ef375762dd623cb39153f5139f89ed Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:20:35 +0100 Subject: [PATCH 12/21] fix: remove empty button list from inputs --- src/lib/elements/forms/inputText.svelte | 31 +++++++++++-------- src/lib/elements/forms/inputTextarea.svelte | 33 ++++++++++++--------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/lib/elements/forms/inputText.svelte b/src/lib/elements/forms/inputText.svelte index a7082a4b0..28123a30f 100644 --- a/src/lib/elements/forms/inputText.svelte +++ b/src/lib/elements/forms/inputText.svelte @@ -53,6 +53,9 @@ value = prevValue; } } + + $: showTextCounter = !!maxlength; + $: showNullCheckbox = nullable && !required; @@ -75,19 +78,21 @@ class:u-padding-inline-end-56={typeof maxlength === 'number'} bind:this={element} on:invalid={handleInvalid} /> -
      - {#if maxlength} -
    • - -
    • - {/if} - {#if nullable && !required} -
    • - -
    • - {/if} -
    + {#if showTextCounter || showNullCheckbox} +
      + {#if showTextCounter} +
    • + +
    • + {/if} + {#if showNullCheckbox} +
    • + +
    • + {/if} +
    + {/if}
    {#if error} {error} diff --git a/src/lib/elements/forms/inputTextarea.svelte b/src/lib/elements/forms/inputTextarea.svelte index 7a9c121a6..a5a096b35 100644 --- a/src/lib/elements/forms/inputTextarea.svelte +++ b/src/lib/elements/forms/inputTextarea.svelte @@ -50,6 +50,9 @@ value = prevValue; } } + + $: showTextCounter = !!maxlength; + $: showNullCheckbox = nullable && !required; @@ -72,20 +75,22 @@ bind:this={element} on:invalid={handleInvalid} style:--amount-of-buttons={required ? undefined : 0.25} /> -
      - {#if maxlength} -
    • - -
    • - {/if} - {#if nullable && !required} -
    • - -
    • - {/if} -
    + {#if showTextCounter || showNullCheckbox} +
      + {#if showTextCounter} +
    • + +
    • + {/if} + {#if showNullCheckbox} +
    • + +
    • + {/if} +
    + {/if}
    {#if error} From 404b75d557c2f933a348bb6a01786d065d5e0f19 Mon Sep 17 00:00:00 2001 From: Akshay Rana Date: Mon, 17 Apr 2023 23:20:49 +0530 Subject: [PATCH 13/21] updated if condition to check custom validity --- src/lib/elements/forms/inputSelect.svelte | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index f89ec26f0..f835c2364 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -27,18 +27,16 @@ error = element.validationMessage; }; - $: if (element && required && !value) { - element.setCustomValidity('This field is required'); + $: if (required && !value) { + element?.setCustomValidity('This field is required'); + } else { + element?.setCustomValidity(''); } $: if (element && required && value) { element.setCustomValidity(''); } - $: if (element && !required) { - element.setCustomValidity(''); - } - $: if (value) { error = null; } From 5b0f8dd755ae76cc0bc8b0bf837fea2dd0964d57 Mon Sep 17 00:00:00 2001 From: Akshay Rana Date: Tue, 18 Apr 2023 09:26:34 +0530 Subject: [PATCH 14/21] removed extra if condition --- src/lib/elements/forms/inputSelect.svelte | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index f835c2364..4db46cb13 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -33,10 +33,6 @@ element?.setCustomValidity(''); } - $: if (element && required && value) { - element.setCustomValidity(''); - } - $: if (value) { error = null; } From 1b9a9b64825a40d44d418a88ae158d26a6ea93b4 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 18 Apr 2023 14:20:33 +0400 Subject: [PATCH 15/21] feat: review comments --- src/lib/elements/forms/inputSelect.svelte | 30 +++++++---------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index bbab9e44d..ac2a83f78 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -27,29 +27,17 @@ error = element.validationMessage; }; - const isValid = (value: string | number | boolean) => { - if (value === null) return false; - - if (value === undefined) return false; - - if (typeof value !== 'boolean') { - if (!value) { - return false; - } - } - - return true; + const isNotEmpty = (value: string | number | boolean) => { + return typeof value === 'boolean' ? true : !!value; }; - $: if (element && required && !isValid(value)) { - element.setCustomValidity('This field is required'); - } - - $: if (element && required && isValid(value)) { - element.setCustomValidity(''); - } - - $: if (isValid(value)) { + $: if (element && required) { + if (!isNotEmpty(value)) { + element.setCustomValidity('This field is required'); + } else { + element.setCustomValidity(''); + } + } else if (isNotEmpty(value)) { error = null; } From fef2ede9e808f44bf94f03b184419616c7a5e3af Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 19 Apr 2023 19:43:11 +0400 Subject: [PATCH 16/21] feat: review comments --- src/lib/elements/forms/inputSelect.svelte | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/elements/forms/inputSelect.svelte b/src/lib/elements/forms/inputSelect.svelte index ac2a83f78..fd37a958c 100644 --- a/src/lib/elements/forms/inputSelect.svelte +++ b/src/lib/elements/forms/inputSelect.svelte @@ -31,13 +31,13 @@ return typeof value === 'boolean' ? true : !!value; }; - $: if (element && required) { - if (!isNotEmpty(value)) { - element.setCustomValidity('This field is required'); - } else { - element.setCustomValidity(''); - } - } else if (isNotEmpty(value)) { + $: if (required && !isNotEmpty(value)) { + element?.setCustomValidity('This field is required'); + } else { + element?.setCustomValidity(''); + } + + $: if (isNotEmpty(value)) { error = null; } From 532edeb3f69b1819c1d620364900c84f31a0568e Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 19 Apr 2023 22:23:26 +0000 Subject: [PATCH 17/21] Remove overly casual language from empty states --- src/lib/components/empty.svelte | 2 +- src/lib/components/permissions/team.svelte | 2 +- src/lib/components/permissions/user.svelte | 2 +- .../database-[database]/collection-[collection]/+page.svelte | 2 +- .../collection-[collection]/attributes/+page.svelte | 2 +- .../collection-[collection]/indexes/+page.svelte | 2 +- .../functions/function-[function]/executions/+page.svelte | 2 +- .../console/project-[project]/overview/platforms/+page.svelte | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/components/empty.svelte b/src/lib/components/empty.svelte index ab7d091a4..2c01f69fa 100644 --- a/src/lib/components/empty.svelte +++ b/src/lib/components/empty.svelte @@ -42,7 +42,7 @@
    Create your first {target} to get started.

    - Need a hand? Check out our documentation. + Need a hand? Learn more in our documentation.

    diff --git a/src/lib/components/permissions/team.svelte b/src/lib/components/permissions/team.svelte index 7b214f534..fdd4c5e9c 100644 --- a/src/lib/components/permissions/team.svelte +++ b/src/lib/components/permissions/team.svelte @@ -134,7 +134,7 @@ You have no teams. Create a team to see them here.

    - Need a hand? Check out our diff --git a/src/lib/components/permissions/user.svelte b/src/lib/components/permissions/user.svelte index 4488d8f01..5835023b6 100644 --- a/src/lib/components/permissions/user.svelte +++ b/src/lib/components/permissions/user.svelte @@ -153,7 +153,7 @@ You have no users. Create a user to see them here.

    - Need a hand? Check out our diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+page.svelte index 232e0be6d..d99f0bbf7 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+page.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/+page.svelte @@ -75,7 +75,7 @@

    diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte index 68b72fb5c..10f82e672 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte @@ -180,7 +180,7 @@
    Create your first attribute to get started.

    - Need a hand? Check out our documentation. + Need a hand? Learn more in our documentation.

    diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte index 605450998..81cc43c89 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte @@ -125,7 +125,7 @@
    Create your first attribute to get started.

    - Need a hand? Check out our documentation. + Need a hand? Learn more in our documentation.

    diff --git a/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte index fb36561ff..1e783436d 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/executions/+page.svelte @@ -110,7 +110,7 @@

    You have no execution logs. Create and activate a deployment to see it here.

    -

    Need a hand? Check out our documentation

    +

    Need a hand? Learn more in our documentation