From bc8108f6bf41a6243f9bae4c1f5af0277dcf7f24 Mon Sep 17 00:00:00 2001 From: Kevin Hidalgo Date: Thu, 19 Mar 2026 13:07:10 -0500 Subject: [PATCH 1/2] Fixex unintended description behaviour, schedule page renders new table --- apps/web/src/app/schedule/page.tsx | 10 +- .../src/components/schedule/ScheduleTable.tsx | 146 ++++++++++++++++++ apps/web/src/components/shadcn/ui/table.tsx | 2 +- .../components/shared/NavBarLinksGrouper.tsx | 4 + 4 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 apps/web/src/components/schedule/ScheduleTable.tsx diff --git a/apps/web/src/app/schedule/page.tsx b/apps/web/src/app/schedule/page.tsx index d583d854..fe3e97ad 100644 --- a/apps/web/src/app/schedule/page.tsx +++ b/apps/web/src/app/schedule/page.tsx @@ -1,15 +1,13 @@ -import ScheduleTimeline from "../dash/schedule/schedule-timeline"; +//import ScheduleTimeline from "../dash/schedule/schedule-timeline"; +import ScheduleTable from "@/components/schedule/ScheduleTable"; import { getAllEvents } from "db/functions"; -import { getClientTimeZone } from "@/lib/utils/client/shared"; -import c from "config"; export default async function Page() { const sched = await getAllEvents(); - const userTimeZone = getClientTimeZone(c.hackathonTimezone); return ( <> -

Schedule

- +

Schedule

+ ); } diff --git a/apps/web/src/components/schedule/ScheduleTable.tsx b/apps/web/src/components/schedule/ScheduleTable.tsx new file mode 100644 index 00000000..ce146954 --- /dev/null +++ b/apps/web/src/components/schedule/ScheduleTable.tsx @@ -0,0 +1,146 @@ +import { + Table, + TableBody, + TableCell, + TableHeader, + TableRow, +} from "@/components/shadcn/ui/table"; + +import { type EventType as Event } from "@/lib/types/events"; +import { ReactNode } from "react"; +import { formatInTimeZone } from "date-fns-tz"; +import c from "config"; +import { Badge } from "@/components/shadcn/ui/badge"; +import Link from "next/link"; + +const userTimeZone = c.hackathonTimezone; + +function splitByDay(schedule: Event[]) { + const days: Map = new Map(); + schedule.forEach((event) => { + const day = daysOfWeek[event.startTime.getDay()]; + + if (days.get(day)) { + days.get(day)?.push(event); + } else { + days.set(day, [event]); + } + }); + return days; +} + +type ScheduleTableProps = { + schedule: Event[]; + +}; + +const daysOfWeek = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", +]; +function eventDateString(arr: Event[], timezone: string) { + const date = formatInTimeZone(arr[0].startTime, timezone, "PPPP"); + const retString = date.substring(0, date.length - 6); + return retString; +} + +export default function ScheduleTable({ + schedule, +}: ScheduleTableProps) { + return ( +
+ + {Array.from(splitByDay(schedule).entries()).map( + ([dateID, arr]): ReactNode => ( + <> + + + +

{`${eventDateString(arr, userTimeZone)}`}

+
+
+ {arr.map( + (event): ReactNode => ( + + ), + )} +
+ + ), + )} +
+
+ ); +} + +// Needs timezone prop +type eventRowProps = { + event: Event; +}; +export function EventRow({ event }: eventRowProps) { + const startTimeFormatted = formatInTimeZone( + event.startTime, + userTimeZone, + "hh:mm a", + { + useAdditionalDayOfYearTokens: true, + }, + ); + + const endTimeFormatted = formatInTimeZone( + event.endTime, + userTimeZone, + "h:mm a", + ); + const color = (c.eventTypes as Record)[event.type]; + const href = "/schedule/" + event.id; + return ( + + +
+ + +

{`${startTimeFormatted}`}

+

+ {`- ${endTimeFormatted}`} +

+
+ +
+
+ +

{event.type}

+
+ + +

+ {`${event.title}`} +

+ +
+
+ +
+

{`${event.description}`}

+
+
+
+ ); +} \ No newline at end of file diff --git a/apps/web/src/components/shadcn/ui/table.tsx b/apps/web/src/components/shadcn/ui/table.tsx index 97869067..b1ad240a 100644 --- a/apps/web/src/components/shadcn/ui/table.tsx +++ b/apps/web/src/components/shadcn/ui/table.tsx @@ -88,7 +88,7 @@ const TableCell = React.forwardRef< {toRender}; + */} + return Schedule } export const revalidate = 30; From ba55972944cbd1114cbf39478f3561c43942f4be Mon Sep 17 00:00:00 2001 From: Kevin Hidalgo Date: Thu, 19 Mar 2026 14:28:04 -0500 Subject: [PATCH 2/2] Schedule timeline replacement --- apps/web/src/app/schedule/page.tsx | 1 - apps/web/src/components/shared/NavBarLinksGrouper.tsx | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/web/src/app/schedule/page.tsx b/apps/web/src/app/schedule/page.tsx index fe3e97ad..543ca99f 100644 --- a/apps/web/src/app/schedule/page.tsx +++ b/apps/web/src/app/schedule/page.tsx @@ -1,4 +1,3 @@ -//import ScheduleTimeline from "../dash/schedule/schedule-timeline"; import ScheduleTable from "@/components/schedule/ScheduleTable"; import { getAllEvents } from "db/functions"; diff --git a/apps/web/src/components/shared/NavBarLinksGrouper.tsx b/apps/web/src/components/shared/NavBarLinksGrouper.tsx index 5041673d..b0f8adc4 100644 --- a/apps/web/src/components/shared/NavBarLinksGrouper.tsx +++ b/apps/web/src/components/shared/NavBarLinksGrouper.tsx @@ -12,12 +12,8 @@ export default async function NavBarLinksGrouper() { , ); } - } - {/** - + } return <>{toRender}; - */} - return Schedule } export const revalidate = 30;