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:
commit
b509d51979
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div class="flex min-h-full flex-col">
|
||||
<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">
|
||||
<Transition mode="out-in" name="app">
|
||||
<component :is="Component" :key="componentKey"></component>
|
||||
|
|
@ -20,6 +21,7 @@ import eventBus from "@/utils/eventBus";
|
|||
import { provideClient } from "@urql/vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import CloseButton from "./components/header/CloseButton.vue";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -178,12 +178,20 @@ const router = createRouter({
|
|||
component: () => import("@/pages/userProfile/LearningPathProfilePage.vue"),
|
||||
props: true,
|
||||
name: "profileLearningPath",
|
||||
meta: {
|
||||
hideChrome: true,
|
||||
showCloseButton: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "competence",
|
||||
component: () => import("@/pages/userProfile/CompetenceProfilePage.vue"),
|
||||
props: true,
|
||||
name: "profileCompetence",
|
||||
meta: {
|
||||
hideChrome: true,
|
||||
showCloseButton: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
|
|
|
|||
Loading…
Reference in New Issue