From bd94594b56aab8b8057c594250945e8b5e193ac1 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Thu, 25 Apr 2024 06:51:39 +0100 Subject: [PATCH] feat: students can view org landing page from LMS --- .../src/lib/components/Box/index.svelte | 2 +- .../components/Buttons/VisitOrgSite.svelte | 12 ++++++++-- .../Materials/components/ComponentNote.svelte | 9 +++----- .../components/Org/LandingPage/index.svelte | 22 ++++++++++++++----- .../src/lib/utils/constants/routes.ts | 2 ++ .../src/lib/utils/translations/de.json | 3 ++- .../src/lib/utils/translations/en.json | 1 + .../src/lib/utils/translations/es.json | 3 ++- .../src/lib/utils/translations/fr.json | 3 ++- .../src/lib/utils/translations/hi.json | 3 ++- .../src/lib/utils/translations/pt.json | 3 ++- .../src/lib/utils/translations/re.json | 3 ++- .../src/lib/utils/translations/vi.json | 3 ++- apps/dashboard/src/routes/+layout.svelte | 2 +- apps/dashboard/src/routes/404/+page.svelte | 4 ++-- .../dashboard/src/routes/home/+page.server.ts | 5 ----- apps/dashboard/src/routes/home/+page.svelte | 7 ++++++ apps/dashboard/src/routes/lms/+page.svelte | 14 ++++++++---- 18 files changed, 67 insertions(+), 34 deletions(-) delete mode 100644 apps/dashboard/src/routes/home/+page.server.ts create mode 100644 apps/dashboard/src/routes/home/+page.svelte diff --git a/apps/dashboard/src/lib/components/Box/index.svelte b/apps/dashboard/src/lib/components/Box/index.svelte index caeb7d1d..0b920426 100644 --- a/apps/dashboard/src/lib/components/Box/index.svelte +++ b/apps/dashboard/src/lib/components/Box/index.svelte @@ -3,7 +3,7 @@
diff --git a/apps/dashboard/src/lib/components/Buttons/VisitOrgSite.svelte b/apps/dashboard/src/lib/components/Buttons/VisitOrgSite.svelte index e772f585..ae3f0d66 100644 --- a/apps/dashboard/src/lib/components/Buttons/VisitOrgSite.svelte +++ b/apps/dashboard/src/lib/components/Buttons/VisitOrgSite.svelte @@ -5,14 +5,22 @@ import { currentOrgDomain } from '$lib/utils/store/org'; import { isMobile } from '$lib/utils/store/useMobile'; import { t } from '$lib/utils/functions/translations'; + import { user } from '$lib/utils/store/user'; export let className = ''; + export let isLMS = false; + + $: href = isLMS && $user.isLoggedIn ? `${$currentOrgDomain}/home` : $currentOrgDomain; - + {#if !$isMobile} - {$t('settings.subheadings.view_site')} + {#if isLMS} + {$t('dashboard.visit_site')} + {:else} + {$t('settings.subheadings.view_site')} + {/if} {/if} diff --git a/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte b/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte index d14fb3e5..dce92a8c 100644 --- a/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte +++ b/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/components/ComponentNote.svelte @@ -5,9 +5,7 @@ lesson, lessonByTranslation } from '$lib/components/Course/components/Lesson/store/lessons'; - import Box from '$lib/components/Box/index.svelte'; import { t } from '$lib/utils/functions/translations'; - import AlignBoxTopLeft from 'carbon-icons-svelte/lib/AlignBoxTopLeft.svelte'; import { lessonFallbackNote } from '$lib/utils/functions/translations'; export let lessonId: string; @@ -31,10 +29,9 @@ {:else if hasAtLeastOneTranslation} - - -

+
+

{$t('course.navItem.lessons.materials.no_translation')}

- +
{/if} diff --git a/apps/dashboard/src/lib/components/Org/LandingPage/index.svelte b/apps/dashboard/src/lib/components/Org/LandingPage/index.svelte index a1e06bc7..2d2aad40 100644 --- a/apps/dashboard/src/lib/components/Org/LandingPage/index.svelte +++ b/apps/dashboard/src/lib/components/Org/LandingPage/index.svelte @@ -109,18 +109,22 @@ return youtubeRegex.test(link.trim()); } - onMount(async () => { - if (!orgSiteName) return; + $: loadData(orgSiteName); + + async function loadData(siteName) { + if (!siteName) return; + try { - console.log('sitename', orgSiteName); + console.log('sitename', siteName); $courseMetaDeta.isLoading = true; - const coursesResult = await getCourseBySiteName(orgSiteName); + const coursesResult = await getCourseBySiteName(siteName); courses.set(coursesResult); $courseMetaDeta.isLoading = false; } catch (error) { console.log('error', error); } - }); + } + function initPlyr(_player: any, _video: string | undefined) { if (!player) return; @@ -162,7 +166,13 @@ {#if $landingPageSettings.header.show}