1
+ import { Metadata } from 'next'
2
+ import { notFound } from 'next/navigation'
3
+ import { createServerComponentClient } from '@supabase/auth-helpers-nextjs'
4
+ import { cookies } from 'next/headers'
5
+ import { Card , CardContent , CardDescription , CardHeader , CardTitle , CardFooter } from "@/components/ui/card"
6
+ import { Separator } from "@/components/ui/separator"
7
+ import { QRCodeDisplay } from '@/components/events/qr-code-display'
8
+ import { Button } from '@/components/ui/button'
9
+ import Link from 'next/link'
10
+ import { ArrowLeft , Printer , Share2 , Download , Info } from 'lucide-react'
11
+
12
+ export const metadata : Metadata = {
13
+ title : 'Event QR Code | Cloud Burst' ,
14
+ description : 'QR code for your event' ,
15
+ }
16
+
17
+ interface PageProps {
18
+ params : {
19
+ id : string
20
+ }
21
+ }
22
+
23
+ export default async function EventQRCodePage ( { params } : PageProps ) {
24
+ const { id } = params
25
+
26
+ const cookieStore = cookies ( )
27
+ const supabase = createServerComponentClient ( { cookies : ( ) => cookieStore } )
28
+
29
+ // Get current session
30
+ const { data : { session } } = await supabase . auth . getSession ( )
31
+ if ( ! session ) notFound ( )
32
+
33
+ // Get event details
34
+ const { data : event } = await supabase
35
+ . from ( 'events' )
36
+ . select ( '*' )
37
+ . eq ( 'id' , id )
38
+ . single ( )
39
+
40
+ if ( ! event ) notFound ( )
41
+
42
+ return (
43
+ < div className = "container max-w-6xl mx-auto py-6 px-4 sm:px-6" >
44
+ < div className = "flex items-center justify-between mb-8" >
45
+ < div >
46
+ < h1 className = "text-3xl font-bold tracking-tight" > Event QR Code</ h1 >
47
+ < p className = "text-muted-foreground mt-1" >
48
+ QR code for { event . name }
49
+ </ p >
50
+ </ div >
51
+ < Button variant = "outline" asChild >
52
+ < Link href = { `/protected/events/${ id } ` } >
53
+ < ArrowLeft className = "mr-2 h-4 w-4" />
54
+ Back to Event
55
+ </ Link >
56
+ </ Button >
57
+ </ div >
58
+
59
+ < div className = "grid grid-cols-1 lg:grid-cols-12 gap-6" >
60
+ { /* QR Code Card */ }
61
+ < Card className = "lg:col-span-5 border" >
62
+ < CardHeader className = "pb-2" >
63
+ < CardTitle > Event QR Code</ CardTitle >
64
+ < CardDescription >
65
+ Scan to access the event gallery
66
+ </ CardDescription >
67
+ </ CardHeader >
68
+ < CardContent >
69
+ < div className = "border rounded-lg p-6 mb-4 bg-black text-white" >
70
+ < div className = "text-lg font-medium mb-2" > { event . name } QR Code</ div >
71
+ < div className = "text-sm text-gray-300 mb-4" > Scan this code to access the event gallery</ div >
72
+ < div className = "flex justify-center" >
73
+ < QRCodeDisplay
74
+ eventId = { id }
75
+ eventName = { event . name }
76
+ size = { 280 }
77
+ />
78
+ </ div >
79
+ </ div >
80
+ < div className = "flex gap-4" >
81
+ < Button variant = "outline" className = "flex-1" >
82
+ < Download className = "h-4 w-4 mr-2" />
83
+ Download
84
+ </ Button >
85
+ < Button variant = "secondary" className = "flex-1" >
86
+ < Share2 className = "h-4 w-4 mr-2" />
87
+ Share
88
+ </ Button >
89
+ </ div >
90
+ </ CardContent >
91
+ </ Card >
92
+
93
+ { /* Usage Instructions */ }
94
+ < div className = "lg:col-span-7" >
95
+ < Card className = "border h-full" >
96
+ < CardHeader className = "pb-2" >
97
+ < CardTitle > How to Use This QR Code</ CardTitle >
98
+ < CardDescription >
99
+ Tips for maximizing engagement with your event QR code
100
+ </ CardDescription >
101
+ </ CardHeader >
102
+ < CardContent className = "p-6" >
103
+ < div className = "grid grid-cols-2 gap-6 mb-6" >
104
+ < div className = "border rounded-lg p-6 bg-blue-50/10 hover:bg-blue-50/20 transition-colors" >
105
+ < div className = "flex flex-col items-center text-center h-full" >
106
+ < div className = "flex items-center justify-center w-16 h-16 rounded-full bg-gray-900 mb-4" >
107
+ < Printer className = "h-7 w-7 text-blue-400" />
108
+ </ div >
109
+ < h3 className = "font-medium text-base mb-3" > Display at Event</ h3 >
110
+ < p className = "text-sm text-muted-foreground" >
111
+ Print and place at entrances, photo booths, and tables.
112
+ </ p >
113
+ </ div >
114
+ </ div >
115
+
116
+ < div className = "border rounded-lg p-6 bg-blue-50/10 hover:bg-blue-50/20 transition-colors" >
117
+ < div className = "flex flex-col items-center text-center h-full" >
118
+ < div className = "flex items-center justify-center w-16 h-16 rounded-full bg-gray-900 mb-4" >
119
+ < Share2 className = "h-7 w-7 text-blue-400" />
120
+ </ div >
121
+ < h3 className = "font-medium text-base mb-3" > Include in Materials</ h3 >
122
+ < p className = "text-sm text-muted-foreground" >
123
+ Add to programs, invitations, and digital communications.
124
+ </ p >
125
+ </ div >
126
+ </ div >
127
+
128
+ < div className = "border rounded-lg p-6 bg-blue-50/10 hover:bg-blue-50/20 transition-colors" >
129
+ < div className = "flex flex-col items-center text-center h-full" >
130
+ < div className = "flex items-center justify-center w-16 h-16 rounded-full bg-gray-900 mb-4" >
131
+ < Download className = "h-7 w-7 text-blue-400" />
132
+ </ div >
133
+ < h3 className = "font-medium text-base mb-3" > Easy Access</ h3 >
134
+ < p className = "text-sm text-muted-foreground" >
135
+ Attendees can scan to instantly access the event gallery.
136
+ </ p >
137
+ </ div >
138
+ </ div >
139
+
140
+ < div className = "border rounded-lg p-6 bg-blue-50/10 hover:bg-blue-50/20 transition-colors" >
141
+ < div className = "flex flex-col items-center text-center h-full" >
142
+ < div className = "flex items-center justify-center w-16 h-16 rounded-full bg-gray-900 mb-4" >
143
+ < Info className = "h-7 w-7 text-blue-400" />
144
+ </ div >
145
+ < h3 className = "font-medium text-base mb-3" > No Account Required</ h3 >
146
+ < p className = "text-sm text-muted-foreground" >
147
+ Anyone can view and upload photos without registration.
148
+ </ p >
149
+ </ div >
150
+ </ div >
151
+ </ div >
152
+
153
+ < div className = "border border-blue-800 bg-blue-950/50 rounded-lg p-4" >
154
+ < div className = "flex items-start" >
155
+ < div className = "flex items-center justify-center w-10 h-10 rounded-full bg-blue-900 mr-4 flex-shrink-0" >
156
+ < Info className = "h-5 w-5 text-blue-400" />
157
+ </ div >
158
+ < div >
159
+ < h3 className = "font-medium text-blue-300 mb-2" > Pro Tip</ h3 >
160
+ < p className = "text-sm text-blue-400" >
161
+ For maximum engagement, announce the QR code during your event and explain how attendees can use it to view and share photos. Consider offering a small incentive for those who upload photos.
162
+ </ p >
163
+ </ div >
164
+ </ div >
165
+ </ div >
166
+ </ CardContent >
167
+ </ Card >
168
+ </ div >
169
+ </ div >
170
+ </ div >
171
+ )
172
+ }
0 commit comments