basic team profile

This commit is contained in:
yohlo
2025-08-25 22:08:43 -05:00
parent d845254c3d
commit 44417d063b
3 changed files with 29 additions and 2 deletions

View File

@@ -3,17 +3,35 @@ import Header from "./header";
import TeamList from "@/features/teams/components/team-list";
import { Team } from "../../types";
import PlayerList from "@/features/players/components/player-list";
import SwipeableTabs from "@/components/swipeable-tabs";
import TournamentList from "@/features/tournaments/components/tournament-list";
interface ProfileProps {
team: Team;
}
const TeamProfile = ({ team }: ProfileProps) => {
console.log(team);
const tabs = [
{
label: "Overview",
content: <Text p="md">Stats/Badges will go here</Text>
},
{
label: "Matches",
content: <Text p="md">Matches feed will go here</Text>
},
{
label: "Tournaments",
content: <>
<TournamentList tournaments={team.tournaments || []} />
</>
}
];
return <>
<Header team={team} />
<Box m='sm' mt='lg'>
<Text size='xl' fw={600}>Players</Text>
<PlayerList players={team.players} />
<SwipeableTabs tabs={tabs} />
</Box>
</>;
};

View File

@@ -1,5 +1,6 @@
import { Player } from "@/features/players/types";
import { z } from 'zod';
import { Tournament } from "../tournaments/types";
export interface Team {
id: string;
@@ -18,6 +19,7 @@ export interface Team {
created: string;
updated: string;
players: Player[];
tournaments: Tournament[];
}
export const teamInputSchema = z.object({

View File

@@ -32,6 +32,12 @@ export function transformTeam(record: any): Team {
new Date(a.created!) < new Date(b.created!) ? -1 : 0
)
?.map(transformPlayer) ?? [];
const tournaments =
record.expand?.tournaments
?.sort((a: Tournament, b: Tournament) =>
new Date(a.created!) < new Date(b.created!) ? -1 : 0
)
?.map(transformTournament) ?? [];
return {
id: record.id,
@@ -50,6 +56,7 @@ export function transformTeam(record: any): Team {
created: record.created,
updated: record.updated,
players,
tournaments
};
}