46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { Box } from "@mantine/core";
|
|
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 from "@/shared/components/stats-overview";
|
|
import MatchList from "@/features/matches/components/match-list";
|
|
|
|
interface ProfileProps {
|
|
id: string;
|
|
}
|
|
|
|
const Profile = ({ id }: ProfileProps) => {
|
|
const { data: player } = usePlayer(id);
|
|
const { data: matches } = usePlayerMatches(id);
|
|
const { data: stats, isLoading: statsLoading } = usePlayerStats(id);
|
|
|
|
console.log(player.teams)
|
|
|
|
const tabs = [
|
|
{
|
|
label: "Overview",
|
|
content: <StatsOverview statsData={stats} isLoading={statsLoading} />,
|
|
},
|
|
{
|
|
label: "Matches",
|
|
content: <MatchList matches={matches || []} />,
|
|
},
|
|
{
|
|
label: "Teams",
|
|
content: <TeamList teams={player.teams || []} />,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<>
|
|
<Header player={player} />
|
|
<Box mt="lg">
|
|
<SwipeableTabs tabs={tabs} />
|
|
</Box>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Profile;
|