From 22e11e9bfe56a8fc10e93af8d4ff35d2dff495d5 Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Sat, 15 Mar 2025 21:03:13 +0100 Subject: [PATCH] Add guests list table MOCK component with search and actions Introduce a dynamic guests list table featuring search, filters, and status badges. Includes functionality to add new guests, perform actions like editing or deleting, and view summarized data for confirmations and additional guests. just the mock --- .../src/components/guests/guests-list.tsx | 245 ++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 frontend/src/components/guests/guests-list.tsx diff --git a/frontend/src/components/guests/guests-list.tsx b/frontend/src/components/guests/guests-list.tsx new file mode 100644 index 0000000..52ac338 --- /dev/null +++ b/frontend/src/components/guests/guests-list.tsx @@ -0,0 +1,245 @@ +import React, { useState } from "react"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { MoreHorizontal, Plus, Search, Filter, Send, Copy } from "lucide-react"; + +const GuestListTable = () => { + const [open, setOpen] = useState(false); + const [searchQuery, setSearchQuery] = useState(""); + + // Mock data + const guests = [ + { + id: "1", + fullName: "John Smith", + email: "john.smith@example.com", + phone: "+1 555-123-4567", + invitationCode: "JSMITH21", + status: "CONFIRMED", + additionalGuests: 2, + }, + { + id: "2", + fullName: "Emma Johnson", + email: "emma.j@example.com", + phone: "+1 555-987-6543", + invitationCode: "EJOHN45", + status: "INVITED", + additionalGuests: 0, + }, + { + id: "3", + fullName: "Michael Brown", + email: "mbrown@example.com", + phone: "+1 555-555-5555", + invitationCode: "MBROWN3", + status: "DECLINED", + additionalGuests: 0, + }, + { + id: "4", + fullName: "Olivia Davis", + email: "olivia.d@example.com", + phone: "+1 555-111-2222", + invitationCode: "ODAVIS7", + status: "PENDING", + additionalGuests: 1, + }, + { + id: "5", + fullName: "William Wilson", + email: "will.w@example.com", + phone: "+1 555-333-4444", + invitationCode: "WWILSON", + status: "CONFIRMED", + additionalGuests: 3, + }, + ]; + + const getStatusBadge = (status) => { + const statusStyles = { + INVITED: "bg-blue-100 text-blue-800", + PENDING: "bg-yellow-100 text-yellow-800", + CONFIRMED: "bg-green-100 text-green-800", + DECLINED: "bg-red-100 text-red-800", + WAITLISTED: "bg-purple-100 text-purple-800", + CANCELLED: "bg-gray-100 text-gray-800", + }; + + return {status}; + }; + + const filteredGuests = guests.filter( + (guest) => + guest.fullName.toLowerCase().includes(searchQuery.toLowerCase()) || + guest.email.toLowerCase().includes(searchQuery.toLowerCase()) || + guest.invitationCode.toLowerCase().includes(searchQuery.toLowerCase()), + ); + + return ( +
+
+

Guest List

+ + + + + + + Add New Guest + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ +
+
+ + setSearchQuery(e.target.value)} + /> +
+
+ + +
+
+ +
+ + + + Name + Email + Phone + Invitation Code + Status + Additional Guests + Actions + + + + {filteredGuests.map((guest) => ( + + {guest.fullName} + {guest.email} + {guest.phone} + +
+ {guest.invitationCode} + +
+
+ {getStatusBadge(guest.status)} + {guest.additionalGuests} + + + + + + + Edit + Resend Invitation + + Delete + + + + +
+ ))} +
+
+
+ +
+
+ Showing {filteredGuests.length} of {guests.length} guests +
+
+ Total Confirmed:{" "} + {guests.filter((g) => g.status === "CONFIRMED").length} | Total + Additional Guests:{" "} + {guests.reduce((acc, g) => acc + g.additionalGuests, 0)} +
+
+
+ ); +}; + +export default GuestListTable;