import { useNavigate } from "react-router-dom"; import { formatDate, formatDuration } from "../domain/format"; import type { MatchListItem } from "../domain/types"; import { MatchListView } from "./MatchList"; /** * История партий игрока в профиле. Подробный режим — тот же список, что у группы * (MatchListView со всеми участниками); компактный — строка с результатом самого * владельца профиля, поэтому компонент и принимает его userId. */ export function MatchHistory({ items, userId, detail, hasMore = false, loadingMore = false, onMore, }: { items: MatchListItem[]; userId: number; detail: string; hasMore?: boolean; loadingMore?: boolean; onMore?: () => void; }) { const navigate = useNavigate(); const more = hasMore && onMore && ( ); if (items.length === 0) return
Партий пока нет.
; if (detail === "full") return ( <> {more} ); return (
{items.map((m) => { const mine = m.participants.find((p) => p.user_id === userId); return ( ); })} {more}
); }