From 80cb9a56729b17d0d0ee23e150a9ae79ccaca67b Mon Sep 17 00:00:00 2001 From: emmanuel Date: Wed, 1 Nov 2023 09:45:40 +0000 Subject: [PATCH] CLASSROOMIO-T-255: Fix course sidebar bug CLASSROOMIO-T-255: Lesson page UX improvements CLASSROOMIO-T-255:Updated part of the code CLASSROOMIO-T-255:Worked on the sidebar CLASSROOMIO-T-255:Worked on the sidebar CLASSROOMIO-T-255:Worked on the sidebar CLASSROOMIO-T-255:Worked on the sidebar and the appbar Co-authored-by: Ifeanyi Nwosu Co-authored-by: Rotimi Best Merge-request: CLASSROOMIO-MR-117 Merged-by: Best Admin --- .../Apps/components/Poll/index.svelte | 2 +- src/lib/components/Apps/index.svelte | 10 ++-- .../Materials/components/ComponentNote.svelte | 2 +- .../components/Lesson/Materials/index.svelte | 14 ++++-- .../Course/components/Navigation/index.svelte | 24 ++++++---- src/lib/components/Course/index.svelte | 2 +- src/lib/components/LMS/SideBar.svelte | 6 +-- src/lib/components/Navigation/app.svelte | 22 +++++---- src/lib/components/Navigation/lms.svelte | 6 +-- src/lib/components/Org/SideBar.svelte | 6 +-- src/lib/components/Org/store.js | 6 +-- src/lib/components/Snackbar/index.svelte | 46 ++++++++----------- src/lib/components/TextEditor/index.svelte | 2 +- src/lib/utils/functions/string.ts | 3 ++ 14 files changed, 79 insertions(+), 72 deletions(-) create mode 100644 src/lib/utils/functions/string.ts diff --git a/src/lib/components/Apps/components/Poll/index.svelte b/src/lib/components/Apps/components/Poll/index.svelte index c9031615..667d26e5 100644 --- a/src/lib/components/Apps/components/Poll/index.svelte +++ b/src/lib/components/Apps/components/Poll/index.svelte @@ -149,7 +149,7 @@ } - +
diff --git a/src/lib/components/Apps/index.svelte b/src/lib/components/Apps/index.svelte index 085e4d9d..198f2416 100644 --- a/src/lib/components/Apps/index.svelte +++ b/src/lib/components/Apps/index.svelte @@ -40,7 +40,7 @@ } else { $apps.selectedApp = appName; } - $apps.dropdown = false; + $apps.dropdown = !$apps.dropdown; } function updateTopPadding(isStudent: boolean) { @@ -91,7 +91,6 @@ toolTipProps={{ title: 'Settings', hotkeys: ['A', '0'] }} onClick={() => { handleAppClick(); - $apps.dropdown = !$apps.dropdown; }} > @@ -194,9 +193,7 @@ @media screen and (min-width: 768px) and (max-width: 1023px) { .app { - min-width: 280px; - max-width: 300px; - width: 300px; + width: 50vw; position: relative; overflow: auto; } @@ -204,7 +201,8 @@ @media screen and (max-width: 767px) { .app { - width: 100%; + width: 100vw; + min-width: calc(100vw - 60px); position: relative; overflow: auto; } diff --git a/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte b/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte index dc929a22..d7f4389c 100644 --- a/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte +++ b/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte @@ -17,7 +17,7 @@ {#if !isNoteEmpty($lesson.materials?.note)} - +
{@html $lesson.materials.note} diff --git a/src/lib/components/Course/components/Lesson/Materials/index.svelte b/src/lib/components/Course/components/Lesson/Materials/index.svelte index 9c412e28..169a32db 100644 --- a/src/lib/components/Course/components/Lesson/Materials/index.svelte +++ b/src/lib/components/Course/components/Lesson/Materials/index.svelte @@ -36,6 +36,7 @@ import HtmlRender from '$lib/components/HTMLRender/HTMLRender.svelte'; import type { LessonPage } from '$lib/utils/types'; import { getTextFromHTML } from '$lib/utils/functions/course'; + import { snackbar } from '$lib/components/Snackbar/store'; export let mode = MODES.view; export let prevMode = ''; @@ -75,7 +76,7 @@ materials } : $lesson; - handleUpdateLessonMaterials(_lesson, lessonId); + return handleUpdateLessonMaterials(_lesson, lessonId); } function isNoteEmpty(note: string) { @@ -178,7 +179,12 @@ isSaving = true; timeoutId = setTimeout(async () => { - await saveLesson(updatedMaterials); + const { error } = await saveLesson(updatedMaterials); + + if (error) { + console.log('error saving lesson', error); + snackbar.error('We apologise, there was an error saving your lesson.'); + } isSaving = false; }, 500); } @@ -244,9 +250,9 @@ - + -

+

{lessonTitle}

diff --git a/src/lib/components/Course/components/Navigation/index.svelte b/src/lib/components/Course/components/Navigation/index.svelte index a42d7b68..cdf19b74 100644 --- a/src/lib/components/Course/components/Navigation/index.svelte +++ b/src/lib/components/Course/components/Navigation/index.svelte @@ -13,7 +13,7 @@ import { course } from '$lib/components/Course/store'; import { NavClasses } from '$lib/utils/constants/reusableClass'; import { isMobile } from '$lib/utils/store/useMobile'; - import { menu, sideBar } from '$lib/components/Org/store'; + import { sideBar } from '$lib/components/Org/store'; import { profile } from '$lib/utils/store/user'; import { getIsLessonComplete } from '../Lesson/functions'; @@ -38,7 +38,9 @@ let menuContentRef; const toggleSidebar = () => { - $menu.hidden = !$menu.hidden; + if ($isMobile) { + $sideBar.hidden = !$sideBar.hidden; + } }; function handleMainGroupClick(href: string) { @@ -103,7 +105,7 @@ if (newWidth < 150) { sidebarRef.style.width = '0'; menuContentRef.style.display = 'none'; - $sideBar.open = false; + $sideBar.hidden = true; isDragging = false; resize = false; } else if (newWidth > window.innerWidth / 3 && window.innerWidth >= 1280) { @@ -231,21 +233,25 @@