Feature: Add RSVP cut-off date functionality

This commit is contained in:
Starstrike
2025-05-01 13:44:29 -04:00
parent 3ac630bcc2
commit e1d23eeb32
6 changed files with 142 additions and 83 deletions

View File

@@ -56,6 +56,15 @@ const RSVPForm: React.FC = () => {
axios.get(`/api/events/${slug}/rsvps`)
]);
// Check if event is closed for RSVPs
if (eventResponse.data.rsvp_cutoff_date) {
const cutoffDate = new Date(eventResponse.data.rsvp_cutoff_date);
if (new Date() > cutoffDate) {
navigate(`/view/events/${slug}`);
return;
}
}
// Process needed items
let items: string[] = [];
if (eventResponse.data.needed_items) {
@@ -291,6 +300,12 @@ const RSVPForm: React.FC = () => {
</Typography>
)}
{event?.rsvp_cutoff_date && (
<Typography variant="body2" color="text.secondary" align="center" sx={{ mb: 2 }}>
<strong>Note:</strong> RSVPs will close on {new Date(event.rsvp_cutoff_date).toLocaleString()}
</Typography>
)}
<Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
<TextField
label="Name"