Add component for course session navigation
This commit is contained in:
parent
a01d058227
commit
45a102c73a
|
|
@ -0,0 +1,86 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
|
import { useNavigationAttributes } from "@/utils/navigation";
|
||||||
|
import { useRouteLookups } from "@/utils/route";
|
||||||
|
import {
|
||||||
|
getCockpitUrl,
|
||||||
|
getCompetenceNaviUrl,
|
||||||
|
getLearningMentorUrl,
|
||||||
|
getLearningPathUrl,
|
||||||
|
} from "@/utils/utils";
|
||||||
|
import { useTranslation } from "i18next-vue";
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const courseSessionsStore = useCourseSessionsStore();
|
||||||
|
|
||||||
|
const { inCockpit, inCompetenceProfile, inLearningMentor, inLearningPath } =
|
||||||
|
useRouteLookups();
|
||||||
|
const {
|
||||||
|
hasCompetenceNaviMenu,
|
||||||
|
hasLearningPathMenu,
|
||||||
|
hasCockpitMenu,
|
||||||
|
hasPreviewMenu,
|
||||||
|
hasLearningMentor,
|
||||||
|
} = useNavigationAttributes();
|
||||||
|
const mentorTabTitle = computed(() =>
|
||||||
|
courseSessionsStore.currentCourseSession?.course.configuration.is_uk
|
||||||
|
? "a.Praxisbildner"
|
||||||
|
: "a.Lernbegleitung"
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div v-if="courseSessionsStore.currentCourseSession" class="hidden space-x-8 lg:flex">
|
||||||
|
<router-link
|
||||||
|
v-if="hasCockpitMenu"
|
||||||
|
data-cy="navigation-cockpit-link"
|
||||||
|
:to="getCockpitUrl(courseSessionsStore.currentCourseSession.course.slug)"
|
||||||
|
class="nav-item"
|
||||||
|
:class="{ 'nav-item--active': inCockpit() }"
|
||||||
|
>
|
||||||
|
{{ t("cockpit.title") }}
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link
|
||||||
|
v-if="hasPreviewMenu"
|
||||||
|
data-cy="navigation-preview-link"
|
||||||
|
:to="getLearningPathUrl(courseSessionsStore.currentCourseSession.course.slug)"
|
||||||
|
target="_blank"
|
||||||
|
class="nav-item"
|
||||||
|
>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span>{{ t("a.Vorschau Teilnehmer") }}</span>
|
||||||
|
<it-icon-external-link class="ml-2" />
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
<router-link
|
||||||
|
v-if="hasLearningPathMenu"
|
||||||
|
data-cy="navigation-learning-path-link"
|
||||||
|
:to="getLearningPathUrl(courseSessionsStore.currentCourseSession.course.slug)"
|
||||||
|
class="nav-item"
|
||||||
|
:class="{ 'nav-item--active': inLearningPath() }"
|
||||||
|
>
|
||||||
|
{{ t("general.learningPath") }}
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link
|
||||||
|
v-if="hasCompetenceNaviMenu"
|
||||||
|
data-cy="navigation-competence-profile-link"
|
||||||
|
:to="getCompetenceNaviUrl(courseSessionsStore.currentCourseSession.course.slug)"
|
||||||
|
class="nav-item"
|
||||||
|
:class="{ 'nav-item--active': inCompetenceProfile() }"
|
||||||
|
>
|
||||||
|
{{ t("competences.title") }}
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<router-link
|
||||||
|
v-if="hasLearningMentor"
|
||||||
|
data-cy="navigation-learning-mentor-link"
|
||||||
|
:to="getLearningMentorUrl(courseSessionsStore.currentCourseSession.course.slug)"
|
||||||
|
class="nav-item"
|
||||||
|
:class="{ 'nav-item--active': inLearningMentor() }"
|
||||||
|
>
|
||||||
|
{{ t(mentorTabTitle) }}
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
@ -2,16 +2,10 @@
|
||||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
import { useNavigationAttributes } from "@/utils/navigation";
|
import { useNavigationAttributes } from "@/utils/navigation";
|
||||||
import { useRouteLookups } from "@/utils/route";
|
import { useRouteLookups } from "@/utils/route";
|
||||||
import {
|
import { getMediaCenterUrl } from "@/utils/utils";
|
||||||
getCockpitUrl,
|
|
||||||
getCompetenceNaviUrl,
|
|
||||||
getLearningMentorUrl,
|
|
||||||
getLearningPathUrl,
|
|
||||||
getMediaCenterUrl,
|
|
||||||
} from "@/utils/utils";
|
|
||||||
import { useTranslation } from "i18next-vue";
|
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
import { computed, onMounted } from "vue";
|
import { computed, onMounted } from "vue";
|
||||||
|
import CourseSessionNavigation from "./CourseSessionNavigation.vue";
|
||||||
import DefaultNavigation from "./DefaultNavigation.vue";
|
import DefaultNavigation from "./DefaultNavigation.vue";
|
||||||
import MobileMenuButton from "./MobileMenuButton.vue";
|
import MobileMenuButton from "./MobileMenuButton.vue";
|
||||||
import NotificationButton from "./NotificationButton.vue";
|
import NotificationButton from "./NotificationButton.vue";
|
||||||
|
|
@ -20,26 +14,9 @@ import ProfileMenuButton from "./ProfileMenuButton.vue";
|
||||||
log.debug("MainNavigationBar created");
|
log.debug("MainNavigationBar created");
|
||||||
|
|
||||||
const courseSessionsStore = useCourseSessionsStore();
|
const courseSessionsStore = useCourseSessionsStore();
|
||||||
const {
|
const { inMediaLibrary, inAppointments } = useRouteLookups();
|
||||||
inCockpit,
|
const { hasMediaLibraryMenu, hasAppointmentsMenu, hasSessionTitle } =
|
||||||
inCompetenceProfile,
|
useNavigationAttributes();
|
||||||
inLearningMentor,
|
|
||||||
inLearningPath,
|
|
||||||
inMediaLibrary,
|
|
||||||
inAppointments,
|
|
||||||
} = useRouteLookups();
|
|
||||||
const {
|
|
||||||
hasCompetenceNaviMenu,
|
|
||||||
hasLearningPathMenu,
|
|
||||||
hasMediaLibraryMenu,
|
|
||||||
hasCockpitMenu,
|
|
||||||
hasPreviewMenu,
|
|
||||||
hasAppointmentsMenu,
|
|
||||||
hasLearningMentor,
|
|
||||||
hasSessionTitle,
|
|
||||||
} = useNavigationAttributes();
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const selectedCourseSessionTitle = computed(() => {
|
const selectedCourseSessionTitle = computed(() => {
|
||||||
return courseSessionsStore.currentCourseSession?.title;
|
return courseSessionsStore.currentCourseSession?.title;
|
||||||
|
|
@ -57,12 +34,6 @@ const appointmentsUrl = computed(() => {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
log.debug("MainNavigationBar mounted");
|
log.debug("MainNavigationBar mounted");
|
||||||
});
|
});
|
||||||
|
|
||||||
const mentorTabTitle = computed(() =>
|
|
||||||
courseSessionsStore.currentCourseSession?.course.configuration.is_uk
|
|
||||||
? "a.Praxisbildner"
|
|
||||||
: "a.Lernbegleitung"
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -75,79 +46,7 @@ const mentorTabTitle = computed(() =>
|
||||||
|
|
||||||
<!-- Satisfy the type checker; these menu items are
|
<!-- Satisfy the type checker; these menu items are
|
||||||
only relevant if there is a current course session -->
|
only relevant if there is a current course session -->
|
||||||
<template v-if="courseSessionsStore.currentCourseSession">
|
<CourseSessionNavigation />
|
||||||
<div class="hidden space-x-8 lg:flex">
|
|
||||||
<router-link
|
|
||||||
v-if="hasCockpitMenu"
|
|
||||||
data-cy="navigation-cockpit-link"
|
|
||||||
:to="
|
|
||||||
getCockpitUrl(courseSessionsStore.currentCourseSession.course.slug)
|
|
||||||
"
|
|
||||||
class="nav-item"
|
|
||||||
:class="{ 'nav-item--active': inCockpit() }"
|
|
||||||
>
|
|
||||||
{{ t("cockpit.title") }}
|
|
||||||
</router-link>
|
|
||||||
|
|
||||||
<router-link
|
|
||||||
v-if="hasPreviewMenu"
|
|
||||||
data-cy="navigation-preview-link"
|
|
||||||
:to="
|
|
||||||
getLearningPathUrl(
|
|
||||||
courseSessionsStore.currentCourseSession.course.slug
|
|
||||||
)
|
|
||||||
"
|
|
||||||
target="_blank"
|
|
||||||
class="nav-item"
|
|
||||||
>
|
|
||||||
<div class="flex items-center">
|
|
||||||
<span>{{ t("a.Vorschau Teilnehmer") }}</span>
|
|
||||||
<it-icon-external-link class="ml-2" />
|
|
||||||
</div>
|
|
||||||
</router-link>
|
|
||||||
<router-link
|
|
||||||
v-if="hasLearningPathMenu"
|
|
||||||
data-cy="navigation-learning-path-link"
|
|
||||||
:to="
|
|
||||||
getLearningPathUrl(
|
|
||||||
courseSessionsStore.currentCourseSession.course.slug
|
|
||||||
)
|
|
||||||
"
|
|
||||||
class="nav-item"
|
|
||||||
:class="{ 'nav-item--active': inLearningPath() }"
|
|
||||||
>
|
|
||||||
{{ t("general.learningPath") }}
|
|
||||||
</router-link>
|
|
||||||
|
|
||||||
<router-link
|
|
||||||
v-if="hasCompetenceNaviMenu"
|
|
||||||
data-cy="navigation-competence-profile-link"
|
|
||||||
:to="
|
|
||||||
getCompetenceNaviUrl(
|
|
||||||
courseSessionsStore.currentCourseSession.course.slug
|
|
||||||
)
|
|
||||||
"
|
|
||||||
class="nav-item"
|
|
||||||
:class="{ 'nav-item--active': inCompetenceProfile() }"
|
|
||||||
>
|
|
||||||
{{ t("competences.title") }}
|
|
||||||
</router-link>
|
|
||||||
|
|
||||||
<router-link
|
|
||||||
v-if="hasLearningMentor"
|
|
||||||
data-cy="navigation-learning-mentor-link"
|
|
||||||
:to="
|
|
||||||
getLearningMentorUrl(
|
|
||||||
courseSessionsStore.currentCourseSession.course.slug
|
|
||||||
)
|
|
||||||
"
|
|
||||||
class="nav-item"
|
|
||||||
:class="{ 'nav-item--active': inLearningMentor() }"
|
|
||||||
>
|
|
||||||
{{ t(mentorTabTitle) }}
|
|
||||||
</router-link>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-stretch justify-start space-x-8">
|
<div class="flex items-stretch justify-start space-x-8">
|
||||||
|
|
@ -193,16 +92,4 @@ const mentorTabTitle = computed(() =>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="postcss" scoped>
|
<style lang="postcss"></style>
|
||||||
.nav-item {
|
|
||||||
@apply inline-flex items-center border-b-4 border-transparent px-1 pt-1 text-white hover:text-sky-500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item-no-mobile {
|
|
||||||
@apply hidden items-center border-b-4 border-transparent px-1 pt-1 text-white hover:text-sky-500 lg:inline-flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item--active {
|
|
||||||
@apply border-sky-500;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,18 @@ textarea {
|
||||||
.tag-active {
|
.tag-active {
|
||||||
@apply rounded-full bg-blue-900 px-4 py-2 font-semibold text-white;
|
@apply rounded-full bg-blue-900 px-4 py-2 font-semibold text-white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-item {
|
||||||
|
@apply inline-flex items-center border-b-4 border-transparent px-1 pt-1 text-white hover:text-sky-500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item-no-mobile {
|
||||||
|
@apply hidden items-center border-b-4 border-transparent px-1 pt-1 text-white hover:text-sky-500 lg:inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item--active {
|
||||||
|
@apply border-sky-500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer utilities {
|
@layer utilities {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue