From 055d1045f5f18dbe79d3a621ef02816fdaa1b2d5 Mon Sep 17 00:00:00 2001 From: Fahad Date: Tue, 21 Jan 2025 14:41:50 +0530 Subject: [PATCH 1/3] Remove unused filter from video page --- src/app/courses/[courseId]/layout.tsx | 4 ++-- src/components/FilterContent.tsx | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/courses/[courseId]/layout.tsx b/src/app/courses/[courseId]/layout.tsx index 827af309b..df4733f31 100644 --- a/src/app/courses/[courseId]/layout.tsx +++ b/src/app/courses/[courseId]/layout.tsx @@ -1,5 +1,5 @@ import { QueryParams } from '@/actions/types'; -import { FilterContent } from '@/components/FilterContent'; +import FilterWrapper from '@/components/FilterContent'; import { Sidebar } from '@/components/Sidebar'; import { getFullCourseContent } from '@/db/course'; import { authOptions } from '@/lib/auth'; @@ -54,7 +54,7 @@ const Layout = async ({
- +
diff --git a/src/components/FilterContent.tsx b/src/components/FilterContent.tsx index 8f3917ef4..267fac3b6 100644 --- a/src/components/FilterContent.tsx +++ b/src/components/FilterContent.tsx @@ -16,6 +16,7 @@ import { PopoverContent, PopoverTrigger, } from '@/components/ui/popover'; +import { usePathname } from 'next/navigation'; const allFilters = [ { value: 'all', label: 'ALL' }, @@ -29,7 +30,14 @@ type FilterContentProps = { className?: string; }; -export const FilterContent = forwardRef( +const FilterWrapper = () => { + const pathname = usePathname(); + const hideFilter = pathname.split('/').length > 4; + + return hideFilter ? null : ; +}; + +const FilterContent = forwardRef( (props, ref) => { const [open, setOpen] = useState(false); const [value, setValue] = useRecoilState(selectFilter); @@ -80,3 +88,5 @@ export const FilterContent = forwardRef( ); }, ); + +export default FilterWrapper; From b22fbe9676a6e9ae943605615d04f6e1560a89bf Mon Sep 17 00:00:00 2001 From: Fahad Date: Tue, 21 Jan 2025 15:14:05 +0530 Subject: [PATCH 2/3] Remove unused filter from video page --- src/app/courses/[courseId]/layout.tsx | 4 ++-- src/components/CourseView.tsx | 2 +- src/components/FilterContainer.tsx | 18 ++++++++++++++++++ src/components/FilterContent.tsx | 12 +----------- 4 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 src/components/FilterContainer.tsx diff --git a/src/app/courses/[courseId]/layout.tsx b/src/app/courses/[courseId]/layout.tsx index df4733f31..d4142a173 100644 --- a/src/app/courses/[courseId]/layout.tsx +++ b/src/app/courses/[courseId]/layout.tsx @@ -1,5 +1,5 @@ import { QueryParams } from '@/actions/types'; -import FilterWrapper from '@/components/FilterContent'; +import FilterContainer from '@/components/FilterContainer'; import { Sidebar } from '@/components/Sidebar'; import { getFullCourseContent } from '@/db/course'; import { authOptions } from '@/lib/auth'; @@ -54,7 +54,7 @@ const Layout = async ({
- +
diff --git a/src/components/CourseView.tsx b/src/components/CourseView.tsx index 0646bc81f..6588d3e8c 100644 --- a/src/components/CourseView.tsx +++ b/src/components/CourseView.tsx @@ -39,7 +39,7 @@ export const CourseView = ({ : courseContent?.value.type; return ( -
+
{ + const pathname = usePathname(); + + const hideFilter = pathname.split('/').length > 4; + + if (hideFilter) { + return null; + } + + return ; +}; + +export default FilterContainer; diff --git a/src/components/FilterContent.tsx b/src/components/FilterContent.tsx index 267fac3b6..8f3917ef4 100644 --- a/src/components/FilterContent.tsx +++ b/src/components/FilterContent.tsx @@ -16,7 +16,6 @@ import { PopoverContent, PopoverTrigger, } from '@/components/ui/popover'; -import { usePathname } from 'next/navigation'; const allFilters = [ { value: 'all', label: 'ALL' }, @@ -30,14 +29,7 @@ type FilterContentProps = { className?: string; }; -const FilterWrapper = () => { - const pathname = usePathname(); - const hideFilter = pathname.split('/').length > 4; - - return hideFilter ? null : ; -}; - -const FilterContent = forwardRef( +export const FilterContent = forwardRef( (props, ref) => { const [open, setOpen] = useState(false); const [value, setValue] = useRecoilState(selectFilter); @@ -88,5 +80,3 @@ const FilterContent = forwardRef( ); }, ); - -export default FilterWrapper; From c2ea4b7b6bead30ab828c63ad18637b189eac9f8 Mon Sep 17 00:00:00 2001 From: Fahad Date: Tue, 21 Jan 2025 15:15:09 +0530 Subject: [PATCH 3/3] Remove unused filter from video page --- src/components/CourseView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/CourseView.tsx b/src/components/CourseView.tsx index 6588d3e8c..0646bc81f 100644 --- a/src/components/CourseView.tsx +++ b/src/components/CourseView.tsx @@ -39,7 +39,7 @@ export const CourseView = ({ : courseContent?.value.type; return ( -
+