diff --git a/public/hero.jpeg b/public/hero.jpeg deleted file mode 100644 index ca038be..0000000 Binary files a/public/hero.jpeg and /dev/null differ diff --git a/public/logo.jpg b/public/logo.jpg new file mode 100644 index 0000000..1f37c17 Binary files /dev/null and b/public/logo.jpg differ diff --git a/src/components/RSVP.tsx b/src/components/RSVP.tsx index 7b72609..b9144c6 100644 --- a/src/components/RSVP.tsx +++ b/src/components/RSVP.tsx @@ -44,7 +44,11 @@ const RSVPForm = () => { headers: { "Content-Type": "application/json", }, - body: JSON.stringify(formData), + body: JSON.stringify({ + ...formData, + attending: formData.attending === true, // Ensure it's a boolean + timestamp: new Date().toISOString(), + }), signal: controller.signal, }); @@ -242,7 +246,7 @@ const RSVPForm = () => { ) : formData.attending ? ( "Yes, I'll Be There!" ) : formData.attending === false ? ( - "Send My Regrets" + "Submit RSVP" ) : ( "Submit RSVP" )} diff --git a/src/components/RSVPManager.tsx b/src/components/RSVPManager.tsx index 5b7cbf5..e6aea09 100644 --- a/src/components/RSVPManager.tsx +++ b/src/components/RSVPManager.tsx @@ -33,6 +33,31 @@ const RSVPManager = () => { } }; + const handleDeleteRSVP = async (name: string, timestamp: string) => { + if (!confirm(`Are you sure you want to delete the RSVP from ${name}?`)) { + return; + } + + try { + const response = await fetchWithAuth(`/api/rsvp`, { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ name, timestamp }), + }); + + if (!response.ok) { + throw new Error(`Failed to delete RSVP: ${response.statusText}`); + } + + await fetchRSVPList(); + } catch (error: any) { + setError(error.message); + console.error("Error deleting RSVP:", error); + } + }; + useEffect(() => { fetchRSVPList(); @@ -57,30 +82,27 @@ const RSVPManager = () => { const attending = rsvpList.filter(rsvp => rsvp.attending === true); const notAttending = rsvpList.filter(rsvp => rsvp.attending === false); - const noResponse = rsvpList.filter(rsvp => rsvp.attending === undefined || rsvp.attending === null); return ( -
Status | Dietary Restrictions | Notes | -Timestamp | +Response Date | +Actions | |||
---|---|---|---|---|---|---|---|---|
{rsvp.name} |
-
- {rsvp.attending === true ? 'Attending' :
- rsvp.attending === false ? 'Not Attending' :
- 'No Response'}
-
+
+ {rsvp.attending ? 'Attending' : 'Not Attending'}
+
+ |
+ {rsvp.dietaryRestrictions && rsvp.dietaryRestrictions !== "undefined" ? rsvp.dietaryRestrictions : "-"} | +{rsvp.notes && rsvp.notes !== "undefined" ? rsvp.notes : "-"} | +{new Date(rsvp.timestamp).toLocaleDateString('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric', + hour: '2-digit', + minute: '2-digit' + })} | ++ | -{rsvp.attending ? (rsvp.dietaryRestrictions || "None") : "-"} | -{(rsvp.notes && rsvp.notes !== "undefined") ? rsvp.notes.trim() : "None"} | -{new Date(rsvp.timestamp).toLocaleString()} |
Item | +Link | +Status | +Claim | +
---|---|---|---|
+
+
+
+ {item.name}
+ {item.taken && (
+
+ {item.taken &&
+ item.claimedBy &&
+ showClaimants.has(item.id) && (
+
+ Taken
+
+
+ )}
+
+ Claimed by: {item.claimedBy}
+
+ )}
+ |
+
{item.link && (
e.stopPropagation()}
>
- View Item
+ View
)}
-
-
- ))}
-
-
- {claimedItems.size > 0 && (
-
-
-
- )}
- >
- )}
-
- {claimedItemsArray.length > 0 && (
-
- Already Claimed-
- {claimedItemsArray.map((item) => (
-
-
+
-
- {item.name}-- Claimed by: {item.claimedBy} - - |
+ {item.taken ? "Claimed" : "Available"} | ++ {!item.taken ? ( + handleCheckboxChange(item.id)} + /> + ) : } + | +