@@ -8,15 +8,15 @@ import {
8
8
Mail ,
9
9
EyeIcon ,
10
10
EyeOffIcon ,
11
+ Sparkles ,
11
12
} from "lucide-react" ;
12
13
import { useState } from "react" ;
13
14
import QRCode from "react-qr-code" ;
14
15
15
- import { Badge } from "~/components/ui/badge" ;
16
16
import { Button , buttonVariants } from "~/components/ui/button" ;
17
17
import { Card , CardContent , CardTitle } from "~/components/ui/card" ;
18
18
import { Separator } from "~/components/ui/separator" ;
19
- import { formatDate , formatTime } from "~/utils/date" ;
19
+ import { formatCalendarDate , formatDate , formatTime } from "~/utils/date" ;
20
20
import {
21
21
redemptionStatusLabel ,
22
22
redemptionStatusColor ,
@@ -45,93 +45,114 @@ const Ticket = ({
45
45
: undefined ;
46
46
47
47
return (
48
- < Card className = "h-full bg-white p-6 text-black" >
49
- < div className = "relative mx-auto mt-4 w-full max-w-[90%] text-center" >
50
- < div className = { cn ( showQR ? "" : "blur-lg" ) } >
51
- < QRCode className = "mx-auto max-w-[90%]" value = { ticket . id } />
48
+ < Card className = "flex h-full flex-col justify-between gap-6 bg-white p-6 text-black" >
49
+ < div className = "flex w-full flex-col gap-6" >
50
+ < div className = "relative mx-auto mt-4 w-full max-w-[90%] text-center" >
51
+ < div
52
+ className = { cn (
53
+ "mx-auto max-w-[90%] overflow-hidden" ,
54
+ showQR ? "" : " max-w-[80%] overflow-hidden" ,
55
+ ) }
56
+ >
57
+ < QRCode
58
+ className = { cn ( "aspect-square w-full" , showQR ? "" : "blur-md" ) }
59
+ value = { ticket . id }
60
+ />
61
+ </ div >
52
62
</ div >
63
+ < CardTitle className = "text-center font-bold" >
64
+ ID Ref: { ticketIdReference ( ticket . id ) }
65
+ </ CardTitle >
66
+ < CardContent className = "p-0 text-sm" >
67
+ < div className = "grid gap-3" >
68
+ < ul className = "grid gap-3" >
69
+ < li className = "flex items-center justify-between text-base" >
70
+ < span className = "shrink-0 font-bold" > Evento</ span >
71
+ < span className = "text-right" > { event . name } </ span >
72
+ </ li >
73
+ </ ul >
74
+ < Separator className = "my-2 bg-[#e7e5e4]" />
75
+ < ul className = "grid gap-3" >
76
+ < li className = "flex items-center justify-between" >
77
+ < span className = "shrink-0 font-bold" > Fecha de inicio</ span >
78
+ < span className = "text-right" >
79
+ { formatDate ( event . startDateTime as string ) }
80
+ </ span >
81
+ </ li >
82
+ { event . endDateTime ? (
83
+ < li className = "flex items-center justify-between" >
84
+ < span className = "shrink-0 font-bold" > Fecha de fin</ span >
85
+ < span className = "text-right" >
86
+ { formatDate ( event . endDateTime as string ) }
87
+ </ span >
88
+ </ li >
89
+ ) : null }
90
+ </ ul >
91
+ < Separator className = "my-2 bg-[#e7e5e4]" />
92
+ < ul className = "grid gap-3" >
93
+ < li className = "flex items-center justify-between" >
94
+ < span className = "shrink-0 font-bold" > Tipo de Ticket</ span >
95
+ < span className = "text-right" > { ticket . ticketTemplate . name } </ span >
96
+ </ li >
97
+ < li className = "flex items-center justify-between" >
98
+ < span className = "shrink-0 font-bold" > Estado</ span >
99
+ < span className = "text-right" >
100
+ < span className = "flex flex-row items-center gap-2" >
101
+ < span
102
+ className = { cn (
103
+ "flex h-2 w-2 rounded-full" ,
104
+ redemptionStatusColor ( ticket . redemptionStatus ) ,
105
+ ) }
106
+ />
107
+ { redemptionStatusLabel ( ticket . redemptionStatus ) }
108
+ </ span >
109
+ </ span >
110
+ </ li >
111
+ < li className = "flex items-center justify-between" >
112
+ < span className = "shrink-0 font-bold" > Fecha de Compra</ span >
113
+ < span className = "text-right" >
114
+ { formatCalendarDate ( ticket . createdAt as string ) }
115
+ </ span >
116
+ </ li >
117
+ </ ul >
118
+ </ div >
119
+ </ CardContent >
120
+ </ div >
121
+ < div className = "flex flex-col gap-2 p-0 md:flex-row" >
53
122
< Button
54
- className = "mt-8"
123
+ className = { cn (
124
+ buttonVariants ( { variant : "outline" } ) ,
125
+ "flex grow flex-row gap-2 bg-white text-black" ,
126
+ ) }
55
127
onClick = { ( ) => {
56
128
setShowQR ( ( show ) => ! show ) ;
57
129
} }
58
130
>
59
131
{ showQR ? (
60
132
< >
61
- < EyeIcon className = "size-4" /> Ocultar QR
133
+ < EyeOffIcon className = "size-4" /> Ocultar QR
62
134
</ >
63
135
) : (
64
136
< >
65
- < EyeOffIcon className = "size-4" /> Ver QR
137
+ < EyeIcon className = "size-4" /> Ver QR
66
138
</ >
67
139
) }
68
140
</ Button >
69
- </ div >
70
- < CardTitle className = "my-6 text-center" >
71
- ID Ref: { ticketIdReference ( ticket . id ) }
72
- </ CardTitle >
73
- < CardContent className = "text-sm" >
74
- < div className = "grid gap-3" >
75
- < ul className = "grid gap-3" >
76
- < li className = "flex items-center justify-between" >
77
- < span className = "font-semibold" > Evento</ span >
78
- < span > { event . name } </ span >
79
- </ li >
80
- </ ul >
81
- < Separator className = "my-2" />
82
- < ul className = "grid gap-3" >
83
- < li className = "flex items-center justify-between" >
84
- < span className = "font-semibold" > Fecha de inicio</ span >
85
- < span > { formatDate ( event . startDateTime as string ) } </ span >
86
- </ li >
87
- { event . endDateTime ? (
88
- < li className = "flex items-center justify-between" >
89
- < span className = "font-semibold" > Fecha de fin</ span >
90
- < span > { formatDate ( event . endDateTime as string ) } </ span >
91
- </ li >
92
- ) : null }
93
- </ ul >
94
- < Separator className = "my-2" />
95
- < ul className = "grid gap-3" >
96
- < li className = "flex items-center justify-between" >
97
- < span className = "font-semibold" > Tipo de Ticket</ span >
98
- < span > { ticket . ticketTemplate . name } </ span >
99
- </ li >
100
- < li className = "flex items-center justify-between" >
101
- < span className = "font-semibold" > Estado</ span >
102
- < span >
103
- < Badge className = "gap-2 text-black" variant = "outline" >
104
- < span
105
- className = { cn (
106
- "flex h-2 w-2 rounded-full" ,
107
- redemptionStatusColor ( ticket . redemptionStatus ) ,
108
- ) }
109
- />
110
- { redemptionStatusLabel ( ticket . redemptionStatus ) }
111
- </ Badge >
112
- </ span >
113
- </ li >
114
- < li className = "flex items-center justify-between" >
115
- < span className = "font-semibold" > Fecha de Compra</ span >
116
- < span > { formatDate ( ticket . createdAt as string ) } </ span >
117
- </ li >
118
- </ ul >
119
- </ div >
120
- < div className = "mt-4 flex flex-col gap-2 md:flex-row" >
121
- { publicUrl ? (
122
- < a
123
- href = { publicUrl }
124
- target = "_blank"
125
- rel = "noreferrer noopener"
126
- className = { cn (
127
- buttonVariants ( { variant : "outline" } ) ,
128
- "flex grow flex-row gap-2 bg-white text-black" ,
129
- ) }
130
- >
131
- Ver y Compartir < ExternalLink className = "size-4" />
132
- </ a >
133
- ) : null }
134
- { /*
141
+ { publicUrl ? (
142
+ < a
143
+ href = { publicUrl }
144
+ target = "_blank"
145
+ rel = "noreferrer noopener"
146
+ className = { cn (
147
+ buttonVariants ( { variant : "outline" } ) ,
148
+ "flex grow flex-row gap-2 bg-white text-black" ,
149
+ ) }
150
+ >
151
+ < Sparkles className = "size-4" />
152
+ Compartir
153
+ </ a >
154
+ ) : null }
155
+ { /*
135
156
<Button
136
157
className="flex grow flex-row gap-2 bg-white text-black"
137
158
variant="outline"
@@ -147,8 +168,7 @@ const Ticket = ({
147
168
<Mail className="size-4" /> Enviar por email
148
169
</Button>
149
170
*/ }
150
- </ div >
151
- </ CardContent >
171
+ </ div >
152
172
</ Card >
153
173
) ;
154
174
} ;
@@ -184,8 +204,8 @@ export const MyEvent = ({ id }: { id: string }) => {
184
204
) : null }
185
205
186
206
{ event ? (
187
- < div className = "flex w-full flex-col gap-4 " >
188
- < div className = "flex basis-4/12 flex-col gap-2 " >
207
+ < div className = "flex w-full flex-col gap-6 " >
208
+ < div className = "flex basis-4/12 flex-col gap-6 " >
189
209
< div
190
210
className = { cn (
191
211
"mx-auto h-20 w-full rounded-md bg-primary/10 lg:h-40" ,
@@ -197,29 +217,32 @@ export const MyEvent = ({ id }: { id: string }) => {
197
217
: { }
198
218
}
199
219
/>
200
- < h2 className = "font-cal text-2xl" > { event . name } </ h2 >
201
- < p className = "text-sm text-muted-foreground" > { event . description } </ p >
202
- < div className = "flex flex-row items-center gap-1 text-sm" >
203
- < Calendar className = "size-4" />
204
- { [ formattedDate , formattedTime ] . filter ( Boolean ) . join ( " - " ) }
220
+ < h2 className = "text-2xl font-semibold" > { event . name } </ h2 >
221
+ < p className = "text-base text-muted-foreground" >
222
+ { event . description }
223
+ </ p >
224
+ < div className = "flex flex-col gap-3 font-medium" >
225
+ { formatedAddress ? (
226
+ < a
227
+ href = { encodeURI (
228
+ `https://www.google.com/maps/search/${ formatedAddress } ?source=opensearch` ,
229
+ ) }
230
+ target = "_blank"
231
+ className = "flex flex-row items-center gap-2.5 text-sm"
232
+ rel = "noreferrer"
233
+ >
234
+ < MapPin className = "size-6" />
235
+ { formatedAddress }
236
+ < ExternalLink className = "size-6" />
237
+ < span className = "sr-only" > Ver en Google Maps</ span >
238
+ </ a >
239
+ ) : null }
240
+ < div className = "flex flex-row items-center gap-2.5 text-sm" >
241
+ < Calendar className = "size-6" />
242
+ { [ formattedDate , formattedTime ] . filter ( Boolean ) . join ( " - " ) }
243
+ </ div >
205
244
</ div >
206
- { formatedAddress ? (
207
- < a
208
- href = { encodeURI (
209
- `https://www.google.com/maps/search/${ formatedAddress } ?source=opensearch` ,
210
- ) }
211
- target = "_blank"
212
- className = "flex flex-row items-center gap-1 text-sm"
213
- rel = "noreferrer"
214
- >
215
- < MapPin className = "size-4" />
216
- { formatedAddress }
217
- < ExternalLink className = "size-4" />
218
- < span className = "sr-only" > Ver en Google Maps</ span >
219
- </ a >
220
- ) : null }
221
245
</ div >
222
- < Separator className = "my-2" />
223
246
< div className = "mx-auto grid w-full grid-cols-1 gap-4 md:grid-cols-3" >
224
247
{ tickets . map ( ( ticket ) => (
225
248
< Ticket key = { ticket . id } event = { event } ticket = { ticket } />
0 commit comments