import { computed, ref } from "vue"; import { useRoute } from "vue-router"; export function useRouteLookups() { const route = useRoute(); function inCourse() { 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); } function inCompetenceProfile() { const regex = new RegExp("/course/[^/]+/competence($|/)"); return regex.test(route.path); } function inLearningMentor() { const regex = new RegExp("/course/[^/]+/learning-mentor($|/)"); return regex.test(route.path); } function inMediaLibrary() { const regex = new RegExp("/course/[^/]+/media($|/)"); return regex.test(route.path); } function inAppointments() { const regex = new RegExp("/(?:[^/]+/)?appointments($|/)"); return regex.test(route.path); } return { inMediaLibrary, isInCourse, inCockpit, isInCockpit, inLearningPath, inCompetenceProfile, inLearningMentor, inCourse, inAppointments: inAppointments, }; }