From ead4252441c749f59c29ab189264ecb69b0cd639 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 18 Jul 2025 10:20:16 -0500 Subject: [PATCH] Signed-off-by: Matt Bruce --- src/features/Singers/Singers.tsx | 126 +++++++++++-------------------- 1 file changed, 45 insertions(+), 81 deletions(-) diff --git a/src/features/Singers/Singers.tsx b/src/features/Singers/Singers.tsx index 28a8b0f..66600f2 100644 --- a/src/features/Singers/Singers.tsx +++ b/src/features/Singers/Singers.tsx @@ -1,11 +1,11 @@ import React from 'react'; -import { IonHeader, IonToolbar, IonTitle, IonList, IonItem, IonLabel, IonItemSliding, IonItemOptions, IonItemOption, IonIcon, IonChip } from '@ionic/react'; -import { people, trash, time } from 'ionicons/icons'; -import { EmptyState } from '../../components/common'; +import { IonItem, IonLabel, IonIcon, IonItemSliding, IonItemOptions, IonItemOption } from '@ionic/react'; +import { trash } from 'ionicons/icons'; +import { InfiniteScrollList, PageHeader } from '../../components/common'; import { useSingers } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectSingers } from '../../redux'; -import { formatDate } from '../../utils/dataProcessing'; +import type { Singer } from '../../types'; const Singers: React.FC = () => { const { @@ -21,86 +21,50 @@ const Singers: React.FC = () => { console.log('Singers component - singers count:', singersCount); console.log('Singers component - singers:', singers); + // Render singer item for InfiniteScrollList + const renderSingerItem = (singer: Singer) => ( + + + +

+ {singer.name} +

+
+
+ + {/* Swipe to Remove (Admin Only) */} + {isAdmin && ( + + handleRemoveSinger(singer)} + > + + + + )} +
+ ); + return ( <> - - - - Singers - - {singers.length} - - - - + -
-

- {singers.length} singer{singers.length !== 1 ? 's' : ''} in the party -

- - {/* Debug info */} -
- Singers loaded: {singersCount} -
- - {/* Singers List */} -
- {singersCount === 0 ? ( - - - - } - /> - ) : singers.length === 0 ? ( - - - - } - /> - ) : ( - - {singers.map((singer) => ( - - - - -

- {singer.name} -

-
- - - {formatDate(singer.lastLogin)} - -
-
-
- - {/* Swipe to Remove (Admin Only) */} - {isAdmin && ( - - handleRemoveSinger(singer)} - > - - - - )} -
- ))} -
- )} -
+
+ + items={singers} + isLoading={singersCount === 0} + hasMore={false} + onLoadMore={() => {}} + renderItem={renderSingerItem} + emptyTitle="No singers yet" + emptyMessage="Singers will appear here when they join the party" + loadingTitle="Loading singers..." + loadingMessage="Please wait while singers data is being loaded" + />
);