From 77b4f9cfe3b38e3c0fb5d9bdaa5cd44ad0a1eaae Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Mon, 11 Mar 2024 15:07:50 +0100 Subject: [PATCH] fix: make inX helpers more robust -> do really just match /learn and /learn/x not learnXXX --- client/src/utils/route.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/utils/route.ts b/client/src/utils/route.ts index 1ae3c477..fcc8ddf6 100644 --- a/client/src/utils/route.ts +++ b/client/src/utils/route.ts @@ -8,32 +8,32 @@ export function useRouteLookups() { } function inCockpit() { - const regex = new RegExp("/course/[^/]+/cockpit"); + const regex = new RegExp("/course/[^/]+/cockpit($|/)"); return regex.test(route.path); } function inLearningPath() { - const regex = new RegExp("/course/[^/]+/learn"); + const regex = new RegExp("/course/[^/]+/learn($|/)"); return regex.test(route.path); } function inCompetenceProfile() { - const regex = new RegExp("/course/[^/]+/competence"); + const regex = new RegExp("/course/[^/]+/competence($|/)"); return regex.test(route.path); } function inLearningMentor() { - const regex = new RegExp("/course/[^/]+/mentor"); + const regex = new RegExp("/course/[^/]+/mentor($|/)"); return regex.test(route.path); } function inMediaLibrary() { - const regex = new RegExp("/course/[^/]+/media"); + const regex = new RegExp("/course/[^/]+/media($|/)"); return regex.test(route.path); } function inAppointments() { - const regex = new RegExp("/(?:[^/]+/)?appointments"); + const regex = new RegExp("/(?:[^/]+/)?appointments($|/)"); return regex.test(route.path); }