Show "BOTH" maplist source on match banner as two team avatars

This commit is contained in:
Kalle 2026-06-27 10:27:52 +03:00
parent d3100971c6
commit d3a475a1de

View File

@ -267,25 +267,37 @@ function CurrentMapPickInfo({
});
if (!picker) return null;
const team = tournament.teamById(picker.teamId);
if (!team) return null;
const teamIds = picker.kind === "BOTH" ? picker.teamIds : [picker.teamId];
const teams = teamIds
.map((teamId) => tournament.teamById(teamId))
.filter((team) => team !== undefined);
if (teams.length !== teamIds.length) return null;
const text = t(
picker.kind === "COUNTERPICK"
? "tournament:pickInfo.counterpickedBy"
: "tournament:pickInfo.pickedBy",
{ teamName: team.name },
);
const text = (() => {
switch (picker.kind) {
case "BOTH":
return t("tournament:pickInfo.both");
case "COUNTERPICK":
return t("tournament:pickInfo.counterpickedBy", {
teamName: teams[0].name,
});
default:
return t("tournament:pickInfo.pickedBy", { teamName: teams[0].name });
}
})();
return (
<SendouPopover
trigger={
<SendouButton variant="minimal" className={bannerStyles.infoBadge}>
<Avatar
url={tournament.tournamentTeamLogoSrc(team)}
identiconInput={team.name}
size="xxs"
/>
{teams.map((team) => (
<Avatar
key={team.id}
url={tournament.tournamentTeamLogoSrc(team)}
identiconInput={team.name}
size="xxs"
/>
))}
</SendouButton>
}
>
@ -304,7 +316,10 @@ function resolveCurrentMapPicker({
results: Array<{ winnerTeamId: number }>;
opponentIds: [number, number] | null;
pickBan: TournamentRoundMaps["pickBan"] | null;
}): { teamId: number; kind: "PICK" | "COUNTERPICK" } | null {
}):
| { teamId: number; kind: "PICK" | "COUNTERPICK" }
| { teamIds: [number, number]; kind: "BOTH" }
| null {
if (!opponentIds) return null;
if (typeof source === "number") {
@ -312,6 +327,10 @@ function resolveCurrentMapPicker({
return { teamId: source, kind: "PICK" };
}
if (source === "BOTH") {
return { teamIds: opponentIds, kind: "BOTH" };
}
if (
source === "COUNTERPICK" &&
(pickBan === "COUNTERPICK" || pickBan === "COUNTERPICK_MODE_REPEAT_OK")