Refactor navigation with competence profile

This commit is contained in:
Daniel Egger 2022-10-07 16:41:16 +02:00
parent 6f491ef661
commit d42b32ef30
2 changed files with 9 additions and 9 deletions

View File

@ -28,12 +28,12 @@ function isInRoutePath(checkPaths: string[]) {
return checkPaths.some((path) => route.path.startsWith(path)); return checkPaths.some((path) => route.path.startsWith(path));
} }
function inLearningPath() { function inCourse() {
return isInRoutePath(["/learn/"]); return isInRoutePath(["/learn", "/competence"]);
} }
function getLearningPathStringProp(prop: "title" | "slug"): string { function getLearningPathStringProp(prop: "title" | "slug"): string {
return inLearningPath() && learningPathStore.learningPath return inCourse() && learningPathStore.learningPath
? learningPathStore.learningPath[prop] ? learningPathStore.learningPath[prop]
: ""; : "";
} }
@ -144,19 +144,19 @@ const profileDropdownData = [
class="flex-auto mt-8 lg:flex lg:space-y-0 lg:flex-row lg:items-center lg:space-x-10 lg:mt-0" class="flex-auto mt-8 lg:flex lg:space-y-0 lg:flex-row lg:items-center lg:space-x-10 lg:mt-0"
> >
<router-link <router-link
v-if="inLearningPath()" v-if="inCourse()"
to="/learn/versicherungsvermittlerin-lp" to="/learn/versicherungsvermittlerin-lp"
class="nav-item" class="nav-item"
:class="{ 'nav-item--active': inLearningPath() }" :class="{ 'nav-item--active': isInRoutePath(['/learn']) }"
> >
Lernpfad Lernpfad
</router-link> </router-link>
<router-link <router-link
v-if="inLearningPath()" v-if="inCourse()"
to="/competences/" to="/competence/versicherungsvermittlerin-competence"
class="nav-item" class="nav-item"
:class="{ 'nav-item--active': isInRoutePath(['/competences/']) }" :class="{ 'nav-item--active': isInRoutePath(['/competence']) }"
> >
Kompetenzprofil Kompetenzprofil
</router-link> </router-link>

View File

@ -58,7 +58,7 @@ const router = createRouter({
component: () => import("@/pages/ComptencesView.vue"), component: () => import("@/pages/ComptencesView.vue"),
children: [ children: [
{ {
path: "overview", path: "",
component: () => import("@/pages/CompetencesMainView.vue"), component: () => import("@/pages/CompetencesMainView.vue"),
}, },
{ {