import { Box, Stack, Text, Divider, Group, Button } from "@mantine/core"; import { Suspense, useState, useDeferredValue, useRef } from "react"; import { Trans, useLingui } from "@lingui/react/macro"; import { Link } from "@tanstack/react-router"; import Header from "./header"; import SwipeableTabs from "@/components/swipeable-tabs"; import { usePlayer, usePlayerMatches, usePlayerStats } from "../../queries"; import TeamList from "@/features/teams/components/team-list"; import StatsOverview, { StatsSkeleton } from "@/components/stats-overview"; import MatchList from "@/features/matches/components/match-list"; import BadgeShowcase from "@/features/badges/components/badge-showcase"; import BadgeShowcaseSkeleton from "@/features/badges/components/badge-showcase-skeleton"; import { track } from "@/lib/telemetry/client"; interface ProfileProps { id: string; } const StatsWithFilter = ({ id }: { id: string }) => { const [viewType, setViewType] = useState<'all' | 'mainline' | 'regional'>('all'); const deferredViewType = useDeferredValue(viewType); const isStale = viewType !== deferredViewType; const viewTypeRef = useRef(viewType); const changeViewType = (next: typeof viewType) => { if (viewTypeRef.current === next) return; viewTypeRef.current = next; track("stats_filtered", { value: next, source: "profile" }); setViewType(next); }; return ( Statistics }> ); }; const StatsContent = ({ id, viewType }: { id: string; viewType: 'all' | 'mainline' | 'regional' }) => { const { data: stats } = usePlayerStats(id, viewType); return ; }; const Profile = ({ id }: ProfileProps) => { const { t } = useLingui(); const { data: player } = usePlayer(id); const { data: matches } = usePlayerMatches(id); const tabs = [ { label: t`Overview`, value: "overview", content: <> Badges }> , }, { label: t`Matches`, value: "matches", content: , }, { label: t`Teams`, value: "teams", content: , }, ]; return ( <>
{ if (tab.value === "matches") track("match_history_viewed", { source: "profile" }); }} /> ); }; export default Profile;