Merged in feature/VBV-717-teilnehmer-profil-in-dashboard-fullscreen (pull request #393)

VBV-717: Teilnehmer Profil im Fullscreen anzeigen

Approved-by: Dario Aebersold
This commit is contained in:
Elia Bieri 2024-10-01 07:22:28 +00:00
commit b509d51979
3 changed files with 49 additions and 0 deletions

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="flex min-h-full flex-col"> <div class="flex min-h-full flex-col">
<MainNavigationBar v-if="!route.meta.hideChrome" class="flex-none" /> <MainNavigationBar v-if="!route.meta.hideChrome" class="flex-none" />
<CloseButton v-if="route.meta.showCloseButton" class="flex-none" />
<RouterView v-slot="{ Component }" class="flex-auto"> <RouterView v-slot="{ Component }" class="flex-auto">
<Transition mode="out-in" name="app"> <Transition mode="out-in" name="app">
<component :is="Component" :key="componentKey"></component> <component :is="Component" :key="componentKey"></component>
@ -20,6 +21,7 @@ import eventBus from "@/utils/eventBus";
import { provideClient } from "@urql/vue"; import { provideClient } from "@urql/vue";
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import CloseButton from "./components/header/CloseButton.vue";
const route = useRoute(); const route = useRoute();

View File

@ -0,0 +1,39 @@
<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();
function navigateToVisibleChrome() {
const removeRoutes: string[] = [];
// Function to pop routes until `meta.hideChrome` is `false`
const findVisibleChromeRoute = () => {
const currentRoute = router.currentRoute.value;
if (currentRoute?.meta?.hideChrome) {
removeRoutes.push(currentRoute.fullPath || currentRoute.path);
router.back();
} else {
// Cleaning up stored routes when reached the target
if (removeRoutes.length) removeRoutes.length = 0;
}
};
// Watch the route change
router.afterEach((_to, from) => {
if (removeRoutes.includes(from.fullPath || from.path)) {
findVisibleChromeRoute();
}
});
// Start popping routes
findVisibleChromeRoute();
}
</script>
<template>
<div class="flex justify-end">
<button type="button" class="p-3" @click="navigateToVisibleChrome()">
<it-icon-close class="size-7 text-black"></it-icon-close>
</button>
</div>
</template>

View File

@ -178,12 +178,20 @@ const router = createRouter({
component: () => import("@/pages/userProfile/LearningPathProfilePage.vue"), component: () => import("@/pages/userProfile/LearningPathProfilePage.vue"),
props: true, props: true,
name: "profileLearningPath", name: "profileLearningPath",
meta: {
hideChrome: true,
showCloseButton: true,
},
}, },
{ {
path: "competence", path: "competence",
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"), component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
props: true, props: true,
name: "profileCompetence", name: "profileCompetence",
meta: {
hideChrome: true,
showCloseButton: true,
},
children: [ children: [
{ {
path: "", path: "",