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 { useSingers } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectSingers } from '../../redux'; import { formatDate } from '../../utils/dataProcessing'; const Singers: React.FC = () => { const { singers, isAdmin, handleRemoveSinger, } = useSingers(); const singersData = useAppSelector(selectSingers); const singersCount = Object.keys(singersData).length; // Debug logging console.log('Singers component - singers count:', singersCount); console.log('Singers component - singers:', singers); 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)} > )}
))}
)}
); }; export default Singers;