- Extract groupPicksByTeamAndSport into shared picks-utils.ts to remove duplication between TeamRosterView and DraftSummaryView - Fix TeamRosterView: make teamPicks a proper useMemo dep on selectedTeamId, add useEffect to reset stale selection if draftSlots changes - Add accessible label/htmlFor to TeamRosterView team Select - Remove dead `season` prop from DraftSummaryView (was inherited from TeamsDraftedGrid but never used) - Fix DraftSummaryView: sport name cells are now <th scope="row">, column headers have scope="col", Total header uses solid bg-muted to match Sport - Replace || null with explicit > 0 check in Total cell for clarity - Consolidate to summaryViewProps/rosterViewProps in route for consistency Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
604 B
TypeScript
19 lines
604 B
TypeScript
export type DraftPick = {
|
|
id: string;
|
|
team: { id: string; name: string };
|
|
participant: { id: string; name: string };
|
|
sport: { id: string; name: string };
|
|
};
|
|
|
|
export function groupPicksByTeamAndSport(
|
|
picks: DraftPick[]
|
|
): Map<string, Map<string, DraftPick[]>> {
|
|
const map = new Map<string, Map<string, DraftPick[]>>();
|
|
picks.forEach((pick) => {
|
|
if (!map.has(pick.team.id)) map.set(pick.team.id, new Map());
|
|
const teamMap = map.get(pick.team.id)!;
|
|
if (!teamMap.has(pick.sport.id)) teamMap.set(pick.sport.id, []);
|
|
teamMap.get(pick.sport.id)!.push(pick);
|
|
});
|
|
return map;
|
|
}
|