Skip to content

Commit

Permalink
Added changes from #106
Browse files Browse the repository at this point in the history
  • Loading branch information
hkirat committed Feb 25, 2024
1 parent 4c0cc49 commit 0313b08
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 67 deletions.
4 changes: 2 additions & 2 deletions src/app/courses/[...courseId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default async function Course({
}

return (
<div className="justify-between mx-auto text-white">
<>
<CourseView
rest={rest}
course={course}
Expand All @@ -88,6 +88,6 @@ export default async function Course({
searchParams={searchParams}
possiblePath={possiblePath}
/>
</div>
</>
);
}
7 changes: 4 additions & 3 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@
transform: translateX(-50%);
}


/* Hide scrollbar for Chrome, Safari and Opera */
.hide-scrollbar::-webkit-scrollbar {
.no-scrollbar::-webkit-scrollbar {
display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.hide-scrollbar {
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
}
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function RootLayout({
<GoogleAnalytics />
<Providers>
<Appbar />
<div className="min-h-screen">{children}</div>
<div className="h-[calc(100vh-64px)]">{children}</div>
<Footer />
<Toaster />
</Providers>
Expand Down
92 changes: 44 additions & 48 deletions src/components/CourseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,54 +27,50 @@ export const CourseView = ({
possiblePath: string;
}) => {
return (
<div>
<div className="flex">
<Sidebar fullCourseContent={fullCourseContent} courseId={course.id} />
<div className="grow">
<div className="p-2">
{contentType === 'notion' ? (
<NotionRenderer id={courseContent[0]?.id} />
) : null}
{contentType === 'video' ? (
<ContentRenderer
nextContent={nextContent}
content={{
thumbnail: courseContent[0]?.thumbnail || '',
id: courseContent[0]?.id || 0,
title: courseContent[0]?.title || '',
type: contentType || 'video',
description: courseContent[0]?.description || '',
markAsCompleted:
courseContent[0]?.videoProgress?.markAsCompleted || false,
}}
/>
) : null}
{(contentType === 'video' || contentType === 'notion') && (
<Comments
content={{
id: courseContent[0]?.id || 0,
commentCount: courseContent[0]?.commentsCount || 0,
possiblePath,
}}
searchParams={searchParams}
/>
)}
{contentType === 'folder' ? (
<FolderView
rest={rest}
courseContent={courseContent?.map((x: any) => ({
title: x?.title || '',
image: x?.thumbnail || '',
type: x?.type || 'folder',
id: x?.id || 0,
markAsCompleted: x?.videoProgress?.markAsCompleted || false,
percentComplete: getFolderPercentCompleted(x?.children),
}))}
courseId={parseInt(course.id, 10)}
/>
) : null}
</div>
</div>
<div className="flex h-full">
<Sidebar fullCourseContent={fullCourseContent} courseId={course.id} />
<div className="grow p-2 overflow-y-auto no-scrollbar">
{contentType === 'notion' ? (
<NotionRenderer id={courseContent[0]?.id} />
) : null}
{contentType === 'video' ? (
<ContentRenderer
nextContent={nextContent}
content={{
thumbnail: courseContent[0]?.thumbnail || '',
id: courseContent[0]?.id || 0,
title: courseContent[0]?.title || '',
type: contentType || 'video',
description: courseContent[0]?.description || '',
markAsCompleted:
courseContent[0]?.videoProgress?.markAsCompleted || false,
}}
/>
) : null}
{(contentType === 'video' || contentType === 'notion') && (
<Comments
content={{
id: courseContent[0]?.id || 0,
commentCount: courseContent[0]?.commentsCount || 0,
possiblePath,
}}
searchParams={searchParams}
/>
)}
{contentType === 'folder' ? (
<FolderView
rest={rest}
courseContent={courseContent?.map((x: any) => ({
title: x?.title || '',
image: x?.thumbnail || '',
type: x?.type || 'folder',
id: x?.id || 0,
markAsCompleted: x?.videoProgress?.markAsCompleted || false,
percentComplete: getFolderPercentCompleted(x?.children),
}))}
courseId={parseInt(course.id, 10)}
/>
) : null}
</div>
</div>
);
Expand Down
21 changes: 8 additions & 13 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,19 @@ export function Sidebar({
}

return (
<div
className="w-84 self-start sticky overflow-y-auto h-screen hide-scrollbar"
style={{ width: '300px' }}
>
<div className="overflow-scroll min-h-screen overflow-y-auto bg-gray-50 dark:bg-gray-800 cursor-pointer w-full sticky top-[64px] self-start w-84">
<div className="flex">
{/* <ToggleButton
<div className="overflow-scroll h-full w-[300px] min-w-[133px] overflow-y-auto bg-gray-50 dark:bg-gray-800 cursor-pointer sticky top-[64px] self-start w-84">
<div className="flex">
{/* <ToggleButton
onClick={() => {
setSidebarOpen((s) => !s);
}}
/> */}
<GoBackButton />
</div>
<Accordion type="single" collapsible className="w-full">
{/* Render course content */}
{renderContent(fullCourseContent)}
</Accordion>
<GoBackButton />
</div>
<Accordion type="single" collapsible className="w-full">
{/* Render course content */}
{renderContent(fullCourseContent)}
</Accordion>
</div>
);
}
Expand Down

0 comments on commit 0313b08

Please sign in to comment.