From becddd40c7f205a9d5643701da95b7a411c827b4 Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Sat, 31 Aug 2024 13:33:19 -0700 Subject: Cast party members to guests for expandable row --- client/src/components/Dashboard.tsx | 22 +++------------------- client/src/models.ts | 17 ++++++----------- 2 files changed, 9 insertions(+), 30 deletions(-) (limited to 'client') diff --git a/client/src/components/Dashboard.tsx b/client/src/components/Dashboard.tsx index 42a4224..985e48a 100644 --- a/client/src/components/Dashboard.tsx +++ b/client/src/components/Dashboard.tsx @@ -48,30 +48,14 @@ function Dashboard() { columns, data: guests, muiPaginationProps: { - color: 'primary', shape: 'rounded', showRowsPerPage: false, variant: 'outlined', }, paginationDisplayMode: 'pages', - renderDetailPanel: ({ row }) => - row.original.partySize > 1 - ? row.original.partyList.map((guest, index) => { - return ( -
-

{guest.firstName}

-

{guest.lastName}

-
- ); - }) - : null, + enableExpanding: true, + filterFromLeafRows: true, + getSubRows: (row) => row.partyList as Guest[], }); return ( diff --git a/client/src/models.ts b/client/src/models.ts index 97dce1f..2580d90 100644 --- a/client/src/models.ts +++ b/client/src/models.ts @@ -1,17 +1,12 @@ export interface Guest { - id: number; - firstName: string; - lastName: string; - attendance: string; - email: string; - message: string; - partySize: number; - partyList: Array; -} - -export interface PartyGuest { + id?: number; firstName: string; lastName: string; + attendance?: string; + email?: string; + message?: string; + partySize?: number; + partyList?: Array; } export interface GuestLoginRequest { -- cgit v1.2.3