2023-07-18 13:50:47 +00:00
|
|
|
<script>
|
2025-12-22 02:36:48 +01:00
|
|
|
import * as Dialog from '@cio/ui/base/dialog';
|
2025-11-01 15:49:29 +01:00
|
|
|
import { page } from '$app/state';
|
2023-11-23 13:21:44 -08:00
|
|
|
import { goto } from '$app/navigation';
|
|
|
|
|
import { currentOrgPath } from '$lib/utils/store/org';
|
2024-03-22 06:30:24 +01:00
|
|
|
import { profile } from '$lib/utils/store/user';
|
2025-11-24 01:00:50 +01:00
|
|
|
import { t } from '$lib/utils/functions/translations';
|
|
|
|
|
import { classroomio } from '$lib/utils/services/api';
|
2024-03-22 06:30:24 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let query = new URLSearchParams(page.url.search);
|
2024-04-19 05:45:48 +01:00
|
|
|
let welcomePopup = query.get('welcomePopup');
|
2025-11-24 01:00:50 +01:00
|
|
|
let open = $derived(welcomePopup === 'true' && !!$profile.isEmailVerified);
|
2023-07-18 13:50:47 +00:00
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
let isLoading = $state(false);
|
2025-09-21 19:35:41 +01:00
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
const closeModal = async () => {
|
|
|
|
|
if (isLoading) return;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
isLoading = true;
|
|
|
|
|
await classroomio.onboarding.complete.$post({});
|
|
|
|
|
|
|
|
|
|
goto($currentOrgPath + '/courses?create=true');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error);
|
|
|
|
|
}
|
2023-07-28 09:06:03 +01:00
|
|
|
};
|
2023-07-18 13:50:47 +00:00
|
|
|
</script>
|
|
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
<Dialog.Root
|
|
|
|
|
{open}
|
|
|
|
|
onOpenChange={(isOpen) => {
|
|
|
|
|
if (!isOpen && !isLoading) closeModal();
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Dialog.Content class="w-9/12 w-[800px]">
|
|
|
|
|
<Dialog.Header>
|
|
|
|
|
<Dialog.Title>Welcome</Dialog.Title>
|
|
|
|
|
</Dialog.Header>
|
|
|
|
|
<p class="text-sm text-black md:text-base lg:text-lg dark:text-white">
|
|
|
|
|
{$t('welcome_modal.we_at')}
|
|
|
|
|
<a href="https://app.classroomio.com/" class="ui:text-primary no-underline hover:no-underline">ClassroomIO</a>
|
|
|
|
|
{$t('welcome_modal.small_team')}
|
|
|
|
|
<span class="ui:text-primary">{$t('welcome_modal.thank_you')};</span>
|
|
|
|
|
{$t('welcome_modal.deeply_appreciate')}
|
|
|
|
|
</p>
|
|
|
|
|
<img src="/images/welcome-img.svg" alt="A welcome banner" class="my-6 w-full" />
|
|
|
|
|
</Dialog.Content>
|
|
|
|
|
</Dialog.Root>
|