import { Stack, Group, Text, ThemeIcon } from "@mantine/core"; import { CrownIcon, MedalIcon } from "@phosphor-icons/react"; import { TeamInfo } from "@/features/teams/types"; import { Tournament } from "../types"; import { msg } from "@lingui/core/macro"; import { useLingui } from "@lingui/react/macro"; import type { MessageDescriptor } from "@lingui/core"; interface PodiumProps { tournament: Tournament; } type PodiumTier = "first" | "second" | "third"; const tierStyles: Record = { first: { background: "light-dark(color-mix(in srgb, var(--mantine-color-yellow-4) 10%, var(--mantine-color-white)), color-mix(in srgb, var(--mantine-color-yellow-8) 16%, var(--mantine-color-dark-6)))", border: "1px solid light-dark(color-mix(in srgb, var(--mantine-color-yellow-6) 45%, var(--mantine-color-gray-3)), color-mix(in srgb, var(--mantine-color-yellow-6) 35%, var(--mantine-color-dark-4)))", borderRadius: "var(--mantine-radius-md)", boxShadow: "var(--mantine-shadow-md)", }, second: { background: "light-dark(color-mix(in srgb, var(--mantine-color-gray-5) 10%, var(--mantine-color-white)), color-mix(in srgb, var(--mantine-color-gray-5) 10%, var(--mantine-color-dark-6)))", border: "1px solid light-dark(var(--mantine-color-gray-4), var(--mantine-color-dark-4))", borderRadius: "var(--mantine-radius-md)", boxShadow: "var(--mantine-shadow-xs)", }, third: { background: "light-dark(color-mix(in srgb, var(--mantine-color-orange-5) 8%, var(--mantine-color-white)), color-mix(in srgb, var(--mantine-color-orange-9) 14%, var(--mantine-color-dark-6)))", border: "1px solid light-dark(color-mix(in srgb, var(--mantine-color-orange-6) 35%, var(--mantine-color-gray-3)), color-mix(in srgb, var(--mantine-color-orange-7) 30%, var(--mantine-color-dark-4)))", borderRadius: "var(--mantine-radius-md)", boxShadow: "var(--mantine-shadow-xs)", }, }; const tierConfig: Record< PodiumTier, { color: string; label: MessageDescriptor; labelColor: string; icon: React.ReactNode; iconSize: "xl" | "lg"; padding: "md" | "xs"; nameSize: "md" | "sm"; } > = { first: { color: "yellow", label: msg`Champions`, labelColor: "light-dark(var(--mantine-color-yellow-8), var(--mantine-color-yellow-4))", icon: , iconSize: "xl", padding: "md", nameSize: "md", }, second: { color: "gray", label: msg`2nd place`, labelColor: "light-dark(var(--mantine-color-gray-6), var(--mantine-color-gray-4))", icon: , iconSize: "lg", padding: "xs", nameSize: "sm", }, third: { color: "orange", label: msg`3rd place`, labelColor: "light-dark(var(--mantine-color-orange-8), var(--mantine-color-orange-4))", icon: , iconSize: "lg", padding: "xs", nameSize: "sm", }, }; const PodiumRow = ({ team, tier }: { team: TeamInfo; tier: PodiumTier }) => { const { t } = useLingui(); const config = tierConfig[tier]; return ( {config.icon} {team.name} {team.players?.map((player) => ( {player.first_name} {player.last_name} ))} {t(config.label)} ); }; export const Podium = ({ tournament }: PodiumProps) => { if (!tournament.first_place) return; return ( {tournament.first_place && ( )} {tournament.second_place && ( )} {tournament.third_place && ( )} ); };