Fix issue with edge function
This commit is contained in:
@@ -59,8 +59,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (localStorage.getItem('hideCourseNav')) {
|
if (browser) {
|
||||||
show = localStorage.getItem('hideCourseNav') === 'false';
|
if (localStorage.getItem('hideCourseNav')) {
|
||||||
|
show = localStorage.getItem('hideCourseNav') === 'false';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
show = true;
|
show = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
|
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
|
||||||
import Moon from 'carbon-icons-svelte/lib/Moon.svelte';
|
import Moon from 'carbon-icons-svelte/lib/Moon.svelte';
|
||||||
import Sun from 'carbon-icons-svelte/lib/Sun.svelte';
|
import Sun from 'carbon-icons-svelte/lib/Sun.svelte';
|
||||||
@@ -14,19 +15,17 @@
|
|||||||
$appStore.isDark = !$appStore.isDark;
|
$appStore.isDark = !$appStore.isDark;
|
||||||
|
|
||||||
toggleBodyByTheme($appStore.isDark);
|
toggleBodyByTheme($appStore.isDark);
|
||||||
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
|
|
||||||
|
if (browser) {
|
||||||
|
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="{navClass} flex w-full p-2 md:px-6 bg-blue-600">
|
<nav class="{navClass} flex w-full p-2 md:px-6 bg-blue-600">
|
||||||
<ul class="flex w-full items-center">
|
<ul class="flex w-full items-center">
|
||||||
<div class="">
|
<div class="">
|
||||||
<a
|
<a href={$page.url.pathname} title="Go to ClassroomIO Home" id="logo" class="text-lg">
|
||||||
href={$page.url.pathname}
|
|
||||||
title="Go to ClassroomIO Home"
|
|
||||||
id="logo"
|
|
||||||
class="text-lg"
|
|
||||||
>
|
|
||||||
ClassroomIO
|
ClassroomIO
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
|
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
|
||||||
import MoonIcon from 'carbon-icons-svelte/lib/Moon.svelte';
|
import MoonIcon from 'carbon-icons-svelte/lib/Moon.svelte';
|
||||||
import SunIcon from 'carbon-icons-svelte/lib/Sun.svelte';
|
import SunIcon from 'carbon-icons-svelte/lib/Sun.svelte';
|
||||||
@@ -14,19 +15,16 @@
|
|||||||
$appStore.isDark = !$appStore.isDark;
|
$appStore.isDark = !$appStore.isDark;
|
||||||
|
|
||||||
toggleBodyByTheme($appStore.isDark);
|
toggleBodyByTheme($appStore.isDark);
|
||||||
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
|
if (browser) {
|
||||||
|
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="{navClass} flex w-full p-2 md:px-6 bg-blue-600">
|
<nav class="{navClass} flex w-full p-2 md:px-6 bg-blue-600">
|
||||||
<ul class="flex w-full items-center">
|
<ul class="flex w-full items-center">
|
||||||
<div class="">
|
<div class="">
|
||||||
<a
|
<a href={$page.url.pathname} title="Go to ClassroomIO Home" id="logo" class="text-lg">
|
||||||
href={$page.url.pathname}
|
|
||||||
title="Go to ClassroomIO Home"
|
|
||||||
id="logo"
|
|
||||||
class="text-lg"
|
|
||||||
>
|
|
||||||
ClassroomIO
|
ClassroomIO
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { dev } from '$app/environment';
|
import { dev, browser } from '$app/environment';
|
||||||
import { page, navigating } from '$app/stores';
|
import { page, navigating } from '$app/stores';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import * as Sentry from '@sentry/browser';
|
import * as Sentry from '@sentry/browser';
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setOrgBasedOnUrl(host) {
|
function setOrgBasedOnUrl(host) {
|
||||||
if (typeof window !== 'undefined') {
|
if (browser) {
|
||||||
const debug = localStorage.getItem('role') === 'student';
|
const debug = localStorage.getItem('role') === 'student';
|
||||||
const matches = host.match(/([a-z0-9]+).*classroomio[.]com/);
|
const matches = host.match(/([a-z0-9]+).*classroomio[.]com/);
|
||||||
const subdomain = matches?.[1] ?? '';
|
const subdomain = matches?.[1] ?? '';
|
||||||
@@ -243,9 +243,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update theme - dark or light mode
|
if (browser) {
|
||||||
$appStore.isDark = localStorage.getItem('theme') === 'dark';
|
// Update theme - dark or light mode
|
||||||
toggleBodyByTheme($appStore.isDark);
|
$appStore.isDark = localStorage.getItem('theme') === 'dark';
|
||||||
|
toggleBodyByTheme($appStore.isDark);
|
||||||
|
}
|
||||||
|
|
||||||
if ($appStore.isStudentDomain) {
|
if ($appStore.isStudentDomain) {
|
||||||
getCurrentOrg($appStore.siteNameFromDomain);
|
getCurrentOrg($appStore.siteNameFromDomain);
|
||||||
|
|||||||
Reference in New Issue
Block a user