Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/production' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelp committed Oct 26, 2024
2 parents a9f0221 + bf53933 commit 473eb98
Show file tree
Hide file tree
Showing 4 changed files with 1,112 additions and 4 deletions.
59 changes: 55 additions & 4 deletions apps/web/src/app/schedule/page.tsx
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;
2 changes: 2 additions & 0 deletions packages/db/drizzle/0019_lyrical_thundra.sql
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;
Loading

0 comments on commit 473eb98

Please sign in to comment.