diff --git a/src/client/graphics/layers/PlayerPanel.ts b/src/client/graphics/layers/PlayerPanel.ts index 6a60675d20..f869c72e1d 100644 --- a/src/client/graphics/layers/PlayerPanel.ts +++ b/src/client/graphics/layers/PlayerPanel.ts @@ -491,12 +491,17 @@ export class PlayerPanel extends LitElement implements Layer { `; } - private renderIdentityRow(other: PlayerView, my: PlayerView) { - const flagCode = other.cosmetics.flag; - const country = - typeof flagCode === "string" - ? Countries.find((c) => c.code === flagCode) - : undefined; + private renderIdentityRow( + other: PlayerView, + my: PlayerView, + ) { + const activeFlagPath = other.cosmetics.flag + const flagCode = activeFlagPath?.match(/\/([^.]+)\./)?.[1]; + + // Find the country based on that code + const country = flagCode + ? Countries.find((c) => c.code === flagCode.split("/")[1]) + : flagCode; const chip = other.type() === PlayerType.Human @@ -505,10 +510,11 @@ export class PlayerPanel extends LitElement implements Layer { return html`
- ${country && typeof flagCode === "string" + ${activeFlagPath ? html`${country?.name { (e.target as HTMLImageElement).style.display = "none"; @@ -946,7 +952,9 @@ export class PlayerPanel extends LitElement implements Layer { class="p-6 flex flex-col gap-2 font-sans antialiased text-[14.5px] leading-relaxed" > -
${this.renderIdentityRow(other, my)}
+
+ ${this.renderIdentityRow(other, my)} +
${this.sendTarget ? html`