import { Anchor, Box, Group, Stack } from "@mantine/core"; import { CaretRightIcon } from "@phosphor-icons/react"; import { useNavigate } from "@tanstack/react-router"; import MatchCard from "@/features/matches/components/match-card"; import { Match } from "@/features/matches/types"; import SectionHeading from "./section-heading"; interface RecentResultsProps { /** Ended matches, already sorted most-recent-first. */ matches: Match[]; tournamentId: string; /** How many to show inline before offering "View all results". */ max?: number; } /** * Recently finished matches, newest on top, so people can look back and react * (each MatchCard carries its own reaction bar). Caps the inline list and links * to the full bracket when there are more results than fit. */ const RecentResults = ({ matches, tournamentId, max = 5 }: RecentResultsProps) => { const navigate = useNavigate(); if (matches.length === 0) return null; const shown = matches.slice(0, max); const hasMore = matches.length > max; return ( navigate({ to: `/tournaments/${tournamentId}/bracket` }) } > View all results ) : undefined } /> {shown.map((match) => ( ))} ); }; export default RecentResults;