Add navigation button to go back to the Dashboard
This commit is contained in:
parent
2c1129eae6
commit
c6e21ca059
|
|
@ -1,12 +1,22 @@
|
|||
<script setup lang="ts">
|
||||
import { useRouteLookups } from "@/utils/route";
|
||||
import { useTranslation } from "i18next-vue";
|
||||
const { isInCourse } = useRouteLookups();
|
||||
|
||||
const { t } = useTranslation();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="hidden flex-shrink-0 items-center lg:flex">
|
||||
<div class="flex items-center">
|
||||
<div class="flex flex-shrink-0 items-center">
|
||||
<template v-if="isInCourse">
|
||||
<div class="flex items-center">
|
||||
<router-link to="/" class="flex items-center border-r border-white pr-3">
|
||||
<it-icon-arrow-left />
|
||||
<span class="hidden text-slate-500 lg:inline">Dashboard</span>
|
||||
</router-link>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<router-link to="/" class="flex">
|
||||
<it-icon-vbv class="-ml-3 -mt-6 mr-3 h-8 w-16" />
|
||||
</router-link>
|
||||
|
|
@ -15,6 +25,6 @@ const { t } = useTranslation();
|
|||
{{ t("general.title") }}
|
||||
</div>
|
||||
</router-link>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { computed, ref } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
export function useRouteLookups() {
|
||||
|
|
@ -7,11 +8,15 @@ export function useRouteLookups() {
|
|||
return route.path.startsWith("/course/");
|
||||
}
|
||||
|
||||
const isInCourse = computed(() => inCourse());
|
||||
|
||||
function inCockpit() {
|
||||
const regex = new RegExp("/course/[^/]+/cockpit($|/)");
|
||||
return regex.test(route.path);
|
||||
}
|
||||
|
||||
const isInCockpit = computed(() => inCockpit());
|
||||
|
||||
function inLearningPath() {
|
||||
const regex = new RegExp("/course/[^/]+/learn($|/)");
|
||||
return regex.test(route.path);
|
||||
|
|
@ -39,7 +44,9 @@ export function useRouteLookups() {
|
|||
|
||||
return {
|
||||
inMediaLibrary,
|
||||
isInCourse,
|
||||
inCockpit,
|
||||
isInCockpit,
|
||||
inLearningPath,
|
||||
inCompetenceProfile,
|
||||
inLearningMentor,
|
||||
|
|
|
|||
Loading…
Reference in New Issue