Add RSVP frontend: bottom sheet form, RsvpBar, and localStorage persistence
Introduces BottomSheet and RsvpBar components, integrates the RSVP submission flow into EventDetailView, extends useEventStorage with saveRsvp/getRsvp, and adds unit tests plus an E2E spec for the RSVP workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,8 @@ export interface StoredEvent {
|
||||
title: string
|
||||
dateTime: string
|
||||
expiryDate: string
|
||||
rsvpToken?: string
|
||||
rsvpName?: string
|
||||
}
|
||||
|
||||
const STORAGE_KEY = 'fete:events'
|
||||
@@ -37,5 +39,25 @@ export function useEventStorage() {
|
||||
return event?.organizerToken
|
||||
}
|
||||
|
||||
return { saveCreatedEvent, getStoredEvents, getOrganizerToken }
|
||||
function saveRsvp(eventToken: string, rsvpToken: string, rsvpName: string, title: string, dateTime: string): void {
|
||||
const events = readEvents()
|
||||
const existing = events.find((e) => e.eventToken === eventToken)
|
||||
if (existing) {
|
||||
existing.rsvpToken = rsvpToken
|
||||
existing.rsvpName = rsvpName
|
||||
} else {
|
||||
events.push({ eventToken, title, dateTime, expiryDate: '', rsvpToken, rsvpName })
|
||||
}
|
||||
writeEvents(events)
|
||||
}
|
||||
|
||||
function getRsvp(eventToken: string): { rsvpToken: string; rsvpName: string } | undefined {
|
||||
const event = readEvents().find((e) => e.eventToken === eventToken)
|
||||
if (event?.rsvpToken && event?.rsvpName) {
|
||||
return { rsvpToken: event.rsvpToken, rsvpName: event.rsvpName }
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
return { saveCreatedEvent, getStoredEvents, getOrganizerToken, saveRsvp, getRsvp }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user