From 7523e6c3e724a038b820c3b4b76d357728bf7390 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Thu, 7 Sep 2023 10:47:25 +0000 Subject: [PATCH] CLASSROOMIO-T-150: Add teacher to course + linear lesson content clean up CLASSROOMIO-T-150: Notify teacher they have been added Make lesson content be linear on preview mode CLASSROOMIO-T-150: Add teachers with a dropdown to course Co-authored-by: Rotimi Best Merge-request: CLASSROOMIO-MR-69 Merged-by: Best Admin --- src/app.postcss | 5 + .../components/Lesson/Materials/index.svelte | 280 ++++++++++-------- .../components/People/InviationModal.svelte | 149 ++++++++-- .../Course/components/People/store.js | 8 +- .../Course/components/People/utils.ts | 31 ++ src/lib/components/Course/store.ts | 27 +- src/lib/components/Navigation/app.svelte | 6 +- src/lib/components/Navigation/lms.svelte | 6 +- src/lib/components/TextEditor/index.svelte | 2 +- src/lib/utils/functions/app.js | 2 +- src/lib/utils/functions/theme.ts | 1 + src/lib/utils/services/org/index.js | 10 +- src/lib/utils/services/sendgrid.ts | 2 +- src/lib/utils/store/org.ts | 4 +- src/lib/utils/types/org.ts | 10 + src/routes/+layout.svelte | 17 +- src/routes/api/completion/+server.js | 6 +- .../api/email/course/welcome/+server.js | 55 ++++ .../api/email/course/welcome/template.svelte | 19 ++ .../api/email/course/welcome/welcome.svelte | 53 ++++ src/routes/api/email/invite/+server.js | 4 +- .../lessons/[...lessonParams]/+page.svelte | 2 +- src/routes/courses/[id]/people/+page.svelte | 4 + 23 files changed, 511 insertions(+), 192 deletions(-) create mode 100644 src/lib/components/Course/components/People/utils.ts create mode 100644 src/routes/api/email/course/welcome/+server.js create mode 100644 src/routes/api/email/course/welcome/template.svelte create mode 100644 src/routes/api/email/course/welcome/welcome.svelte diff --git a/src/app.postcss b/src/app.postcss index a6599a33..005cb883 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -57,6 +57,11 @@ h6 { line-height: 1.25 !important; } +.prose p { + margin-top: 0px !important; + margin-bottom: 10px !important; +} + .dark .prose h1, .dark .prose h2, .dark .prose h3, diff --git a/src/lib/components/Course/components/Lesson/Materials/index.svelte b/src/lib/components/Course/components/Lesson/Materials/index.svelte index 401ca0a5..4562c24a 100644 --- a/src/lib/components/Course/components/Lesson/Materials/index.svelte +++ b/src/lib/components/Course/components/Lesson/Materials/index.svelte @@ -34,7 +34,9 @@ export let prevMode = ''; export let lessonId = ''; export let isSaving = false; + export let toggleMode = () => {}; + let lessonTitle = ''; let initAutoSave = false; let timeoutId: NodeJS.Timeout; let tabs = CONSTANTS.tabs; @@ -65,6 +67,8 @@ function isNoteEmpty(note) { if (!note || typeof note !== 'string') return true; + if (!document) return false; + const dummyDiv = document.createElement('div'); dummyDiv.innerHTML = note; @@ -73,6 +77,12 @@ return rawText === ''; } + function isMaterialsEmpty(materials) { + const { slide_url, videos, note } = materials; + + return isNoteEmpty(note) && !slide_url && isEmpty(videos); + } + function handleSave(prevMode: string) { if (prevMode === MODES.edit) { saveLesson(); @@ -138,7 +148,7 @@ window.players = players; } - function autoSave(updatedMaterials) { + function autoSave(updatedMaterials, _isLoading) { if (timeoutId) clearTimeout(timeoutId); if (!initAutoSave) { @@ -166,7 +176,7 @@ $uploadCourseVideoStore.isModalOpen = false; }; - $: autoSave($lesson.materials); + $: autoSave($lesson.materials, $isLoading); $: onLessonIdChange(lessonId); @@ -177,6 +187,8 @@ $: updateNoteByCompletion($completion); $: initPlyr(player, $lesson.materials.videos); + + $: lessonTitle = $lessons.find((les) => les.id === $lesson.id)?.title || ''; - - - - {#if mode === MODES.edit} +

+ {lessonTitle} +

+ +{#if mode === MODES.edit} + + +
- {:else if !isNoteEmpty($lesson.materials?.note)} -
- {@html $lesson.materials.note} -
- {:else} - -
- No Note -

No Notes yet

-

- Share your knowledge with the world by creating engaging notes. Add your notes now. -

-
-
- {/if} -
+
- - {#if mode === MODES.edit} - - {:else if $lesson.materials.slide_url} -