fix team avatars

This commit is contained in:
yohlo
2026-03-01 20:20:24 -06:00
parent 1ce8a6a982
commit 9571980898
8 changed files with 16 additions and 8 deletions

View File

@@ -106,6 +106,7 @@ function RouteComponent() {
showControls showControls
tournamentId={tournament.id} tournamentId={tournament.id}
hasKnockoutBracket={knockoutBracketPopulated} hasKnockoutBracket={knockoutBracketPopulated}
isRegional={tournament.regional}
/> />
<Divider /> <Divider />
<div> <div>
@@ -120,6 +121,7 @@ function RouteComponent() {
showControls showControls
tournamentId={tournament.id} tournamentId={tournament.id}
hasKnockoutBracket={knockoutBracketPopulated} hasKnockoutBracket={knockoutBracketPopulated}
isRegional={tournament.regional}
/> />
) : ( ) : (
<BracketView bracket={bracket} showControls groupConfig={tournament.group_config} /> <BracketView bracket={bracket} showControls groupConfig={tournament.group_config} />

View File

@@ -39,6 +39,7 @@ function RouteComponent() {
<GroupStageView <GroupStageView
groups={tournament.groups || []} groups={tournament.groups || []}
matches={tournament.matches || []} matches={tournament.matches || []}
isRegional={tournament.regional}
/> />
</Container> </Container>
); );

View File

@@ -49,9 +49,10 @@ interface TeamListProps {
teams: TeamInfo[]; teams: TeamInfo[];
loading?: boolean; loading?: boolean;
onTeamClick?: (teamId: string) => void; onTeamClick?: (teamId: string) => void;
isRegional?: boolean;
} }
const TeamList = ({ teams, loading = false, onTeamClick }: TeamListProps) => { const TeamList = ({ teams, loading = false, onTeamClick, isRegional }: TeamListProps) => {
const navigate = useNavigate(); const navigate = useNavigate();
const handleClick = useCallback( const handleClick = useCallback(
@@ -92,6 +93,7 @@ const TeamList = ({ teams, loading = false, onTeamClick }: TeamListProps) => {
team={team} team={team}
radius="sm" radius="sm"
size={40} size={40}
isRegional={isRegional}
/> />
} }
style={{ cursor: "pointer" }} style={{ cursor: "pointer" }}

View File

@@ -16,6 +16,7 @@ interface GroupStageViewProps {
showControls?: boolean; showControls?: boolean;
tournamentId?: string; tournamentId?: string;
hasKnockoutBracket?: boolean; hasKnockoutBracket?: boolean;
isRegional?: boolean;
} }
interface TeamStanding { interface TeamStanding {
@@ -35,6 +36,7 @@ const GroupStageView: React.FC<GroupStageViewProps> = ({
showControls, showControls,
tournamentId, tournamentId,
hasKnockoutBracket, hasKnockoutBracket,
isRegional,
}) => { }) => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const [expandedTeams, setExpandedTeams] = useState<Record<string, boolean>>({}); const [expandedTeams, setExpandedTeams] = useState<Record<string, boolean>>({});
@@ -334,7 +336,7 @@ const GroupStageView: React.FC<GroupStageViewProps> = ({
<Text size="sm" fw={700} c="dimmed" w={24} ta="center"> <Text size="sm" fw={700} c="dimmed" w={24} ta="center">
{index + 1} {index + 1}
</Text> </Text>
<TeamAvatar team={standing.team} size={28} radius="sm" isRegional={matches[0]?.tournament?.regional} /> <TeamAvatar team={standing.team} size={28} radius="sm" isRegional={isRegional} />
<Text size="sm" fw={500} style={{ flex: 1 }} lineClamp={1}> <Text size="sm" fw={500} style={{ flex: 1 }} lineClamp={1}>
{standing.teamName} {standing.teamName}
</Text> </Text>

View File

@@ -27,7 +27,7 @@ const Profile = ({ id }: ProfileProps) => {
{ {
label: "Teams", label: "Teams",
content: <> content: <>
<TeamList teams={tournament.teams || []} /> <TeamList teams={tournament.teams || []} isRegional={tournament.regional} />
</> </>
} }
], [tournament]); ], [tournament]);

View File

@@ -99,7 +99,7 @@ const StartedTournament: React.FC<{ tournament: Tournament }> = ({
to={`/tournaments/${tournament.id}/bracket`} to={`/tournaments/${tournament.id}/bracket`}
Icon={TreeStructureIcon} Icon={TreeStructureIcon}
/> />
<TeamListButton teams={tournament.teams || []} /> <TeamListButton teams={tournament.teams || []} isRegional={tournament.regional} />
<RulesListButton tournamentId={tournament.id} /> <RulesListButton tournamentId={tournament.id} />
</Box> </Box>
</Stack> </Stack>

View File

@@ -151,12 +151,12 @@ const UpcomingTournament: React.FC<{ tournament: Tournament }> = ({
/> />
{tournament.regional === true ? ( {tournament.regional === true ? (
(tournament.teams && tournament.teams.length > 0) ? ( (tournament.teams && tournament.teams.length > 0) ? (
<TeamListButton teams={tournament.teams} /> <TeamListButton teams={tournament.teams} isRegional={true} />
) : ( ) : (
<EnrolledPlayersListButton tournamentId={tournament.id} /> <EnrolledPlayersListButton tournamentId={tournament.id} />
) )
) : ( ) : (
<TeamListButton teams={tournament.teams || []} /> <TeamListButton teams={tournament.teams || []} isRegional={false} />
)} )}
<RulesListButton tournamentId={tournament.id} /> <RulesListButton tournamentId={tournament.id} />
</Box> </Box>

View File

@@ -8,9 +8,10 @@ import { useMemo } from "react"
interface TeamListButtonProps { interface TeamListButtonProps {
teams: TeamInfo[] teams: TeamInfo[]
isRegional?: boolean
} }
const TeamListButton: React.FC<TeamListButtonProps> = ({ teams }) => { const TeamListButton: React.FC<TeamListButtonProps> = ({ teams, isRegional }) => {
const count = useMemo(() => teams.length, [teams]); const count = useMemo(() => teams.length, [teams]);
const { open, isOpen, toggle } = useSheet(); const { open, isOpen, toggle } = useSheet();
return ( return (
@@ -22,7 +23,7 @@ const TeamListButton: React.FC<TeamListButtonProps> = ({ teams }) => {
/> />
<Sheet title="Enrolled Teams" opened={isOpen} onChange={toggle}> <Sheet title="Enrolled Teams" opened={isOpen} onChange={toggle}>
<TeamList teams={teams} /> <TeamList teams={teams} isRegional={isRegional} />
</Sheet> </Sheet>
</> </>
) )