When no custom favicon is set, fall back to the organization logo on public org-site pages instead of the default ClassroomIO icon. For OG images, only apply the theme-color background behind the logo when rendering initials; real logo images now render without the tint. Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: Rotimi Best <[email protected]>
48 lines
1.2 KiB
Svelte
48 lines
1.2 KiB
Svelte
<script lang="ts">
|
|
import { PageRestricted } from '$features/ui';
|
|
import { currentOrg } from '$lib/utils/store/org';
|
|
import { onMount } from 'svelte';
|
|
import { afterNavigate } from '$app/navigation';
|
|
import { analytics } from '@cio/analytics/client';
|
|
import { getRequestBaseUrl } from '$lib/utils/services/api';
|
|
import type { Snippet } from 'svelte';
|
|
import type { AccountOrg } from '$features/app/types';
|
|
|
|
interface Props {
|
|
children?: Snippet;
|
|
data: {
|
|
isOrgSite: boolean;
|
|
org: AccountOrg | null;
|
|
};
|
|
}
|
|
|
|
let { children, data }: Props = $props();
|
|
|
|
onMount(() => {
|
|
const apiBaseUrl = getRequestBaseUrl();
|
|
if (!apiBaseUrl) return;
|
|
|
|
analytics.init({
|
|
endpoint: `${apiBaseUrl.replace(/\/$/, '')}/dash/track`,
|
|
orgId: data.org?.id ?? undefined
|
|
});
|
|
analytics.pageView({ kind: 'landing' });
|
|
});
|
|
|
|
afterNavigate(({ to }) => {
|
|
if (!to) return;
|
|
|
|
const isCoursePage = /\/course\//.test(to.url.pathname);
|
|
analytics.pageView({
|
|
kind: isCoursePage ? 'course' : 'landing',
|
|
path: to.url.pathname
|
|
});
|
|
});
|
|
</script>
|
|
|
|
{#if data.org?.isRestricted || $currentOrg.isRestricted}
|
|
<PageRestricted />
|
|
{:else}
|
|
{@render children?.()}
|
|
{/if}
|