tournament logo upload via api

This commit is contained in:
yohlo
2025-08-24 13:50:48 -05:00
parent 466a3365f0
commit 936ab0ce72
13 changed files with 417 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
import { Badge, Card, Text, Image, Stack, Flex } from "@mantine/core"
import { Tournament } from "@/features/tournaments/types"
import { useMemo } from "react"
import { CaretRightIcon } from "@phosphor-icons/react"
import { CaretRightIcon, TrophyIcon } from "@phosphor-icons/react"
import { useNavigate } from "@tanstack/react-router"
interface TournamentCardProps {
@@ -26,11 +26,12 @@ export const TournamentCard = ({ tournament }: TournamentCardProps) => {
<Stack>
<Flex align='center' gap='md'>
<Image
src={tournament.logo_url}
src={tournament.logo ? `/api/files/tournaments/${tournament.id}/${tournament.logo}` : undefined}
maw={100}
mah={100}
fit='contain'
alt={tournament.name}
fallbackSrc={"TODO"}
/>
<Stack ta='center' mx='auto' gap='0'>
<Text size='lg' fw={800}>{tournament.name} <CaretRightIcon size={12} weight='bold' /></Text>

View File

@@ -7,7 +7,7 @@ export interface Tournament {
location?: string;
desc?: string;
rules?: string;
logo_url?: string;
logo?: string;
enroll_time?: string;
start_time: string;
end_time?: string;
@@ -22,7 +22,7 @@ export const tournamentFormSchema = z.object({
location: z.string().optional(),
desc: z.string().optional(),
rules: z.string().optional(),
logo_url: z.string().optional(),
logo: z.file().optional(),
enroll_time: z.string(),
start_time: z.string(),
end_time: z.string().optional(),
@@ -34,7 +34,7 @@ export const tournamentInputSchema = z.object({
location: z.string().optional(),
desc: z.string().optional(),
rules: z.string().optional(),
logo_url: z.string().optional(),
logo: z.file().optional(),
enroll_time: z.string(),
start_time: z.string(),
end_time: z.string().optional(),