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

View File

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

View File

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

View File

@@ -16,6 +16,7 @@ interface GroupStageViewProps {
showControls?: boolean;
tournamentId?: string;
hasKnockoutBracket?: boolean;
isRegional?: boolean;
}
interface TeamStanding {
@@ -35,6 +36,7 @@ const GroupStageView: React.FC<GroupStageViewProps> = ({
showControls,
tournamentId,
hasKnockoutBracket,
isRegional,
}) => {
const queryClient = useQueryClient();
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">
{index + 1}
</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}>
{standing.teamName}
</Text>

View File

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

View File

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

View File

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

View File

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