From 2ea1fd26678706993c4b0b35232cda5136aa4211 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 10 Nov 2024 20:55:03 +0100 Subject: [PATCH] Reuse the table of contents component for the guests list --- app/ui/guests/table.tsx | 110 ++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 65 deletions(-) diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index 9df0f30..3504089 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -7,6 +7,7 @@ import React, { useState, useEffect } from 'react'; import { Guest } from '@/app/lib/definitions'; import { getCsrfToken } from '@/app/lib/utils'; import {classNames} from '@/app/ui/components/button'; +import TableOfContents from '../components/table-of-contents'; export default function guestsTable() { const [guests, setGuests] = useState>([]); @@ -50,69 +51,48 @@ export default function guestsTable() { guests.length === 0 && loadGuests(); return ( -
- - - - - - - - - - - - {guests.map((guest) => ( - - - - - - - ))} - -
- Guests -

- There are {guests.length} guests in the list -

-
- Name - - Group - - Status - Actions
- {guest.name} - - {guest.group_name} - - - - - {guest.status} - - - {guest.status === 'Considered' && ()} - {(guest.status === 'Invited' || guest.status === 'Tentative') && ( - <> - - {guest.status != 'Tentative' && } - - - )} -
-
- ); + ( + + + {guest.name} + + + {guest.group_name} + + + + + + {guest.status} + + + + {guest.status === 'Considered' && ()} + {(guest.status === 'Invited' || guest.status === 'Tentative') && ( + <> + + {guest.status != 'Tentative' && } + + + )} + + + )} + /> + ); }