2023-10-29 12:07:34 +00:00
|
|
|
<script lang="ts">
|
2025-11-24 01:00:50 +01:00
|
|
|
import { page } from '$app/state';
|
2026-04-27 11:40:38 +01:00
|
|
|
import { onMount } from 'svelte';
|
2024-12-28 23:11:55 +01:00
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
import { Snackbar } from '$features/ui';
|
2026-04-27 11:40:38 +01:00
|
|
|
import { appInitApi } from '$features/app/init.svelte';
|
|
|
|
|
import { setupCloudAnalytics } from '$lib/utils/functions/appSetup';
|
|
|
|
|
import { globalStore } from '$lib/utils/store/app';
|
2026-05-18 03:47:22 +01:00
|
|
|
import { currentOrg, mergeAccountOrgFromServer } from '$lib/utils/store/org';
|
2026-04-27 11:40:38 +01:00
|
|
|
import { user } from '$lib/utils/store/user';
|
|
|
|
|
import { setTheme } from '$lib/utils/functions/theme';
|
|
|
|
|
import { authClient } from '$lib/utils/services/auth/client';
|
2024-12-26 07:23:46 +01:00
|
|
|
import merge from 'lodash/merge';
|
|
|
|
|
import { MetaTags } from 'svelte-meta-tags';
|
2025-11-01 16:18:29 +01:00
|
|
|
import { ModeWatcher } from '@cio/ui/base/dark-mode';
|
|
|
|
|
|
|
|
|
|
import '../app.css';
|
2021-07-12 05:55:57 +03:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let { data, children } = $props();
|
2023-08-14 06:22:03 +01:00
|
|
|
|
2025-11-24 01:00:50 +01:00
|
|
|
const metaTags = $derived(merge(data.baseMetaTags, page.data.pageMetaTags));
|
2026-04-27 11:40:38 +01:00
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
const loadingIndicator = document.getElementById('app-loading-indicator');
|
|
|
|
|
if (loadingIndicator) {
|
|
|
|
|
loadingIndicator.style.display = 'none';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setupCloudAnalytics();
|
|
|
|
|
|
|
|
|
|
if (data?.locals?.user) {
|
|
|
|
|
user.set({
|
|
|
|
|
...$user,
|
|
|
|
|
isLoggedIn: true,
|
|
|
|
|
currentSession: data.locals.user
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.isOrgSite && data.org) {
|
|
|
|
|
$globalStore.orgSiteName = data.orgSiteName || '';
|
|
|
|
|
$globalStore.isOrgSite = true;
|
2026-05-18 03:47:22 +01:00
|
|
|
currentOrg.set(mergeAccountOrgFromServer(data.org));
|
2026-04-27 11:40:38 +01:00
|
|
|
setTheme(data.org.theme || 'blue');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const session = authClient.useSession();
|
|
|
|
|
const isSessionReady = $derived(!$session.isPending && !$session.isRefetching && $session.data);
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if (isSessionReady && !appInitApi.isInitializedAndReady && !appInitApi.loading) {
|
|
|
|
|
appInitApi.setupApp($session.data as App.Locals, {
|
|
|
|
|
isOrgSite: data.isOrgSite,
|
|
|
|
|
orgSiteName: data.orgSiteName
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-11-24 01:00:50 +01:00
|
|
|
</script>
|
2022-12-30 13:08:54 +01:00
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
<div>
|
|
|
|
|
<ModeWatcher />
|
2025-11-01 16:18:29 +01:00
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
<MetaTags {...metaTags} />
|
2024-08-01 14:04:50 +01:00
|
|
|
|
2026-03-09 11:18:22 +01:00
|
|
|
<Snackbar />
|
2021-05-07 03:43:37 +03:00
|
|
|
|
2026-04-12 08:58:41 +01:00
|
|
|
{@render children?.()}
|
2026-03-09 11:18:22 +01:00
|
|
|
</div>
|
2021-05-07 03:43:37 +03:00
|
|
|
|
2020-12-24 20:32:05 +02:00
|
|
|
<style>
|
2021-05-06 08:22:25 +03:00
|
|
|
:global(:root) {
|
2021-07-28 22:29:23 +03:00
|
|
|
--main-primary-color: rgba(29, 78, 216, 1);
|
2021-05-06 08:22:25 +03:00
|
|
|
--border-color: #eaecef;
|
2023-09-26 11:23:54 +01:00
|
|
|
}
|
2023-04-23 22:28:18 +00:00
|
|
|
|
2023-08-20 21:28:55 +01:00
|
|
|
:global(.dark svg.dark) {
|
2023-05-05 20:19:45 +00:00
|
|
|
fill: #fff;
|
|
|
|
|
}
|
2023-05-11 15:15:18 +00:00
|
|
|
|
|
|
|
|
:global(.border-c) {
|
|
|
|
|
border: 1px solid var(--border-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:global(.border-bottom-c) {
|
|
|
|
|
border-bottom: 1px solid var(--border-color);
|
|
|
|
|
}
|
2023-08-07 09:53:07 +00:00
|
|
|
|
2023-08-24 07:32:19 +00:00
|
|
|
:global(.cards-container) {
|
|
|
|
|
width: 90%;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
padding: 0;
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
|
|
|
column-gap: 12px;
|
|
|
|
|
row-gap: 12px;
|
|
|
|
|
}
|
2023-09-12 11:31:20 +00:00
|
|
|
|
2023-09-08 09:17:05 +00:00
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
|
:global(.cards-container) {
|
|
|
|
|
width: 95%;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
padding: 0;
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
|
|
|
column-gap: 12px;
|
|
|
|
|
row-gap: 12px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-24 20:32:05 +02:00
|
|
|
</style>
|