From 8e7c8013dfc90d2c1c52c43dfceb7dd1d8197945 Mon Sep 17 00:00:00 2001 From: Akdev Saha Date: Mon, 27 Jan 2025 15:57:49 +0530 Subject: [PATCH] displayed a message when no watched content --- src/components/FolderView.tsx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/FolderView.tsx b/src/components/FolderView.tsx index 15757b86a..10ad77cea 100644 --- a/src/components/FolderView.tsx +++ b/src/components/FolderView.tsx @@ -16,6 +16,7 @@ export const FolderView = ({ }) => { const router = useRouter(); + if (!courseContent?.length) { return (
@@ -23,19 +24,25 @@ export const FolderView = ({
); } - let updatedRoute = `/courses/${courseId}`; - for (let i = 0; i < rest.length; i++) { - updatedRoute += `/${rest[i]}`; - } - // why? because we have to reset the segments or they will be visible always after a video - const currentfilter = useRecoilValue(selectFilter); - const filteredCourseContent = getFilteredContent( courseContent, currentfilter, ); - + if (!filteredCourseContent?.length) { + return ( +
+
+ No {currentfilter} content found in this section. +
+
+ ); +} +let updatedRoute = `/courses/${courseId}`; + for (let i = 0; i < rest.length; i++) { + updatedRoute += `/${rest[i]}`; + } + // why? because we have to reset the segments or they will be visible always after a video return (