Skip to content

Commit

Permalink
fix: embed courses into the page
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Jun 1, 2024
1 parent 290c706 commit fb44072
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
5 changes: 2 additions & 3 deletions src/app/[lang]/(mods-pages)/courses/CourseSearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ const CourseSearchContainer = () => {
indexName="nthu_courses"
routing
>
<div className="flex flex-col h-[100dvh] px-2 pt-6 md:p-8 gap-8">

<div className="flex flex-col h-full max-h-[100dvh] gap-4 md:gap-8">
<div className="">
<div className="bg-neutral-100 dark:bg-neutral-950 rounded-2xl flex items-center p-4">
<div className="bg-neutral-100 dark:bg-neutral-950 rounded-2xl flex items-center py-2 md:p-4">
<SemesterSelector />
<Separator orientation="vertical" className='h-full'/>
<HoverCard>
Expand Down
26 changes: 3 additions & 23 deletions src/app/[lang]/(mods-pages)/courses/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,10 @@ import CourseSearchContainer from './CourseSearchContainer';
import { useRouter } from "next/navigation";

const CourseDialog = () => {
const [open, setOpen] = useState(true);
const router = useRouter();

//first load open dialog
useEffect(() => {
setOpen(true);
}, [])

//if closed, navigate to timetable page
useEffect(() => {
if (!open) {
router.push('/timetable')
}
}, [open])

return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger>
Open
</DialogTrigger>
<DialogContent className="p-0 h-[100dvh] max-w-screen w-screen gap-0">
<CourseSearchContainer />
</DialogContent>
</Dialog>
return (<div className="max-h-[calc(var(--content-height)-36px)]">
<CourseSearchContainer />
</div>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Timetable/TimetableSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TimetableSidebar = ({
{dict.course.item.add_to_semester}
</Button>
</DialogTrigger>
<DialogContent className="p-0 h-[100dvh] max-w-screen w-screen gap-0">
<DialogContent className="p-0 h-[100dvh] max-w-screen w-screen gap-0 px-2 pt-6 md:p-8">
<CourseSearchContainerDynamic />
</DialogContent>
</Dialog>
Expand Down

0 comments on commit fb44072

Please sign in to comment.