import { Button } from "~/components/ui/button"; import { Badge } from "~/components/ui/badge"; import { ListPlus, ListX } from "lucide-react"; interface AvailableParticipantsSectionProps { participants: Array<{ id: string; name: string; sport: { id: string; name: string; }; }>; searchQuery: string; sportFilter: string; hideDrafted: boolean; hideIneligible: 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; onHideIneligibleChange: (hide: boolean) => void; onMakePick: (participantId: string) => void; onAddToQueue: (participantId: string) => void; onRemoveFromQueue: (queueId: string) => void; } export function AvailableParticipantsSection({ participants, searchQuery, sportFilter, hideDrafted, hideIneligible, uniqueSports, draftedParticipantIds, queue, eligibility, canPick, hasTeam, onSearchChange, onSportFilterChange, onHideDraftedChange, onHideIneligibleChange, 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 */} {/* Show/Hide Ineligible Toggle - only show if user has a team */} {hasTeam && eligibility && ( )}
{/* 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 SportQueue
No participants found
{participant.name} {isDrafted && ( Drafted )} {!isDrafted && !isEligible && ( Ineligible )} {isInQueue && !isDrafted && isEligible && ( Queued )}
{participant.sport.name}
{!isDrafted && ( <> {/* Queue icon button */} {!isInQueue ? ( ) : ( )} {/* Draft button - always visible, disabled when not your turn */} )}
); }