diff --git a/client/src/components/dueDates/DueDateSingle.vue b/client/src/components/dueDates/DueDateSingle.vue index 84fb2306..c7a14785 100644 --- a/client/src/components/dueDates/DueDateSingle.vue +++ b/client/src/components/dueDates/DueDateSingle.vue @@ -24,8 +24,9 @@ if (!courseSession) { throw new Error("Course session not found"); } -const isExpert = courseSessionsStore.hasCockpit(courseSession); -const url = isExpert ? props.dueDate.url_expert : props.dueDate.url; +const url = courseSession.actions.includes("expert-cockpit") + ? props.dueDate.url_expert + : props.dueDate.url; const courseSessionTitle = computed(() => { if (props.dueDate.course_session_id) { diff --git a/client/src/components/header/CoursePreviewBar.vue b/client/src/components/header/CoursePreviewBar.vue index 979fce70..c2bf4259 100644 --- a/client/src/components/header/CoursePreviewBar.vue +++ b/client/src/components/header/CoursePreviewBar.vue @@ -3,11 +3,9 @@ import { useTranslation } from "i18next-vue"; import { useRouteLookups } from "@/utils/route"; import { useCurrentCourseSession } from "@/composables"; import { getCompetenceNaviUrl, getLearningPathUrl } from "@/utils/utils"; -import { useCockpitStore } from "@/stores/cockpit"; const { inCompetenceProfile, inLearningPath } = useRouteLookups(); const courseSession = useCurrentCourseSession(); -const cockpit = useCockpitStore(); const { t } = useTranslation(); @@ -34,7 +32,6 @@ const { t } = useTranslation(); { log.debug("MainNavigationBar mounted"); }); -const hasMediaLibraryMenu = computed(() => { - if (useCockpitStore().hasMentorCockpitType) { - return false; - } - return inCourse() && Boolean(courseSessionsStore.currentCourseSession); -}); +const hasLearningPathMenu = computed(() => + Boolean( + courseSessionsStore.currentCourseSession?.actions.includes("learning-path") && + inCourse() + ) +); -const hasCockpitMenu = computed(() => { - return courseSessionsStore.currentCourseSessionHasCockpit; -}); +const hasCompetenceNaviMenu = computed(() => + Boolean( + courseSessionsStore.currentCourseSession?.actions.includes("competence-navi") && + inCourse() + ) +); -const hasPreviewMenu = computed(() => { - return ( - useCockpitStore().hasExpertCockpitType || useCockpitStore().hasMentorCockpitType - ); -}); +const hasMediaLibraryMenu = computed(() => + Boolean( + courseSessionsStore.currentCourseSession?.actions.includes("media-library") && + inCourse() + ) +); -const hasAppointmentsMenu = computed(() => { - if (useCockpitStore().hasMentorCockpitType) { - return false; - } - return userStore.loggedIn; -}); +const hasCockpitMenu = computed(() => + Boolean(courseSessionsStore.currentCourseSession?.actions.includes("expert-cockpit")) +); + +const hasPreviewMenu = computed(() => + Boolean(courseSessionsStore.currentCourseSession?.actions.includes("preview")) +); + +const hasAppointmentsMenu = computed(() => + Boolean( + courseSessionsStore.currentCourseSession?.actions.includes("appointments") && + userStore.loggedIn + ) +); const hasNotificationsMenu = computed(() => { return userStore.loggedIn; }); -const hasMentorManagementMenu = computed(() => { - if (courseSessionsStore.currentCourseSessionHasCockpit || !inCourse()) { +const hasLearningMentor = computed(() => { + if (!inCourse()) { return false; } - return ( - courseSessionsStore.currentCourseSession?.course.configuration - .enable_learning_mentor ?? false - ); + + if (!courseSessionsStore.currentCourseSession) { + return false; + } + + const courseSession = courseSessionsStore.currentCourseSession; + const course = courseSession.course; + + if (!course.configuration.enable_learning_mentor) { + return false; + } + + // FIXME: Use learning-mentor action instead of deprecated-mentor once we have moved everything from cockpit! + return courseSession.actions.includes("deprecated-mentor"); });