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 @@ + + + + + diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index 564fe2567..18a634b3f 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', @@ -31,8 +32,9 @@
+
{#if $app.themeInUse === 'dark'} @@ -43,16 +45,18 @@
+

Integrate with your favourite technologies

    + class="u-flex u-main-center u-flex-wrap u-gap-16 u-margin-block-start-32 u-line-height-1 u-opacity-0-5"> {#each technologies as tech}
  • -
  • @@ -62,7 +66,7 @@
    -
    +
    diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 71975c517..2b2f30128 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}${$page.url.search}`); + } else await goto(`${base}/login`); } finally { loaded = true; } 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 { 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); diff --git a/src/routes/invite.svelte b/src/routes/invite.svelte new file mode 100644 index 000000000..374ebc914 --- /dev/null +++ b/src/routes/invite.svelte @@ -0,0 +1,76 @@ + + + + Appwrite - Accept invite + + + + Invite + + {#if !userId || !secret || !membershipId || !teamId} +

    Invalid invite link.

    + {:else} +

    You have been invited to join a team project on Appwrite

    +
    + + + By accepting the invitation, you agree to the Terms and Conditions + and + + Privacy Policy. + +
    + + +
    +
    +
    + {/if} +
    +