From 326e42c99f3059b215c5d4b368dce45090a040d9 Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Sat, 16 Sep 2023 22:27:19 +0200 Subject: [PATCH 1/8] wip: course preview poc --- .../components/header/CoursePreviewBar.vue | 55 +++++++++++++++++++ .../components/header/MainNavigationBar.vue | 38 ++++++++++++- cypress/e2e/preview.cy.js | 23 ++++++++ 3 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 client/src/components/header/CoursePreviewBar.vue create mode 100644 cypress/e2e/preview.cy.js diff --git a/client/src/components/header/CoursePreviewBar.vue b/client/src/components/header/CoursePreviewBar.vue new file mode 100644 index 00000000..80de3595 --- /dev/null +++ b/client/src/components/header/CoursePreviewBar.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/client/src/components/header/MainNavigationBar.vue b/client/src/components/header/MainNavigationBar.vue index e04414e5..33ff1ee9 100644 --- a/client/src/components/header/MainNavigationBar.vue +++ b/client/src/components/header/MainNavigationBar.vue @@ -14,6 +14,7 @@ import { Popover, PopoverButton, PopoverPanel } from "@headlessui/vue"; import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"; import { computed, onMounted, reactive } from "vue"; import { useTranslation } from "i18next-vue"; +import CoursePreviewBar from "@/components/header/CoursePreviewBar.vue"; log.debug("MainNavigationBar created"); @@ -41,13 +42,22 @@ const selectedCourseSessionTitle = computed(() => { return courseSessionsStore.currentCourseSession?.title; }); +const isTrainerInCourseSessionPreview = computed(() => { + // todo wip @livioso check if this is correct? + const isTrainer = + courseSessionsStore.currentCourseSession && + courseSessionsStore.currentCourseSessionHasCockpit; + return isTrainer && !inCockpit(); +}); + onMounted(() => { log.debug("MainNavigationBar mounted"); }); From 46faea8c1c8ba129b0b78e5dc81503fbd6617eb9 Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Wed, 20 Sep 2023 18:21:25 +0200 Subject: [PATCH 7/8] cleanup: navigation (duplicated code, logic) --- .../components/header/CoursePreviewBar.vue | 3 +- .../components/header/MainNavigationBar.vue | 98 +++++++++---------- client/src/components/header/MobileMenu.vue | 56 +++++------ client/src/stores/courseSessions.ts | 14 --- client/src/utils/utils.ts | 10 ++ 5 files changed, 83 insertions(+), 98 deletions(-) diff --git a/client/src/components/header/CoursePreviewBar.vue b/client/src/components/header/CoursePreviewBar.vue index 2d19ee8b..b12ef2fd 100644 --- a/client/src/components/header/CoursePreviewBar.vue +++ b/client/src/components/header/CoursePreviewBar.vue @@ -2,6 +2,7 @@ import { useTranslation } from "i18next-vue"; import { useRouteLookups } from "@/utils/route"; import { useCurrentCourseSession } from "@/composables"; +import { getCompetenceBaseUrl } from "@/utils/utils"; const { inCompetenceProfile, inLearningPath } = useRouteLookups(); const courseSession = useCurrentCourseSession(); @@ -30,7 +31,7 @@ const { t } = useTranslation(); diff --git a/client/src/components/header/MainNavigationBar.vue b/client/src/components/header/MainNavigationBar.vue index ded3e063..8e03c8b1 100644 --- a/client/src/components/header/MainNavigationBar.vue +++ b/client/src/components/header/MainNavigationBar.vue @@ -15,6 +15,7 @@ import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"; import { computed, onMounted, reactive } from "vue"; import { useTranslation } from "i18next-vue"; import CoursePreviewBar from "@/components/header/CoursePreviewBar.vue"; +import { getCompetenceBaseUrl } from "@/utils/utils"; log.debug("MainNavigationBar created"); @@ -57,8 +58,6 @@ onMounted(() => { :course-session="courseSessionsStore.currentCourseSession" :media-url="courseSessionsStore.currentCourseSession?.media_library_url" :user="userStore" - :has-expert-navigation="courseSessionsStore.hasExpertNavigation" - :has-member-navigation="courseSessionsStore.hasMemberNavigation" @closemodal="state.showMobileNavigationMenu = false" @logout="userStore.handleLogout()" /> @@ -104,60 +103,51 @@ onMounted(() => { -
diff --git a/client/src/components/header/MobileMenu.vue b/client/src/components/header/MobileMenu.vue index 0f4e3b52..ed7583cd 100644 --- a/client/src/components/header/MobileMenu.vue +++ b/client/src/components/header/MobileMenu.vue @@ -1,8 +1,10 @@