mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-07-16 08:27:05 -05:00
Show "BOTH" maplist source on match banner as two team avatars
This commit is contained in:
parent
d3100971c6
commit
d3a475a1de
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user