From 60ad1d127de7f35c2afb81e3168149f0f3941a3b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:24:21 +0100 Subject: [PATCH 1/4] Include transitions to confirmed and declined --- app/ui/guests/table.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index 5eb896e..f760e18 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -26,12 +26,15 @@ export default function guestsTable() { }); }; + const handleInviteGuest = (e: React.MouseEvent) => handleGuestChange(e, 'invited'); + const handleConfirmGuest = (e: React.MouseEvent) => handleGuestChange(e, 'confirmed'); + const handleDeclineGuest = (e: React.MouseEvent) => handleGuestChange(e, 'declined'); - const handleInviteGuest = (e: React.MouseEvent) => { + const handleGuestChange = (e: React.MouseEvent, status:string) => { fetch("/api/guests/bulk_update.json", { method: 'POST', - body: JSON.stringify({ properties: { status: "invited" }, guest_ids: [e.currentTarget.getAttribute('data-guest-id')] }), + body: JSON.stringify({ properties: { status: status }, guest_ids: [e.currentTarget.getAttribute('data-guest-id')] }), headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': getCsrfToken(), @@ -42,6 +45,7 @@ export default function guestsTable() { } guests.length === 0 && loadGuests(); + const ctaClassName = "text-white py-1 px-2 mx-1 rounded"; return (
@@ -97,9 +101,15 @@ export default function guestsTable() { - {guest.status === 'Considered' && ()} + {guest.status === 'Invited' && ()} + {guest.status === 'Invited' && ()} ))} From 7fd8c9cd99b0136bf40fcdaa9c5a72658aed1d27 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:27:33 +0100 Subject: [PATCH 2/4] Flag tentative stsatus with a yellow icon --- app/lib/definitions.ts | 2 +- app/ui/guests/table.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/lib/definitions.ts b/app/lib/definitions.ts index 165d137..17063fe 100644 --- a/app/lib/definitions.ts +++ b/app/lib/definitions.ts @@ -21,7 +21,7 @@ export type Guest = { name: string; email: string; group_name: string; - status: 'Considered' | 'Invited' | 'Confirmed' | 'Declined'; + status: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative'; } export type Group = { diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index f9094ec..608c2ef 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -73,6 +73,7 @@ export default function guestsTable() { 'bg-blue-400': guest.status === 'Invited', 'bg-green-600': guest.status === 'Confirmed', 'bg-red-400': guest.status === 'Declined', + 'bg-yellow-400': guest.status === 'Tentative', } )}> From 63d07096bfc483d96d3909a516520b0f14999dd7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:37:24 +0100 Subject: [PATCH 3/4] Include transition to the transitive status --- app/ui/guests/table.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index 5e90d2b..f5c356c 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -29,6 +29,7 @@ export default function guestsTable() { const handleInviteGuest = (e: React.MouseEvent) => handleGuestChange(e, 'invited'); const handleConfirmGuest = (e: React.MouseEvent) => handleGuestChange(e, 'confirmed'); const handleDeclineGuest = (e: React.MouseEvent) => handleGuestChange(e, 'declined'); + const handleTentativeGuest = (e: React.MouseEvent) => handleGuestChange(e, 'tentative'); const handleGuestChange = (e: React.MouseEvent, status:string) => { fetch("/api/guests/bulk_update.json", @@ -105,12 +106,13 @@ export default function guestsTable() { {guest.status === 'Considered' && ()} - {guest.status === 'Invited' && ()} - {guest.status === 'Invited' && ()} + {guest.status === 'Invited' && ( + <> + + + + + )} ))} From 9bc7f497cdfa3bc7fe3383cd49fb68dbd9548627 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:41:00 +0100 Subject: [PATCH 4/4] Add transitions from the tentative status --- app/ui/guests/table.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index f5c356c..aedd51c 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -106,10 +106,10 @@ export default function guestsTable() { {guest.status === 'Considered' && ()} - {guest.status === 'Invited' && ( + {(guest.status === 'Invited' || guest.status === 'Tentative') && ( <> - + {guest.status != 'Tentative' && } )}