From 7aaa94d6028e7fd0400992bc170e37f8f36540d8 Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 1 Sep 2022 17:23:27 +0200 Subject: [PATCH 1/8] feat: update style of login page --- src/lib/elements/forms/button.svelte | 5 +- src/lib/images/login/login-dark-mode.svg | 284 ++++++++++++++++++++++ src/lib/images/login/login-light-mode.svg | 253 +++++++++++++++++++ src/routes/login.svelte | 129 ++++++++-- 4 files changed, 646 insertions(+), 25 deletions(-) create mode 100644 src/lib/images/login/login-dark-mode.svg create mode 100644 src/lib/images/login/login-light-mode.svg diff --git a/src/lib/elements/forms/button.svelte b/src/lib/elements/forms/button.svelte index 1b17010d2..641720d78 100644 --- a/src/lib/elements/forms/button.svelte +++ b/src/lib/elements/forms/button.svelte @@ -7,6 +7,7 @@ export let round = false; export let external = false; export let href: string = null; + export let fullWidth = false; //TODO: add option to add aria-label to buttons that are only icons @@ -20,7 +21,8 @@ class:is-only-icon={round} class:is-secondary={secondary} class:is-text={text} - class:is-danger={danger}> + class:is-danger={danger} + class:is-full-width={fullWidth}> {:else} @@ -32,6 +34,7 @@ class:is-secondary={secondary} class:is-danger={danger} class:is-text={text} + class:is-full-width={fullWidth} type={submit ? 'submit' : 'button'}> diff --git a/src/lib/images/login/login-dark-mode.svg b/src/lib/images/login/login-dark-mode.svg new file mode 100644 index 000000000..999b6b52a --- /dev/null +++ b/src/lib/images/login/login-dark-mode.svg @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/lib/images/login/login-light-mode.svg b/src/lib/images/login/login-light-mode.svg new file mode 100644 index 000000000..cc09c6267 --- /dev/null +++ b/src/lib/images/login/login-light-mode.svg @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/routes/login.svelte b/src/routes/login.svelte index 9d4fb293f..a3691f57d 100644 --- a/src/routes/login.svelte +++ b/src/routes/login.svelte @@ -12,6 +12,9 @@ import { addNotification } from '$lib/stores/notifications'; import { sdkForConsole } from '$lib/stores/sdk'; import { user } from '$lib/stores/user'; + import AppwriteLogo from '$lib/images/appwrite.svg'; + import LoginLight from '$lib/images/login/login-light-mode.svg'; + import LoginDark from '$lib/images/login/login-dark-mode.svg'; let mail: string, pass: string; @@ -31,34 +34,112 @@ }); } }; + + const technologies = [ + 'js', + 'flutter', + 'apple', + 'android', + 'node_js', + 'php', + 'python', + 'ruby', + 'dart', + 'kotlin', + 'swift' + ]; - Login + Appwrite - Sign in -

Login

+
+
+
+ + Appwrite + +
-
- - - - - - - -
+
-Create an Account +
+ + +
+ +
+ +
+

Integrate with your favourite technologies

