48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { Box, Text } from "@mantine/core";
|
|
import Header from "./header";
|
|
import SwipeableTabs from "@/components/swipeable-tabs";
|
|
import TournamentList from "@/features/tournaments/components/tournament-list";
|
|
import StatsOverview from "@/shared/components/stats-overview";
|
|
import { useTeam, useTeamMatches, useTeamStats } from "../../queries";
|
|
import MatchList from "@/features/matches/components/match-list";
|
|
|
|
interface ProfileProps {
|
|
id: string;
|
|
}
|
|
|
|
const TeamProfile = ({ id }: ProfileProps) => {
|
|
const { data: team } = useTeam(id);
|
|
const { data: matches } = useTeamMatches(id);
|
|
const { data: stats, isLoading: statsLoading, error: statsError } = useTeamStats(id);
|
|
if (!team) return <Text p="md">Team not found</Text>;
|
|
|
|
const tabs = [
|
|
{
|
|
label: "Overview",
|
|
content: <StatsOverview statsData={statsError ? null : stats || null} isLoading={statsLoading} />,
|
|
},
|
|
{
|
|
label: "Matches",
|
|
content: <MatchList matches={matches || []} />,
|
|
},
|
|
{
|
|
label: "Tournaments",
|
|
content: (
|
|
<>
|
|
<TournamentList tournaments={team.tournaments || []} />
|
|
</>
|
|
),
|
|
},
|
|
];
|
|
return (
|
|
<>
|
|
<Header name={team.name} logo={team.logo} />
|
|
<Box m="xs" mt="lg">
|
|
<SwipeableTabs tabs={tabs} />
|
|
</Box>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TeamProfile;
|