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));
}
function inLearningPath() {
return isInRoutePath(["/learn/"]);
function inCourse() {
return isInRoutePath(["/learn", "/competence"]);
}
function getLearningPathStringProp(prop: "title" | "slug"): string {
return inLearningPath() && learningPathStore.learningPath
return inCourse() && learningPathStore.learningPath
? 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"
>
<router-link
v-if="inLearningPath()"
v-if="inCourse()"
to="/learn/versicherungsvermittlerin-lp"
class="nav-item"
:class="{ 'nav-item--active': inLearningPath() }"
:class="{ 'nav-item--active': isInRoutePath(['/learn']) }"
>
Lernpfad
</router-link>
<router-link
v-if="inLearningPath()"
to="/competences/"
v-if="inCourse()"
to="/competence/versicherungsvermittlerin-competence"
class="nav-item"
:class="{ 'nav-item--active': isInRoutePath(['/competences/']) }"
:class="{ 'nav-item--active': isInRoutePath(['/competence']) }"
>
Kompetenzprofil
</router-link>

View File

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