diff --git a/src/features/teams/components/team-profile/index.tsx b/src/features/teams/components/team-profile/index.tsx index 6b31319..0adb4fe 100644 --- a/src/features/teams/components/team-profile/index.tsx +++ b/src/features/teams/components/team-profile/index.tsx @@ -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: Stats/Badges will go here + }, + { + label: "Matches", + content: Matches feed will go here + }, + { + label: "Tournaments", + content: <> + + + } + ]; return <>
- Players - + ; }; diff --git a/src/features/teams/types.ts b/src/features/teams/types.ts index 7a1b863..387c2a5 100644 --- a/src/features/teams/types.ts +++ b/src/features/teams/types.ts @@ -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({ diff --git a/src/lib/pocketbase/util/transform-types.ts b/src/lib/pocketbase/util/transform-types.ts index 7350b39..aa32309 100644 --- a/src/lib/pocketbase/util/transform-types.ts +++ b/src/lib/pocketbase/util/transform-types.ts @@ -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 }; }