2025-11-01 15:49:29 +01:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { page } from '$app/state';
|
2024-04-07 06:08:34 +01:00
|
|
|
import { goto } from '$app/navigation';
|
2025-11-24 01:00:50 +01:00
|
|
|
import * as Sidebar from '@cio/ui/base/sidebar';
|
2025-11-21 12:18:04 +01:00
|
|
|
import { Skeleton } from '@cio/ui/base/skeleton';
|
|
|
|
|
import { currentOrg } from '$lib/utils/store/org';
|
2025-12-22 02:36:48 +01:00
|
|
|
import { AppHeader } from '$features/ui';
|
2026-03-09 11:18:22 +01:00
|
|
|
import { PUBLIC_IS_SELFHOSTED } from '$env/static/public';
|
2025-11-21 12:18:04 +01:00
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
import { VerifyEmailModal } from '$features/onboarding/components';
|
2025-11-24 01:00:50 +01:00
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
import { OrgSidebar } from '$features/ui/sidebar/org-sidebar';
|
|
|
|
|
import { AddOrgModal } from '$features/org';
|
2024-04-07 06:08:34 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let { data, children } = $props();
|
2024-04-07 06:08:34 +01:00
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
function redirect(siteName: string | null) {
|
2025-11-24 01:00:50 +01:00
|
|
|
if (!siteName) return;
|
|
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
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>
|
|
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
{#if PUBLIC_IS_SELFHOSTED !== 'true'}
|
|
|
|
|
<AddOrgModal />
|
|
|
|
|
{/if}
|
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-24 01:00:50 +01:00
|
|
|
<Sidebar.Provider>
|
|
|
|
|
<OrgSidebar />
|
2025-11-21 12:18:04 +01:00
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
<Sidebar.Inset>
|
|
|
|
|
<AppHeader />
|
2025-11-21 12:18:04 +01:00
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
<div class="mx-auto flex w-full max-w-6xl flex-1 flex-col gap-4 px-4">
|
2025-11-24 01:00:50 +01:00
|
|
|
{#if data.orgName === '*'}
|
|
|
|
|
<div class="grid auto-rows-min gap-4 md:grid-cols-3">
|
|
|
|
|
<Skeleton class="aspect-video rounded-xl" />
|
|
|
|
|
<Skeleton class="aspect-video rounded-xl" />
|
|
|
|
|
<Skeleton class="aspect-video rounded-xl" />
|
2025-11-21 12:18:04 +01:00
|
|
|
</div>
|
2025-11-24 01:00:50 +01:00
|
|
|
<Skeleton class="h-[50vh] w-full rounded-xl" />
|
|
|
|
|
{:else}
|
|
|
|
|
{@render children?.()}
|
2025-11-21 12:18:04 +01:00
|
|
|
{/if}
|
2025-11-24 01:00:50 +01:00
|
|
|
</div>
|
|
|
|
|
</Sidebar.Inset>
|
|
|
|
|
</Sidebar.Provider>
|