File tree Expand file tree Collapse file tree 10 files changed +2365
-117
lines changed Expand file tree Collapse file tree 10 files changed +2365
-117
lines changed Original file line number Diff line number Diff line change 1
1
import { fileURLToPath } from "node:url" ;
2
2
import createJiti from "jiti" ;
3
+ import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev" ;
3
4
const jiti = createJiti ( fileURLToPath ( import . meta. url ) ) ;
4
5
5
6
jiti ( "./src/env" ) ;
@@ -29,4 +30,8 @@ const nextConfig = {
29
30
} ,
30
31
} ;
31
32
33
+ if ( process . env . NODE_ENV === "development" ) {
34
+ await setupDevPlatform ( ) ;
35
+ }
36
+
32
37
export default nextConfig ;
Original file line number Diff line number Diff line change 101
101
"zod" : " ^3.23.8"
102
102
},
103
103
"devDependencies" : {
104
+ "@cloudflare/next-on-pages" : " ^1.13.10" ,
105
+ "@cloudflare/workers-types" : " ^4.20250319.0" ,
104
106
"esbuild-register" : " ^3.5.0"
105
107
}
106
108
}
Original file line number Diff line number Diff line change @@ -3,12 +3,12 @@ import UserScheduleView from "@/components/schedule/UserScheduleView";
3
3
import ScheduleTimeline from "./schedule-timeline" ;
4
4
import Loading from "@/components/shared/Loading" ;
5
5
import { getAllEvents } from "db/functions" ;
6
- import { headers } from "next/headers" ;
7
- import { VERCEL_IP_TIMEZONE_HEADER_KEY } from "@/lib/constants" ;
8
6
import { getClientTimeZone } from "@/lib/utils/client/shared" ;
7
+ import { getRequestContext } from "@cloudflare/next-on-pages" ;
9
8
export default async function Page ( ) {
10
9
const sched = await getAllEvents ( ) ;
11
- const userTimeZoneHeaderKey = headers ( ) . get ( VERCEL_IP_TIMEZONE_HEADER_KEY ) ;
10
+ const { cf } = getRequestContext ( ) ;
11
+ const userTimeZoneHeaderKey = cf . timezone ;
12
12
const userTimeZone = getClientTimeZone ( userTimeZoneHeaderKey ) ;
13
13
return (
14
14
< >
Original file line number Diff line number Diff line change 1
1
import Link from "next/link" ;
2
2
3
- // TODO: make this look better
4
-
5
3
export default function NotFound ( ) {
6
4
return (
7
- < div >
8
- < h2 > Not Found</ h2 >
9
- < p > Could not find requested resource</ p >
10
- < Link href = "/" > Return Home</ Link >
5
+ < div className = "flex h-screen w-screen items-center justify-center bg-white dark:bg-black" >
6
+ < div className = "text-center" >
7
+ < h1 className = "mb-4 text-9xl font-extrabold text-hackathon dark:text-primary" >
8
+ 404
9
+ </ h1 >
10
+ < h2 className = "mb-4 text-4xl font-bold" > Page Not Found</ h2 >
11
+ < p className = "mb-8 text-lg" >
12
+ The page you are looking for does not exist.
13
+ </ p >
14
+ < Link href = "/" className = "text-lg text-blue-500 underline" >
15
+ Return to Home
16
+ </ Link >
17
+ </ div >
11
18
</ div >
12
19
) ;
13
20
}
Original file line number Diff line number Diff line change
1
+ import { Suspense } from "react" ;
2
+ import UserScheduleView from "@/components/schedule/UserScheduleView" ;
3
+ import ScheduleTimeline from "../dash/schedule/schedule-timeline" ;
4
+ import Loading from "@/components/shared/Loading" ;
5
+ import { getAllEvents } from "db/functions" ;
6
+ import { getClientTimeZone } from "@/lib/utils/client/shared" ;
7
+ import { getRequestContext } from "@cloudflare/next-on-pages" ;
8
+ export default async function Page ( ) {
9
+ const sched = await getAllEvents ( ) ;
10
+ const { cf } = getRequestContext ( ) ;
11
+ const userTimeZoneHeaderKey = cf . timezone ;
12
+ const userTimeZone = getClientTimeZone ( userTimeZoneHeaderKey ) ;
13
+ return (
14
+ < >
15
+ < h1 className = "mx-auto my-8 w-3/4 text-8xl font-black" > Schedule</ h1 >
16
+ < Suspense fallback = { < Loading /> } >
17
+ { /* <UserScheduleView /> */ }
18
+ < ScheduleTimeline schedule = { sched } timezone = { userTimeZone } />
19
+ </ Suspense >
20
+ </ >
21
+ ) ;
22
+ }
23
+
24
+ export const runtime = "edge" ;
25
+ export const revalidate = 60 ;
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ import { formatInTimeZone } from "date-fns-tz";
5
5
import { Event } from "db/types" ;
6
6
import { headers } from "next/headers" ;
7
7
import { getClientTimeZone } from "@/lib/utils/client/shared" ;
8
- import { VERCEL_IP_TIMEZONE_HEADER_KEY } from "@/lib/constants " ;
8
+ import { getRequestContext } from "@cloudflare/next-on-pages " ;
9
9
export default function EventFull ( { event } : { event : Event } ) {
10
- const userTimeZoneHeaderKey = headers ( ) . get ( VERCEL_IP_TIMEZONE_HEADER_KEY ) ;
10
+ const { cf } = getRequestContext ( ) ;
11
+ const userTimeZoneHeaderKey = cf . timezone ;
11
12
12
13
const userTimeZone = getClientTimeZone ( userTimeZoneHeaderKey ) ;
13
14
return (
Original file line number Diff line number Diff line change @@ -5,15 +5,16 @@ import c from "config";
5
5
import { headers } from "next/headers" ;
6
6
import { getClientTimeZone } from "@/lib/utils/client/shared" ;
7
7
import EventItem from "./EventItem" ;
8
- import { VERCEL_IP_TIMEZONE_HEADER_KEY } from "@/lib/constants " ;
8
+ import { getRequestContext } from "@cloudflare/next-on-pages " ;
9
9
interface DayProps {
10
10
title : string ;
11
11
subtitle : string ;
12
12
events : EventType [ ] ;
13
13
}
14
14
15
15
export default function Day ( { title, subtitle, events } : DayProps ) {
16
- const userTimeZoneHeaderKey = headers ( ) . get ( VERCEL_IP_TIMEZONE_HEADER_KEY ) ;
16
+ const { cf } = getRequestContext ( ) ;
17
+ const userTimeZoneHeaderKey = cf . timezone ;
17
18
18
19
const userTimeZone = getClientTimeZone ( userTimeZoneHeaderKey ) ;
19
20
Original file line number Diff line number Diff line change 1
1
import c from "config" ;
2
2
export const ONE_HOUR_IN_MILLISECONDS = 3600000 ;
3
3
export const FIVE_MINUTES_IN_MILLISECONDS = 300000 ;
4
- export const VERCEL_IP_TIMEZONE_HEADER_KEY = "x-vercel-ip-timezone" ;
5
4
export const PHONE_NUMBER_REGEX =
6
5
/ ^ ( \+ \d { 1 , 2 } \s ? ) ? \( ? \d { 3 } \) ? \s ? [ \s . - ] ? \s ? \d { 3 } \s ? [ \s . - ] ? \s ? \d { 4 } $ / gm;
7
6
export const UNIQUE_KEY_CONSTRAINT_VIOLATION_CODE = "23505" ;
Original file line number Diff line number Diff line change 1
1
import { rankItem } from "@tanstack/match-sorter-utils" ;
2
2
import { FilterFn } from "@tanstack/react-table" ;
3
3
import { redirect } from "next/navigation" ;
4
- export function getClientTimeZone ( vercelIPTimeZone : string | null ) {
4
+ export function getClientTimeZone ( vercelIPTimeZone ? : string ) {
5
5
return vercelIPTimeZone ?? Intl . DateTimeFormat ( ) . resolvedOptions ( ) . timeZone ;
6
6
}
7
7
You can’t perform that action at this time.
0 commit comments