From fa2c5c117a0407bf97be8468730b716ead19e1c9 Mon Sep 17 00:00:00 2001 From: alok8bb Date: Thu, 27 Jun 2024 16:06:00 +0530 Subject: [PATCH 1/2] fix: handle subpaths in menu entries navigation Signed-off-by: alok8bb --- src/components/Container.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Container.tsx b/src/components/Container.tsx index c1f1611..97ac2e7 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -120,7 +120,9 @@ const Container: React.FC<{ } catch {} }; - const current = MenuEntries.findIndex(([, path]) => location === path); + const current = MenuEntries.findIndex( + ([, path]) => location === path || location.startsWith("${path}" + "/"), + ); const next = get.next(MenuEntries, current)[1]; const prev = get.prev(MenuEntries, current)[1]; const end = current === MenuEntries.length - 1; From c8ee9eaceb2996d7dddb35cc4dbe962910321d08 Mon Sep 17 00:00:00 2001 From: Alok Date: Thu, 27 Jun 2024 16:10:33 +0530 Subject: [PATCH 2/2] fix: minor mistake in string concatenation --- src/components/Container.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Container.tsx b/src/components/Container.tsx index 97ac2e7..4e0e17a 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -121,7 +121,7 @@ const Container: React.FC<{ }; const current = MenuEntries.findIndex( - ([, path]) => location === path || location.startsWith("${path}" + "/"), + ([, path]) => location === path || location.startsWith(path + "/"), ); const next = get.next(MenuEntries, current)[1]; const prev = get.prev(MenuEntries, current)[1];