fix team avatars
This commit is contained in:
@@ -27,7 +27,7 @@ export const Route = createFileRoute("/_authed/tournaments/$id/bracket")({
|
|||||||
withPadding: false,
|
withPadding: false,
|
||||||
header: {
|
header: {
|
||||||
withBackButton: true,
|
withBackButton: true,
|
||||||
title: `${context.tournament.name} - Bracket`,
|
title: `${context.tournament.name}`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const Route = createFileRoute("/_authed/tournaments/$id/groups")({
|
|||||||
withPadding: false,
|
withPadding: false,
|
||||||
header: {
|
header: {
|
||||||
withBackButton: true,
|
withBackButton: true,
|
||||||
title: `${context.tournament.name} - Groups`,
|
title: `${context.tournament.name}`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
|||||||
@@ -30,17 +30,7 @@ const TeamAvatar = ({
|
|||||||
const hasNoLogo = !team.logo;
|
const hasNoLogo = !team.logo;
|
||||||
const hasTwoPlayers = team.players?.length === 2;
|
const hasTwoPlayers = team.players?.length === 2;
|
||||||
|
|
||||||
let shouldShowPlayerAvatars = false;
|
const shouldShowPlayerAvatars = isRegional === true && hasTwoPlayers && hasNoLogo;
|
||||||
|
|
||||||
if (isRegional !== undefined) {
|
|
||||||
shouldShowPlayerAvatars = isRegional && hasTwoPlayers && hasNoLogo;
|
|
||||||
} else {
|
|
||||||
const tournaments = (team as any).tournaments;
|
|
||||||
const hasTournaments = tournaments && tournaments.length > 0;
|
|
||||||
const allTournamentsAreRegional = hasTournaments && tournaments.every((t: any) => t.regional === true);
|
|
||||||
|
|
||||||
shouldShowPlayerAvatars = hasTwoPlayers && hasNoLogo && (allTournamentsAreRegional || !hasTournaments);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldShowPlayerAvatars && team.players?.length === 2) {
|
if (shouldShowPlayerAvatars && team.players?.length === 2) {
|
||||||
const playerSize = size * 0.6;
|
const playerSize = size * 0.6;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ const RegionalTeamCard = ({ teamId }: RegionalTeamCardProps) => {
|
|||||||
team={team}
|
team={team}
|
||||||
size={40}
|
size={40}
|
||||||
radius="md"
|
radius="md"
|
||||||
|
isRegional={true}
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: team.primary_color || undefined,
|
backgroundColor: team.primary_color || undefined,
|
||||||
color: team.accent_color || undefined,
|
color: team.accent_color || undefined,
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ const GroupMatchCard: React.FC<GroupMatchCardProps> = ({ match, showControls })
|
|||||||
<Stack gap="sm">
|
<Stack gap="sm">
|
||||||
<Group justify="space-between" align="center" wrap="nowrap">
|
<Group justify="space-between" align="center" wrap="nowrap">
|
||||||
<Group gap="sm" style={{ flex: 1, minWidth: 0 }}>
|
<Group gap="sm" style={{ flex: 1, minWidth: 0 }}>
|
||||||
<TeamAvatar team={match.home} size={32} radius="sm" />
|
<TeamAvatar team={match.home} size={32} radius="sm" isRegional={match.tournament.regional} />
|
||||||
<Text
|
<Text
|
||||||
size="sm"
|
size="sm"
|
||||||
fw={homeWon ? 700 : 500}
|
fw={homeWon ? 700 : 500}
|
||||||
@@ -124,7 +124,7 @@ const GroupMatchCard: React.FC<GroupMatchCardProps> = ({ match, showControls })
|
|||||||
|
|
||||||
<Group justify="space-between" align="center" wrap="nowrap">
|
<Group justify="space-between" align="center" wrap="nowrap">
|
||||||
<Group gap="sm" style={{ flex: 1, minWidth: 0 }}>
|
<Group gap="sm" style={{ flex: 1, minWidth: 0 }}>
|
||||||
<TeamAvatar team={match.away} size={32} radius="sm" />
|
<TeamAvatar team={match.away} size={32} radius="sm" isRegional={match.tournament.regional} />
|
||||||
<Text
|
<Text
|
||||||
size="sm"
|
size="sm"
|
||||||
fw={awayWon ? 700 : 500}
|
fw={awayWon ? 700 : 500}
|
||||||
|
|||||||
@@ -334,7 +334,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" />
|
<TeamAvatar team={standing.team} size={28} radius="sm" isRegional={matches[0]?.tournament?.regional} />
|
||||||
<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>
|
||||||
|
|||||||
Reference in New Issue
Block a user