+
    + {#each technologies as tech} +
  • +
  • + {/each} +
+
+
+
+
+
+
+ +
+

Sign In

+
+
+ + + + + + + +
+
+ + +
+ +
+

+ version 0.15.2.402 +

+
+
+
+
From 98b827197ed17a374d995098e7d3626668123c6c Mon Sep 17 00:00:00 2001 From: Arman Date: Fri, 2 Sep 2022 09:38:34 +0200 Subject: [PATCH 2/8] test: fix e2e --- tests/e2e/login.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/login.spec.ts b/tests/e2e/login.spec.ts index 89252aaba..be178d202 100644 --- a/tests/e2e/login.spec.ts +++ b/tests/e2e/login.spec.ts @@ -15,7 +15,7 @@ test('login page has inputs and button', async ({ page }) => { await page.goto('/login'); const mail = page.locator('id=email'); const pass = page.locator('id=password'); - const button = page.locator('button:has-text("Login")'); + const button = page.locator('button:has-text("Sign in")'); expect(await mail.isVisible()); expect(await pass.isVisible()); expect(await button.isVisible()); @@ -45,7 +45,7 @@ test('login page shows error & response is 401 with wrong inputs', async ({ page await page.goto('/login'); await page.fill('id=email', 'wrongemail@apppwrite.io'); await page.fill('id=password', 'wrongpassword'); - await page.click('button:has-text("Login")'); + await page.click('button:has-text("Sign in")'); page.on('response', (response) => { expect(response.status()).toBe(401); }); From 7d73b912be6fc947ad0e383d0678bfe80bde33db Mon Sep 17 00:00:00 2001 From: Arman Date: Fri, 2 Sep 2022 12:21:58 +0200 Subject: [PATCH 3/8] feat: refactor code, update register, create recover --- src/lib/layout/index.ts | 1 + src/lib/layout/unauthenticated.svelte | 82 +++++++++++++++ src/routes/login.svelte | 143 +++++++------------------- src/routes/recover.svelte | 57 ++++++++++ src/routes/register.svelte | 61 +++++++---- 5 files changed, 217 insertions(+), 127 deletions(-) create mode 100644 src/lib/layout/unauthenticated.svelte create mode 100644 src/routes/recover.svelte diff --git a/src/lib/layout/index.ts b/src/lib/layout/index.ts index 952f4817c..b0663de89 100644 --- a/src/lib/layout/index.ts +++ b/src/lib/layout/index.ts @@ -7,3 +7,4 @@ export { default as Notification } from './notification.svelte'; export { default as Notifications } from './notifications.svelte'; export { default as Shell } from './shell.svelte'; export { default as Breadcrumbs } from './breadcrumbs.svelte'; +export { default as Unauthenticated } from './unauthenticated.svelte'; diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte new file mode 100644 index 000000000..45088962e --- /dev/null +++ b/src/lib/layout/unauthenticated.svelte @@ -0,0 +1,82 @@ + + +
+
+
+ + Appwrite + +
+ +
+ +
+ + +
+ +
+ +
+

Integrate with your favourite technologies

+
    + {#each technologies as tech} +
  • +
  • + {/each} +
+
+
+
+
+
+
+ +
+

+
+ +
+ + +
+ +
+

+ version 0.15.2.402 +

+
+
+
+
diff --git a/src/routes/login.svelte b/src/routes/login.svelte index a3691f57d..1efd8040d 100644 --- a/src/routes/login.svelte +++ b/src/routes/login.svelte @@ -12,9 +12,7 @@ import { addNotification } from '$lib/stores/notifications'; import { sdkForConsole } from '$lib/stores/sdk'; import { user } from '$lib/stores/user'; - import AppwriteLogo from '$lib/images/appwrite.svg'; - import LoginLight from '$lib/images/login/login-light-mode.svg'; - import LoginDark from '$lib/images/login/login-dark-mode.svg'; + import { Unauthenticated } from '$lib/layout'; let mail: string, pass: string; @@ -34,112 +32,45 @@ }); } }; - - const technologies = [ - 'js', - 'flutter', - 'apple', - 'android', - 'node_js', - 'php', - 'python', - 'ruby', - 'dart', - 'kotlin', - 'swift' - ]; Appwrite - Sign in -
-
-
- - Appwrite - -
- -
- -
- - -
- -
- -
-

Integrate with your favourite technologies

-
    - {#each technologies as tech} -
  • -
  • - {/each} -
-
-
-
-
-
-
- -
-

Sign In

-
-
- - - - - - - -
-
- - -
- -
-

- version 0.15.2.402 -

-
-
-
-
+ + Sign in + +
+ + + + + + + +
+ + + + +
diff --git a/src/routes/recover.svelte b/src/routes/recover.svelte new file mode 100644 index 000000000..f638f29d1 --- /dev/null +++ b/src/routes/recover.svelte @@ -0,0 +1,57 @@ + + + + Appwrite - Recover + + + + Password Recovery + +
+ + + + + + + +
+ + + + +
diff --git a/src/routes/register.svelte b/src/routes/register.svelte index 14a9281cd..af0b7498e 100644 --- a/src/routes/register.svelte +++ b/src/routes/register.svelte @@ -11,6 +11,8 @@ } from '$lib/elements/forms'; import { addNotification } from '$lib/stores/notifications'; import { sdkForConsole } from '$lib/stores/sdk'; + import { Unauthenticated } from '$lib/layout'; + import FormList from '$lib/elements/forms/formList.svelte'; let name: string, mail: string, pass: string; @@ -29,27 +31,44 @@ - Register + Appwrite - Sign up -

Register

+ + Sign up + +
+ + + + - - - - - - - - -Login + + +
+ +
+ + + +
From 982f43bfe1e0948bebc2fc29eb95d8de55c80f9b Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 5 Sep 2022 11:31:15 +0200 Subject: [PATCH 4/8] feat: images shown logic handled by svelte --- src/lib/layout/unauthenticated.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index 45088962e..30d8a086c 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -2,6 +2,8 @@ import AppwriteLogo from '$lib/images/appwrite.svg'; import LoginLight from '$lib/images/login/login-light-mode.svg'; import LoginDark from '$lib/images/login/login-dark-mode.svg'; + 3; + import { app } from '$lib/stores/app'; const technologies = [ 'js', @@ -33,8 +35,11 @@
- - + {#if $app.themeInUse === 'dark'} + + {:else} + + {/if}
From 244ee79455b7cfe23093ad93462fd1224992ae4a Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 5 Sep 2022 11:52:40 +0200 Subject: [PATCH 5/8] feat: labels in login page --- src/routes/login.svelte | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/routes/login.svelte b/src/routes/login.svelte index 1efd8040d..3cf2d3edb 100644 --- a/src/routes/login.svelte +++ b/src/routes/login.svelte @@ -47,7 +47,6 @@ id="email" label="Email" placeholder="Email" - showLabel={false} autofocus={true} required={true} bind:value={mail} /> @@ -55,7 +54,6 @@ id="password" label="Password" placeholder="Password" - showLabel={false} required={true} meter={false} showPasswordButton={true} From 89fc4e7d17af1ec36af84c557d59b0c342c66c63 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 5 Sep 2022 11:53:09 +0200 Subject: [PATCH 6/8] chore: bump css to 0.0.0-52 --- package-lock.json | 28 ++++++++++++++-------------- package.json | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6b75109a5..8c63e3246 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.0.1", "dependencies": { "@aw-labs/appwrite-console": "^1.0.0-0", - "@aw-labs/icons": "0.0.0-51", - "@aw-labs/ui": "0.0.0-51", + "@aw-labs/icons": "0.0.0-52", + "@aw-labs/ui": "0.0.0-52", "echarts": "^5.3.3", "tippy.js": "^6.3.7", "web-vitals": "^2.1.4" @@ -77,14 +77,14 @@ } }, "node_modules/@aw-labs/icons": { - "version": "0.0.0-51", - "resolved": "https://registry.npmjs.org/@aw-labs/icons/-/icons-0.0.0-51.tgz", - "integrity": "sha512-fp/ysdMyjbG9lnYTDSE58cOxbHP6xj+N6GCVQm9vYmqZ3/FbE2lTayc8lW7v0FrL/EKWoD7bInwspiniK4jKfQ==" + "version": "0.0.0-52", + "resolved": "https://registry.npmjs.org/@aw-labs/icons/-/icons-0.0.0-52.tgz", + "integrity": "sha512-A2bqLMTETaWUYiXuruw8zkW292rjGOeAtII+FbgasHkoJvC8cf2Ne2av4rzqenJdx6zRDQTRmwJl8FW7hcwI8Q==" }, "node_modules/@aw-labs/ui": { - "version": "0.0.0-51", - "resolved": "https://registry.npmjs.org/@aw-labs/ui/-/ui-0.0.0-51.tgz", - "integrity": "sha512-oTTrnN/Okhl1Yvs5eNpnYHjtxmYdUxW7tUPhgamsK5EwvkU0dxoj5vcI9KK3QbJmD9qxlwJrh9xlyOqQTXsZBQ==", + "version": "0.0.0-52", + "resolved": "https://registry.npmjs.org/@aw-labs/ui/-/ui-0.0.0-52.tgz", + "integrity": "sha512-4xS+rCd/UDI+p0JMceIbNO4uZ3HYz5TcfCWdgHFA5seBJ6rN0wS/bZPxjHd95BL0on5RtruME0t151gD4dFFxQ==", "dependencies": { "@aw-labs/icons": "*" } @@ -7698,14 +7698,14 @@ } }, "@aw-labs/icons": { - "version": "0.0.0-51", - "resolved": "https://registry.npmjs.org/@aw-labs/icons/-/icons-0.0.0-51.tgz", - "integrity": "sha512-fp/ysdMyjbG9lnYTDSE58cOxbHP6xj+N6GCVQm9vYmqZ3/FbE2lTayc8lW7v0FrL/EKWoD7bInwspiniK4jKfQ==" + "version": "0.0.0-52", + "resolved": "https://registry.npmjs.org/@aw-labs/icons/-/icons-0.0.0-52.tgz", + "integrity": "sha512-A2bqLMTETaWUYiXuruw8zkW292rjGOeAtII+FbgasHkoJvC8cf2Ne2av4rzqenJdx6zRDQTRmwJl8FW7hcwI8Q==" }, "@aw-labs/ui": { - "version": "0.0.0-51", - "resolved": "https://registry.npmjs.org/@aw-labs/ui/-/ui-0.0.0-51.tgz", - "integrity": "sha512-oTTrnN/Okhl1Yvs5eNpnYHjtxmYdUxW7tUPhgamsK5EwvkU0dxoj5vcI9KK3QbJmD9qxlwJrh9xlyOqQTXsZBQ==", + "version": "0.0.0-52", + "resolved": "https://registry.npmjs.org/@aw-labs/ui/-/ui-0.0.0-52.tgz", + "integrity": "sha512-4xS+rCd/UDI+p0JMceIbNO4uZ3HYz5TcfCWdgHFA5seBJ6rN0wS/bZPxjHd95BL0on5RtruME0t151gD4dFFxQ==", "requires": { "@aw-labs/icons": "*" } diff --git a/package.json b/package.json index 5bbc0e2ef..73f4f7fb6 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ }, "dependencies": { "@aw-labs/appwrite-console": "^1.0.0-0", - "@aw-labs/icons": "0.0.0-51", - "@aw-labs/ui": "0.0.0-51", + "@aw-labs/icons": "0.0.0-52", + "@aw-labs/ui": "0.0.0-52", "echarts": "^5.3.3", "tippy.js": "^6.3.7", "web-vitals": "^2.1.4" From 12bdfd66367fe59e78ff8e4fbcd30a560922e06b Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 5 Sep 2022 12:07:07 +0200 Subject: [PATCH 7/8] fix: remove await and userfetch --- src/routes/recover.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/routes/recover.svelte b/src/routes/recover.svelte index f638f29d1..35c74a772 100644 --- a/src/routes/recover.svelte +++ b/src/routes/recover.svelte @@ -3,14 +3,12 @@ import { Button, Form, FormItem, FormList, InputEmail } from '$lib/elements/forms'; import { addNotification } from '$lib/stores/notifications'; import { sdkForConsole } from '$lib/stores/sdk'; - import { user } from '$lib/stores/user'; import { Unauthenticated } from '$lib/layout'; let mail: string; const recover = async () => { try { - await sdkForConsole.account.createRecovery(mail, `${base}`); - user.fetchUser(); + sdkForConsole.account.createRecovery(mail, `${base}`); addNotification({ type: 'success', message: 'We have sent you an email with a password reset link' @@ -45,7 +43,8 @@ - + +