import { Button } from "~/components/ui/button"; import { Badge } from "~/components/ui/badge"; interface AvailableParticipantsSectionProps { participants: Array<{ id: string; name: string; expectedValue: number; sport: { id: string; name: string; }; }>; searchQuery: string; sportFilter: string; hideDrafted: boolean; uniqueSports: string[]; draftedParticipantIds: Set; queue: Array<{ id: string; participantId: string }>; eligibility: { eligibleSportIds: Set; ineligibleReasons: Record; } | null; canPick: boolean; hasTeam: boolean; onSearchChange: (query: string) => void; onSportFilterChange: (sport: string) => void; onHideDraftedChange: (hide: boolean) => void; onMakePick: (participantId: string) => void; onAddToQueue: (participantId: string) => void; onRemoveFromQueue: (queueId: string) => void; } export function AvailableParticipantsSection({ participants, searchQuery, sportFilter, hideDrafted, uniqueSports, draftedParticipantIds, queue, eligibility, canPick, hasTeam, onSearchChange, onSportFilterChange, onHideDraftedChange, onMakePick, onAddToQueue, onRemoveFromQueue, }: AvailableParticipantsSectionProps) { return (
{/* Search Input */} onSearchChange(e.target.value)} className="w-full px-3 py-2 border rounded-md text-sm" />
{/* Sport Filter Dropdown */} {/* Show/Hide Drafted Toggle */}
{/* Table - This will scroll independently */}
{hasTeam && ( )} {participants.length === 0 ? ( ) : ( participants.map((participant) => { const isDrafted = draftedParticipantIds.has(participant.id); const isInQueue = queue.some( (item) => item.participantId === participant.id ); // Check eligibility const isEligible = eligibility ? eligibility.eligibleSportIds.has(participant.sport.id) : true; const ineligibleReason = eligibility?.ineligibleReasons[participant.sport.id]; return ( {hasTeam && ( )} ); }) )}
Participant Sport EVQueue
No participants found
{participant.name} {isDrafted && ( Drafted )} {!isDrafted && !isEligible && ( Ineligible )} {isInQueue && !isDrafted && isEligible && ( Queued )}
{participant.sport.name} {participant.expectedValue}
{/* Pick button - only show if it's your turn and participant not drafted */} {canPick && !isDrafted && ( <> {/* Queue icon button next to Pick */} {!isInQueue ? ( ) : ( )} )} {/* Queue buttons - only show if not your turn */} {!canPick && !isDrafted && !isInQueue && ( )} {!canPick && !isDrafted && isInQueue && ( )}
); }