forked from acmutsa/HackKit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/production' into dev
- Loading branch information
Showing
4 changed files
with
1,112 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,68 @@ | ||
import { Suspense } from "react"; | ||
import Loading from "@/components/shared/Loading"; | ||
import UserScheduleView from "@/components/schedule/UserScheduleView"; | ||
import Navbar from "@/components/shared/Navbar"; | ||
import ScheduleTimeline from "../dash/schedule/schedule-timeline"; | ||
import Loading from "@/components/shared/Loading"; | ||
import { getAllEvents } from "db/functions"; | ||
import { headers } from "next/headers"; | ||
import { VERCEL_IP_TIMEZONE_HEADER_KEY } from "@/lib/constants"; | ||
import { getClientTimeZone } from "@/lib/utils/client/shared"; | ||
import { Badge } from "@/components/shadcn/ui/badge"; | ||
import c from "config"; | ||
import { Skeleton } from "@/components/shadcn/ui/skeleton"; | ||
export default function EventsPage() { | ||
import Navbar from "@/components/shared/Navbar"; | ||
export default async function Page() { | ||
const sched = await getAllEvents(); | ||
|
||
const currentEvent = sched.filter((e) => { | ||
const currentTime = new Date(); | ||
return e.startTime < currentTime && e.endTime > currentTime; | ||
})[0]; | ||
const userTimeZoneHeaderKey = headers().get(VERCEL_IP_TIMEZONE_HEADER_KEY); | ||
const userTimeZone = getClientTimeZone(userTimeZoneHeaderKey); | ||
return ( | ||
<> | ||
<Suspense fallback={<Skeleton className="h-16 w-screen" />}> | ||
<Navbar /> | ||
</Suspense> | ||
<div className="mx-auto my-8 flex h-fit w-10/12 flex-wrap items-center justify-between gap-y-4 md:my-16 md:w-3/4"> | ||
<h1 className="mx-auto w-fit text-center text-5xl font-black md:ml-0 md:text-8xl"> | ||
Schedule | ||
</h1> | ||
<div className="h-full w-full rounded-md border border-muted p-4 md:w-fit"> | ||
<h3 className="text-sm font-black">Current</h3> | ||
<div> | ||
<p> | ||
{currentEvent?.title || "No current events"}{" "} | ||
{currentEvent && ( | ||
<Badge | ||
variant={"outline"} | ||
className="h-fit" | ||
style={{ | ||
borderColor: ( | ||
c.eventTypes as Record< | ||
string, | ||
string | ||
> | ||
)[currentEvent?.type], | ||
}} | ||
> | ||
<p className="text-sm"> | ||
{currentEvent?.type} | ||
</p> | ||
</Badge> | ||
)} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<Suspense fallback={<Loading />}> | ||
<UserScheduleView /> | ||
{/* <UserScheduleView /> */} | ||
<ScheduleTimeline schedule={sched} timezone={userTimeZone} /> | ||
</Suspense> | ||
</> | ||
); | ||
} | ||
|
||
export const runtime = "edge"; | ||
export const revalidate = 60; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE "events" ADD COLUMN IF NOT EXISTS "location" varchar(255) DEFAULT 'TBD';--> statement-breakpoint | ||
ALTER TABLE "events" ADD COLUMN IF NOT EXISTS "points" integer DEFAULT 0 NOT NULL; |
Oops, something went wrong.