basic team profile
This commit is contained in:
@@ -3,17 +3,35 @@ import Header from "./header";
|
|||||||
import TeamList from "@/features/teams/components/team-list";
|
import TeamList from "@/features/teams/components/team-list";
|
||||||
import { Team } from "../../types";
|
import { Team } from "../../types";
|
||||||
import PlayerList from "@/features/players/components/player-list";
|
import PlayerList from "@/features/players/components/player-list";
|
||||||
|
import SwipeableTabs from "@/components/swipeable-tabs";
|
||||||
|
import TournamentList from "@/features/tournaments/components/tournament-list";
|
||||||
|
|
||||||
interface ProfileProps {
|
interface ProfileProps {
|
||||||
team: Team;
|
team: Team;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TeamProfile = ({ team }: ProfileProps) => {
|
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 <>
|
return <>
|
||||||
<Header team={team} />
|
<Header team={team} />
|
||||||
<Box m='sm' mt='lg'>
|
<Box m='sm' mt='lg'>
|
||||||
<Text size='xl' fw={600}>Players</Text>
|
<SwipeableTabs tabs={tabs} />
|
||||||
<PlayerList players={team.players} />
|
|
||||||
</Box>
|
</Box>
|
||||||
</>;
|
</>;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Player } from "@/features/players/types";
|
import { Player } from "@/features/players/types";
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
import { Tournament } from "../tournaments/types";
|
||||||
|
|
||||||
export interface Team {
|
export interface Team {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -18,6 +19,7 @@ export interface Team {
|
|||||||
created: string;
|
created: string;
|
||||||
updated: string;
|
updated: string;
|
||||||
players: Player[];
|
players: Player[];
|
||||||
|
tournaments: Tournament[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const teamInputSchema = z.object({
|
export const teamInputSchema = z.object({
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ export function transformTeam(record: any): Team {
|
|||||||
new Date(a.created!) < new Date(b.created!) ? -1 : 0
|
new Date(a.created!) < new Date(b.created!) ? -1 : 0
|
||||||
)
|
)
|
||||||
?.map(transformPlayer) ?? [];
|
?.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 {
|
return {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
@@ -50,6 +56,7 @@ export function transformTeam(record: any): Team {
|
|||||||
created: record.created,
|
created: record.created,
|
||||||
updated: record.updated,
|
updated: record.updated,
|
||||||
players,
|
players,
|
||||||
|
tournaments
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user