From a2f2ec829eb1903ee9f9f40768cfab709b615d8f Mon Sep 17 00:00:00 2001 From: Souvik Khan Date: Sun, 11 Aug 2024 04:32:33 +0530 Subject: [PATCH] ContentID correction --- src/components/Sidebar.tsx | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index d99260beb..dbeaada3f 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -40,9 +40,7 @@ export function Sidebar({ // if matchArray is not null if (matchArray) { const urlPathString = matchArray[1]; - currentUrlContentId = Number( - urlPathString.slice(urlPathString.length - 1), - ); // get last content id from pathString e.g '/1/2' => 2 (number) + currentUrlContentId = Number(urlPathString.split('/')[1]); // get the content id, e.g '/1/2' => 1 (number) } const pathArray = findPathToContent( fullCourseContent, @@ -123,11 +121,10 @@ export function Sidebar({
@@ -192,14 +189,12 @@ export function ToggleButton({ className={`block h-0.5 w-6 rounded-sm bg-black transition-all duration-300 ease-out dark:bg-white ${!sidebarOpen ? 'translate-y-1 rotate-45' : '-translate-y-0.5'}`} > );