feat: centralize baseURL and app experience for cloud and self hosted
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
|
||||
|
||||
import { IconButton } from '@cio/ui/custom/icon-button';
|
||||
import { globalStore } from '$lib/utils/store/app';
|
||||
import { isStudentExperience } from '$lib/utils/store/app';
|
||||
import { currentOrgPath } from '$lib/utils/store/org';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
let { title = $bindable(''), navClass = '', isCoursePage = false }: Props = $props();
|
||||
|
||||
let coursesPath = $derived(
|
||||
$globalStore.isStudent ? '/lms/mylearning' : isCoursePage ? `${$currentOrgPath}/courses` : $currentOrgPath
|
||||
$isStudentExperience ? '/lms/mylearning' : isCoursePage ? `${$currentOrgPath}/courses` : $currentOrgPath
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import { resolve } from '$app/paths';
|
||||
import { ROLE } from '@cio/utils/constants';
|
||||
import { user } from '$lib/utils/store/user';
|
||||
import { currentOrg, currentOrgPath } from '$lib/utils/store/org';
|
||||
import { basePath } from '$lib/utils/store/app';
|
||||
import { isCoursePage } from '$lib/utils/functions/app';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
import type { TCustomLinks } from './types';
|
||||
@@ -38,11 +37,10 @@
|
||||
let redirect = $derived(isCoursePage(page.url.pathname) ? `?redirect=${page.url.pathname}` : '');
|
||||
let showLinks = $derived(customLinks && customLinks.show && customLinks.links && customLinks.links.length > 0);
|
||||
|
||||
let isAdminOrTeacher = $derived($currentOrg.roleId === ROLE.ADMIN || $currentOrg.roleId === ROLE.TUTOR);
|
||||
let gotoHref = $derived(
|
||||
isAdminOrTeacher && $currentOrgPath !== '#' ? resolve($currentOrgPath, {}) : resolve('/lms', {})
|
||||
let gotoHref = $derived(resolve($basePath !== '#' ? $basePath : '/lms', {}));
|
||||
let gotoLabel = $derived(
|
||||
$basePath === '/lms' || $basePath === '#' ? 'navigation.goto_lms' : 'navigation.goto_dashboard'
|
||||
);
|
||||
let gotoLabel = $derived(isAdminOrTeacher ? 'navigation.goto_dashboard' : 'navigation.goto_lms');
|
||||
|
||||
function toggleMobileMenu() {
|
||||
mobileMenuOpen = !mobileMenuOpen;
|
||||
|
||||
Reference in New Issue
Block a user