37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import type { InvitationDetail } from "@/lib/db/queries/invitations"
|
|
import type { ToastRequest } from "@/lib/db/types"
|
|
import type { GuestDictionary } from "@/lib/i18n/dictionaries"
|
|
|
|
import { PhotoUpload } from "@/components/invite/photo-upload"
|
|
import { RsvpGuestFields } from "@/components/invite/rsvp-guest-fields"
|
|
import { RsvpToastFields } from "@/components/invite/rsvp-toast-fields"
|
|
import { RsvpTravelFields } from "@/components/invite/rsvp-travel-fields"
|
|
|
|
export function RsvpForm({
|
|
action,
|
|
detail,
|
|
token,
|
|
dictionary,
|
|
closed,
|
|
toastRequest,
|
|
filename,
|
|
}: {
|
|
action: (formData: FormData) => void | Promise<void>
|
|
detail: InvitationDetail
|
|
token: string
|
|
dictionary: GuestDictionary
|
|
closed: boolean
|
|
toastRequest: ToastRequest | undefined
|
|
filename: string | null
|
|
}) {
|
|
return (
|
|
<form action={action} className="mt-12">
|
|
<RsvpGuestFields members={detail.members} dictionary={dictionary} disabled={closed} />
|
|
<RsvpTravelFields response={detail.response} dictionary={dictionary} disabled={closed} />
|
|
<RsvpToastFields members={detail.members} toastRequest={toastRequest} dictionary={dictionary} disabled={closed} />
|
|
<div className="py-10"><PhotoUpload token={token} labels={dictionary.upload} disabled={closed} existingFilename={filename} /></div>
|
|
{!closed ? <button type="submit" className="wedding-primary-cta w-full">{dictionary.form.submit} →</button> : null}
|
|
</form>
|
|
)
|
|
}
|