From 8b52afd21cc17f201ece8c7b7051d41bde3f0a43 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 14:29:33 +0200 Subject: [PATCH 01/12] feat: replaced icons with svg --- src/lib/layout/unauthenticated.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index 564fe2567..f224530a3 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -3,6 +3,7 @@ import LoginLight from '$lib/images/login/login-light-mode.svg'; import LoginDark from '$lib/images/login/login-dark-mode.svg'; import { app } from '$lib/stores/app'; + import { base } from '$app/paths'; const technologies = [ 'js', @@ -51,10 +52,9 @@ class="u-flex u-main-center u-flex-wrap u-gap-16 u-margin-block-start-32 u-line-height-1 "> {#each technologies as tech}
  • -
  • {/each} From 75e0b90fabd676a404a3b9f1909501b274cb90a2 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 15:17:32 +0200 Subject: [PATCH 02/12] feat: start work on invite page --- src/lib/layout/unauthenticated.svelte | 4 ++- src/routes/__layout.svelte | 6 +++- src/routes/invite.svelte | 47 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/routes/invite.svelte diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index f224530a3..c73669bb8 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -54,7 +54,9 @@
  • {tech} + alt={tech} + aria-hidden="true" + aria-label={tech} />
  • {/each} diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 71975c517..f32e855a0 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -23,6 +23,8 @@ window.GOOGLE_ANALYTICS = import.meta.env.VITE_GOOGLE_ANALYTICS?.toString() ?? false; } + const acceptedRoutes = ['/login', '/register', '/recover', '/invite']; + onMount(async () => { try { if (!$user) { @@ -33,7 +35,9 @@ await redirectTo(); } } catch (error) { - await goto(`${base}/login`); + if (acceptedRoutes.includes($page.url.pathname)) { + await goto(`${base}${$page.url.pathname}`); + } else await goto(`${base}/login`); } finally { loaded = true; } diff --git a/src/routes/invite.svelte b/src/routes/invite.svelte new file mode 100644 index 000000000..8063113c3 --- /dev/null +++ b/src/routes/invite.svelte @@ -0,0 +1,47 @@ + + + + Appwrite - Accept invite + + + + Invite + +
    + + + + + + +
    +
    +
    From ec7f894e4dde7c070987c94e7fcfd1592e22641d Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 18:31:51 +0200 Subject: [PATCH 03/12] feat: update css --- src/lib/layout/unauthenticated.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index c73669bb8..8bd6ed1ac 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -32,8 +32,9 @@
    +
    {#if $app.themeInUse === 'dark'} @@ -44,8 +45,9 @@
    +

    Integrate with your favourite technologies

      -
      +
      From c81e1ccec086dd501456b348d856a650847bfc37 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 18:32:17 +0200 Subject: [PATCH 04/12] feat: create inputChoice --- src/lib/elements/forms/index.ts | 1 + src/lib/elements/forms/inputChoice.svelte | 30 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/lib/elements/forms/inputChoice.svelte diff --git a/src/lib/elements/forms/index.ts b/src/lib/elements/forms/index.ts index 48988a2fe..7ed7d656f 100644 --- a/src/lib/elements/forms/index.ts +++ b/src/lib/elements/forms/index.ts @@ -15,5 +15,6 @@ export { default as InputSearch } from './inputSearch.svelte'; export { default as InputRadio } from './inputRadio.svelte'; export { default as InputSelect } from './inputSelect.svelte'; export { default as InputCheckbox } from './inputCheckbox.svelte'; +export { default as InputChoice } from './inputChoice.svelte'; export { default as InputPhone } from './inputPhone.svelte'; export { default as Helper } from './helper.svelte'; diff --git a/src/lib/elements/forms/inputChoice.svelte b/src/lib/elements/forms/inputChoice.svelte new file mode 100644 index 000000000..be04a386a --- /dev/null +++ b/src/lib/elements/forms/inputChoice.svelte @@ -0,0 +1,30 @@ + + + + + From 43ed6e33f5b5f015b4b9980076b3f6056cdcbd32 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 18:32:46 +0200 Subject: [PATCH 05/12] fix: invite url --- .../console/organization-[organization]/_createMember.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/console/organization-[organization]/_createMember.svelte b/src/routes/console/organization-[organization]/_createMember.svelte index 237c167ca..b3b2f67c5 100644 --- a/src/routes/console/organization-[organization]/_createMember.svelte +++ b/src/routes/console/organization-[organization]/_createMember.svelte @@ -14,7 +14,7 @@ const dispatch = createEventDispatcher(); let email: string, name: string, error: string; - const url = `${$page.url.origin}/console/`; + const url = `${$page.url.origin}/invite`; const create = async () => { try { From e5d623cc14c221eb9a063b21df38441fa8c7d4f5 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 18:33:15 +0200 Subject: [PATCH 06/12] fix: add notification to resend invite --- .../members.svelte | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/routes/console/organization-[organization]/members.svelte b/src/routes/console/organization-[organization]/members.svelte index 1106e994a..0a3bc0115 100644 --- a/src/routes/console/organization-[organization]/members.svelte +++ b/src/routes/console/organization-[organization]/members.svelte @@ -18,6 +18,7 @@ import type { Models } from '@aw-labs/appwrite-console'; import { pageLimit } from '$lib/stores/layout'; import { page } from '$app/stores'; + import { addNotification } from '$lib/stores/notifications'; let search = ''; let offset: number = null; @@ -29,14 +30,26 @@ const getAvatar = (name: string) => sdkForConsole.avatars.getInitials(name, 120, 120).toString(); const deleted = () => memberList.load($organization.$id, search, $pageLimit, offset ?? 0); - const resend = async (member: Models.Membership) => - await sdkForConsole.teams.createMembership( - $organization.$id, - member.userEmail, - member.roles, - url, - member.userName - ); + const resend = async (member: Models.Membership) => { + try { + await sdkForConsole.teams.createMembership( + $organization.$id, + member.userEmail, + member.roles, + url, + member.userName + ); + addNotification({ + type: 'success', + message: `Invite has been sent to ${member.userEmail}` + }); + } catch (error) { + addNotification({ + type: 'error', + message: error + }); + } + }; $: if (search) offset = 0; $: memberList.load($organization.$id, search, $pageLimit, offset ?? 0); From 0d283a61754d67e3dae1f12f5c0f9b7e26d61038 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 18:33:43 +0200 Subject: [PATCH 07/12] feat: mantain url search params --- src/routes/__layout.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index f32e855a0..2b2f30128 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -36,7 +36,7 @@ } } catch (error) { if (acceptedRoutes.includes($page.url.pathname)) { - await goto(`${base}${$page.url.pathname}`); + await goto(`${base}${$page.url.pathname}${$page.url.search}`); } else await goto(`${base}/login`); } finally { loaded = true; From 8ce7c6040bf631f1c6feece9ceb1123b092b6e28 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 6 Sep 2022 18:34:47 +0200 Subject: [PATCH 08/12] feat: accept invite function --- src/routes/invite.svelte | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/routes/invite.svelte b/src/routes/invite.svelte index 8063113c3..fd6814476 100644 --- a/src/routes/invite.svelte +++ b/src/routes/invite.svelte @@ -1,18 +1,26 @@