@@ -13,8 +13,11 @@ import {
1313 Anchor ,
1414 Divider ,
1515 Box ,
16+ Modal ,
1617} from '@mantine/core' ;
17- import { IconCalendarEvent , IconTicket , IconSettings , IconCalendar , IconClock , IconMapPin } from '@tabler/icons-react' ;
18+ import { useDisclosure } from '@mantine/hooks' ;
19+ import { IconCalendarEvent , IconTicket , IconSettings , IconCalendar , IconClock , IconMapPin , IconQrcode } from '@tabler/icons-react' ;
20+ import QRCode from 'react-qr-code' ;
1821import { useAuth } from '../components/AuthContext' ;
1922import { useProfile } from '../components/ProfileContext' ;
2023import { useRsvps } from '../components/RsvpsContext' ;
@@ -29,6 +32,9 @@ export function HomePage() {
2932 const { profile, loading : profileLoading } = useProfile ( ) ;
3033 const { rsvps, loading : rsvpsLoading } = useRsvps ( ) ;
3134 const navigate = useNavigate ( ) ;
35+ const [ qrOpened , { open : openQr , close : closeQr } ] = useDisclosure ( false ) ;
36+
37+ const netId = user ?. email ? user . email . split ( '@' ) [ 0 ] : '' ;
3238
3339 useEffect ( ( ) => {
3440 if ( isLoggedIn && ! profileLoading && ! profile ) {
@@ -53,8 +59,8 @@ export function HomePage() {
5359 const totalActive = ongoingRsvps . length + upcomingRsvps . length ;
5460
5561 const actions = [
56- { title : 'Upcoming Events' , icon : IconCalendarEvent , color : 'blue' , desc : 'Browse and RSVP to corporate events' , path : '/events' } ,
57- { title : 'My RSVPs' , icon : IconTicket , color : 'green' , desc : 'View your tickets and status ' , path : '/my-rsvps' } ,
62+ { title : 'Upcoming Events' , icon : IconCalendarEvent , color : 'blue' , desc : 'Browse and RSVP to our upcoming events! ' , path : '/events' } ,
63+ { title : 'My RSVPs' , icon : IconTicket , color : 'green' , desc : 'View your upcoming RSVPs ' , path : '/my-rsvps' } ,
5864 { title : 'Profile' , icon : IconSettings , color : 'gray' , desc : 'Update your profile and dietary info' , path : '/profile' } ,
5965 ] ;
6066
@@ -69,9 +75,32 @@ export function HomePage() {
6975 < Stack gap = "xl" >
7076 < div >
7177 < Title order = { 2 } > Welcome back, { user ?. name ?. split ( ' ' ) [ 1 ] || 'Friend' } !</ Title >
72- < Text c = "dimmed" > Select an action to get started.</ Text >
7378 </ div >
7479
80+ { isLoggedIn && netId && (
81+ < Card shadow = "sm" padding = "lg" radius = "md" withBorder >
82+ < Group justify = "space-between" wrap = "nowrap" align = "center" >
83+ < Group gap = "md" wrap = "nowrap" align = "center" >
84+ < Box p = "xs" bg = "white" style = { { borderRadius : 8 , lineHeight : 0 } } >
85+ < QRCode value = { netId } size = { 88 } />
86+ </ Box >
87+ < Box >
88+ < Group gap = "xs" mb = { 4 } >
89+ < ThemeIcon color = "blue" variant = "light" size = "m" >
90+ < IconQrcode size = { 24 } />
91+ </ ThemeIcon >
92+ < Text fw = { 500 } > Check-In QR Code</ Text >
93+ </ Group >
94+ < Text size = "sm" c = "dimmed" > Show this at events to check in.</ Text >
95+ </ Box >
96+ </ Group >
97+ < Button variant = "light" radius = "md" onClick = { openQr } >
98+ Enlarge
99+ </ Button >
100+ </ Group >
101+ </ Card >
102+ ) }
103+
75104 < SimpleGrid cols = { { base : 1 , sm : 2 , md : 3 } } spacing = "lg" >
76105 { actions . map ( ( item ) => (
77106 < Card key = { item . title } shadow = "sm" padding = "lg" radius = "md" withBorder >
@@ -172,6 +201,15 @@ export function HomePage() {
172201 ) }
173202 </ Stack >
174203 </ Container >
204+
205+ < Modal opened = { qrOpened } onClose = { closeQr } title = "Check-In Code" centered size = "sm" >
206+ < Stack align = "center" gap = "sm" py = "md" >
207+ < Box p = "md" bg = "white" style = { { borderRadius : 8 , lineHeight : 0 } } >
208+ < QRCode value = { netId } size = { 220 } />
209+ </ Box >
210+ < Text size = "xs" c = "dimmed" > Show this at events to check in</ Text >
211+ </ Stack >
212+ </ Modal >
175213 </ MainLayout >
176214 ) ;
177215}
0 commit comments