chore: conditional rendering of umami
This commit is contained in:
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user