various improvements, edit tournament, etc

This commit is contained in:
yohlo
2025-08-24 22:56:48 -05:00
parent 936ab0ce72
commit 2b8ccf1649
25 changed files with 504 additions and 52 deletions

View File

@@ -0,0 +1,40 @@
import { List, ListItem, Skeleton, Text } from "@mantine/core";
import { useNavigate } from "@tanstack/react-router";
import Avatar from "@/components/avatar";
import { Tournament } from "../types";
interface TournamentListProps {
tournaments: Tournament[];
loading?: boolean;
}
const TournamentList = ({ tournaments, loading = false }: TournamentListProps) => {
const navigate = useNavigate();
if (loading) return <List>
{Array.from({ length: 10 }).map((_, i) => (
<ListItem py='xs'
icon={<Skeleton height={40} width={40} />}
>
<Skeleton height={20} width={200} />
</ListItem>
))}
</List>
return <List>
{tournaments?.map((tournament) => (
<ListItem key={tournament.id}
py='xs'
icon={<Avatar radius='xs' size={40} name={`${tournament.name}`} src={`/api/files/tournaments/${tournament.id}/${tournament.logo}`} />}
style={{ cursor: 'pointer' }}
onClick={() => {
navigate({ to: `/tournaments/${tournament.id}` });
}}
>
<Text fw={500}>{`${tournament.name}`}</Text>
</ListItem>
))}
</List>
}
export default TournamentList;