2025-11-01 15:49:29 +01:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { page } from '$app/state';
|
2023-12-13 09:02:52 +03:00
|
|
|
import AddOrgModal from '$lib/components/Org/AddOrgModal/AddOrgModal.svelte';
|
|
|
|
|
import { isQuizPage } from '$lib/utils/functions/app';
|
|
|
|
|
import OrgSideBar from '$lib/components/Org/SideBar.svelte';
|
2024-03-22 06:30:24 +01:00
|
|
|
import VerifyEmailModal from '$lib/components/Org/VerifyEmail/VerifyEmailModal.svelte';
|
2024-04-07 06:08:34 +01:00
|
|
|
import Box from '$lib/components/Box/index.svelte';
|
|
|
|
|
import { currentOrg } from '$lib/utils/store/org';
|
|
|
|
|
import { goto } from '$app/navigation';
|
|
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let { data, children } = $props();
|
2024-04-07 06:08:34 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
function redirect(siteName: string) {
|
|
|
|
|
const newUrl = page.url.pathname.replace('*', siteName);
|
|
|
|
|
goto(newUrl + page.url.search);
|
2024-04-07 06:08:34 +01:00
|
|
|
}
|
2025-11-01 15:49:29 +01:00
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
data.orgName === '*' && redirect($currentOrg.siteName);
|
|
|
|
|
});
|
2023-12-13 09:02:52 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<AddOrgModal />
|
2024-04-19 05:45:48 +01:00
|
|
|
|
2024-03-22 06:30:24 +01:00
|
|
|
<VerifyEmailModal />
|
2024-04-19 05:45:48 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
<div class="org-root flex w-full items-center justify-between">
|
|
|
|
|
{#if !isQuizPage(page.url?.pathname)}
|
2023-12-13 09:02:52 +03:00
|
|
|
<OrgSideBar />
|
|
|
|
|
{/if}
|
2025-11-01 15:49:29 +01:00
|
|
|
<div class="org-slot w-full bg-white dark:bg-black">
|
2024-04-07 06:08:34 +01:00
|
|
|
{#if data.orgName === '*'}
|
|
|
|
|
<Box>Taking you to your organization...</Box>
|
|
|
|
|
{:else}
|
2025-11-01 15:49:29 +01:00
|
|
|
{@render children?.()}
|
2024-04-07 06:08:34 +01:00
|
|
|
{/if}
|
2023-12-13 09:02:52 +03:00
|
|
|
</div>
|
|
|
|
|
</div>
|