chore: conditional rendering of umami
This commit is contained in:
@@ -9,13 +9,6 @@
|
||||
<link rel="icon" type="image/png" href="/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/logo-32.png" />
|
||||
|
||||
<script
|
||||
nonce="%sveltekit.nonce%"
|
||||
defer
|
||||
src="https://umami.hz.oncws.com/script.js"
|
||||
data-website-id="80a9544a-4dda-4c91-b62f-b6be7a8a3b5c"
|
||||
></script>
|
||||
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
let { title = $bindable(''), navClass = '', isCoursePage = false }: Props = $props();
|
||||
|
||||
let coursesPath = $derived(
|
||||
$globalStore.isOrgSite ? '/lms/mylearning' : isCoursePage ? `${$currentOrgPath}/courses` : $currentOrgPath
|
||||
$globalStore.isStudent ? '/lms/mylearning' : isCoursePage ? `${$currentOrgPath}/courses` : $currentOrgPath
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
<div class="flex items-center text-white">
|
||||
{#if isCoursePage}
|
||||
<li class="hidden md:block">
|
||||
<IconButton onclick={() => goto(resolve(coursesPath))}>
|
||||
<IconButton onclick={() => goto(resolve(coursesPath, {}))}>
|
||||
<ArrowLeftIcon size={16} class="custom" />
|
||||
</IconButton>
|
||||
</li>
|
||||
{/if}
|
||||
<a
|
||||
href={resolve(coursesPath)}
|
||||
href={resolve(coursesPath, {})}
|
||||
title="{$t('navigation.goto')} {isCoursePage ? $t('navigation.courses') : $t('navigation.classroomio_home')}"
|
||||
id="logo"
|
||||
class="line-clamp-1 text-lg"
|
||||
|
||||
@@ -116,6 +116,7 @@ class AppInitApi extends BaseApi {
|
||||
return;
|
||||
}
|
||||
|
||||
// This allows you to be on the landing page of an organization site and not be redirected
|
||||
if (isOrgSite && window.location.pathname === '/') {
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@
|
||||
|
||||
let { path, id, isStudent = false }: Props = $props();
|
||||
|
||||
const coursesListPath = $derived($globalStore.isOrgSite ? '/lms/mylearning' : `${$currentOrgPath}/courses`);
|
||||
const coursesListPath = $derived($globalStore.isStudent ? '/lms/mylearning' : `${$currentOrgPath}/courses`);
|
||||
const contentData = $derived(getCourseContent(courseApi.course));
|
||||
const sidebar = useSidebar();
|
||||
const contentCount = $derived.by(() => {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { currentOrg } from '$lib/utils/store/org';
|
||||
import { profile } from '$lib/utils/store/user';
|
||||
import { coursesApi } from '$features/course/api';
|
||||
import { resolve } from '$app/paths';
|
||||
|
||||
let totalCompleted = $derived(
|
||||
coursesApi.enrolledCourses.reduce((acc, cur) => {
|
||||
@@ -38,7 +39,7 @@
|
||||
? $currentOrg.customization.dashboard.bannerText
|
||||
: $t('dashboard.lms_dashboard_hero')}
|
||||
</p>
|
||||
<Button onclick={() => goto('/lms/mylearning')}>
|
||||
<Button onclick={() => goto(resolve('/lms/mylearning', {}))}>
|
||||
{$t('dashboard.continue_learning')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
function onClick(org: AccountOrg) {
|
||||
if (org.id === $currentOrg.id) return;
|
||||
|
||||
localStorage.setItem('classroomio_org_sitename', org.siteName);
|
||||
localStorage.setItem('classroomio_org_sitename', org.siteName!);
|
||||
currentOrg.set(org);
|
||||
|
||||
setTheme(org.theme);
|
||||
setTheme(org.theme!);
|
||||
window.location.href = $currentOrgPath;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PUBLIC_IS_SELFHOSTED } from '$env/static/public';
|
||||
import { dev } from '$app/environment';
|
||||
import { initPosthog } from '$lib/utils/services/posthog';
|
||||
import { initSentry } from '$lib/utils/services/sentry';
|
||||
import { initUmami } from '$lib/utils/services/umami';
|
||||
import { licenseApi } from '$features/license/api/license.svelte';
|
||||
|
||||
let isInitialized = false;
|
||||
@@ -11,12 +11,8 @@ export function setupAnalytics() {
|
||||
isInitialized = true;
|
||||
|
||||
initSentry();
|
||||
|
||||
initPosthog();
|
||||
|
||||
if (dev) {
|
||||
localStorage.setItem('umami.disabled', '1');
|
||||
}
|
||||
initUmami();
|
||||
}
|
||||
|
||||
/** Checks if this is cloud deployment and initializes analytics */
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { dev } from '$app/environment';
|
||||
import { licenseApi } from '$features/license/api/license.svelte';
|
||||
|
||||
const UMAMI_WEBSITE_ID = '80a9544a-4dda-4c91-b62f-b6be7a8a3b5c';
|
||||
|
||||
export const initUmami = (): void => {
|
||||
if (dev || licenseApi.hasAccess('no-tracking')) return;
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.defer = true;
|
||||
script.src = 'https://umami.hz.oncws.com/script.js';
|
||||
script.dataset.websiteId = UMAMI_WEBSITE_ID;
|
||||
const nonce = document.querySelector('script[nonce]')?.getAttribute('nonce');
|
||||
if (nonce) script.setAttribute('nonce', nonce);
|
||||
document.head.appendChild(script);
|
||||
};
|
||||
@@ -80,7 +80,7 @@
|
||||
{#snippet child()}
|
||||
<div class="mb-10 flex flex-wrap items-start">
|
||||
<div class="grid w-full grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{#each cards as card}
|
||||
{#each cards as card, i (i)}
|
||||
<ActivityCard activity={card} />
|
||||
{/each}
|
||||
</div>
|
||||
@@ -94,11 +94,11 @@
|
||||
|
||||
<div class="h-full space-y-6">
|
||||
{#if !topCourses}
|
||||
{#each Array(5) as _}
|
||||
{#each Array(5) as _, i (i)}
|
||||
<Skeleton class="h-10 w-full rounded-md" />
|
||||
{/each}
|
||||
{:else}
|
||||
{#each topCourses as course}
|
||||
{#each topCourses as course (course.id)}
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-4/6 space-y-1">
|
||||
<a class="hover:underline" href={`/courses/${course.id}`}>
|
||||
@@ -140,11 +140,11 @@
|
||||
|
||||
<div class="h-full space-y-6">
|
||||
{#if !enrollments}
|
||||
{#each Array(5) as _}
|
||||
{#each Array(5) as _, i (i)}
|
||||
<Skeleton class="h-10 w-full rounded-md" />
|
||||
{/each}
|
||||
{:else}
|
||||
{#each enrollments as enrollment}
|
||||
{#each enrollments as enrollment (enrollment.id)}
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<Avatar.Root class="h-6 w-6">
|
||||
|
||||
@@ -34,6 +34,7 @@ const defaultScriptSrcDomains = [
|
||||
'https://cdnjs.cloudflare.com',
|
||||
'https://*.posthog.com',
|
||||
'https://*.senja.io',
|
||||
'https://umami.hz.oncws.com',
|
||||
'https://www.youtube.com',
|
||||
'https://youtube.com',
|
||||
'https://google.com'
|
||||
|
||||
Reference in New Issue
Block a user