"use client"; import { useMemo, useState } from "react"; import type { Match, Team } from "../../types/passport"; import { countWatchedMatchesForTeam } from "../../utils/passportMetrics"; import EmptyState from "../shared/EmptyState"; import ProgressBar from "../shared/ProgressBar"; import StatusPill from "../shared/StatusPill"; interface TeamCollectionScreenProps { teams: Team[]; matches: Match[]; onToggleTeam: (teamId: string) => void; } export default function TeamCollectionScreen({ teams, matches, onToggleTeam, }: TeamCollectionScreenProps) { const [groupFilter, setGroupFilter] = useState("all"); const [stateFilter, setStateFilter] = useState<"all" | "collected" | "missing">("all"); const [query, setQuery] = useState(""); const groups = useMemo(() => ["all", ...Array.from(new Set(teams.map((team) => team.group)))], [teams]); const filteredTeams = teams.filter((team) => { const matchesGroup = groupFilter === "all" || team.group === groupFilter; const matchesState = stateFilter === "all" || (stateFilter === "collected" && team.collected) || (stateFilter === "missing" && !team.collected); const matchesQuery = query.trim().length === 0 || team.name.toLowerCase().includes(query.trim().toLowerCase()) || team.shortName.toLowerCase().includes(query.trim().toLowerCase()); return matchesGroup && matchesState && matchesQuery; }); return (

Team collection

Complete every group.

Team pages are the backbone of the passport: every nation can hold stamps, stickers, trivia, predictions, watch progress, and post-tournament loyalty loops.

setQuery(event.target.value)} placeholder="Search team or code" value={query} />
{groups.map((group) => ( ))}
{(["all", "collected", "missing"] as const).map((filter) => ( ))}
{filteredTeams.length === 0 ? ( ) : (
{filteredTeams.map((team) => { const watchedMatches = countWatchedMatchesForTeam(matches, team.id); return (
{team.collected ? "Collected" : "Missing"}

{team.name}

{team.shortName} · {team.confederation} · {team.group}

{team.story}

  • Star player {team.starPlayer}
  • FIFA rank #{team.fifaRank}
  • Watch stamps {watchedMatches}/{team.totalMatches}
  • Stickers {team.stickerCount}/{team.totalStickers}
); })}
)}
); }