Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ const sidebarVariants = {
},
};

const ConditionalFilterContent = React.forwardRef<
HTMLDivElement,
React.HTMLProps<HTMLDivElement>
>(({ className }, ref) => {
const pathName = usePathname();
const isVideoPlayerPage = pathName.startsWith('/video/');

if (isVideoPlayerPage) return null;

return (
<FilterContent
className={className}
ref={ref as React.RefObject<HTMLDivElement>}
/>
);
});
ConditionalFilterContent.displayName = 'ConditionalFilterContent';

export function Sidebar({
courseId,
fullCourseContent,
Expand All @@ -42,6 +60,7 @@ export function Sidebar({
courseId: string;
}) {
const pathName = usePathname();
const isVideoPlayerPage = pathName.startsWith('/video/');
const [sidebarOpen, setSidebarOpen] = useRecoilState(sidebarOpenAtom);
const [currentActiveContentIds, setCurrentActiveContentIds] = useState<
number[]
Expand Down Expand Up @@ -257,10 +276,11 @@ export function Sidebar({
<h4 className="text-xl font-bold tracking-tighter text-primary lg:text-2xl">
Course Content
</h4>
<FilterContent
<ConditionalFilterContent
className="bg-gray-400 text-black"
ref={filterRef}
/>

<Button
variant="ghost"
size="icon"
Expand Down