From bb2f788a4098534ee63e9d57357b586aa81c7718 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Sat, 5 Aug 2023 07:47:17 +0100 Subject: [PATCH] =?UTF-8?q?CLASSROOMIO-T-97:=20Better=20course=20UX=20?= =?UTF-8?q?=F0=9F=98=8D=F0=9F=98=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Course/components/Navigation/index.svelte | 3 ++- src/lib/components/Icons/CourseIcon.svelte | 6 ++++- src/lib/components/Navigation/app.svelte | 24 +++++++++++++++---- src/lib/components/PageBody/index.svelte | 2 +- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/lib/components/Course/components/Navigation/index.svelte b/src/lib/components/Course/components/Navigation/index.svelte index 9f73725a..4d5ca318 100644 --- a/src/lib/components/Course/components/Navigation/index.svelte +++ b/src/lib/components/Course/components/Navigation/index.svelte @@ -172,7 +172,7 @@ --> -
+
{#each navItems as navItem} {#if !navItem.show || (typeof navItem.show === 'function' && navItem.show())} {item.title} + {#if !item.is_unlocked} diff --git a/src/lib/components/Icons/CourseIcon.svelte b/src/lib/components/Icons/CourseIcon.svelte index da815d27..2734037b 100644 --- a/src/lib/components/Icons/CourseIcon.svelte +++ b/src/lib/components/Icons/CourseIcon.svelte @@ -1,3 +1,7 @@ + + diff --git a/src/lib/components/Navigation/app.svelte b/src/lib/components/Navigation/app.svelte index 425d2e67..bd672d4e 100644 --- a/src/lib/components/Navigation/app.svelte +++ b/src/lib/components/Navigation/app.svelte @@ -4,11 +4,14 @@ import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte'; import Moon from 'carbon-icons-svelte/lib/Moon.svelte'; import Sun from 'carbon-icons-svelte/lib/Sun.svelte'; + import CourseIcon from '$lib/components/Icons/CourseIcon.svelte'; import IconButton from '$lib/components/IconButton/index.svelte'; + import { course } from '$lib/components/Course/store'; import { appStore } from '$lib/utils/store/app'; import { currentOrgPath } from '$lib/utils/store/org'; import { toggleBodyByTheme } from '$lib/utils/functions/app'; + import { goto } from '$app/navigation'; export let title = ''; export let navClass = ''; @@ -24,23 +27,34 @@ } } - function getPathName(_isCoursePage) { + function getPathName(_isCoursePage = false) { if (!_isCoursePage) { - return $currentOrgPath ?? '/'; + return '/'; } - return $currentOrgPath ? `${$currentOrgPath}/courses` : ''; + return $course.slug ? `${$page.url.host}/course/${$course.slug}` : `${$currentOrgPath}/courses`; }