From 1fa2685495cde05c25f4c3ab05cb85c1a4022c66 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Wed, 3 Sep 2025 19:32:35 -0700 Subject: [PATCH] format using prettier --- src/client/graphics/layers/PlayerPanel.ts | 14 +++++++++++--- src/client/graphics/layers/RadialMenu.ts | 19 +++++++++++++------ src/client/graphics/layers/TeamStats.ts | 4 +++- src/core/execution/FakeHumanExecution.ts | 14 ++++++++++---- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/client/graphics/layers/PlayerPanel.ts b/src/client/graphics/layers/PlayerPanel.ts index 0f049a7cd..8bdfaa34c 100644 --- a/src/client/graphics/layers/PlayerPanel.ts +++ b/src/client/graphics/layers/PlayerPanel.ts @@ -13,6 +13,7 @@ import { AllPlayers, PlayerActions } from "../../../core/game/Game"; import { TileRef } from "../../../core/game/GameMap"; import { GameView, PlayerView } from "../../../core/game/GameView"; import { flattenedEmojiTable } from "../../../core/Util"; +import Countries from "../../data/countries.json"; import { CloseViewEvent, MouseUpEvent } from "../../InputHandler"; import { SendAllianceRequestIntentEvent, @@ -26,7 +27,6 @@ import { import { renderNumber, renderTroops } from "../../Utils"; import { UIState } from "../UIState"; import { ChatModal } from "./ChatModal"; -import Countries from "../../data/countries.json"; import { EmojiTable } from "./EmojiTable"; import { Layer } from "./Layer"; @@ -247,7 +247,10 @@ export class PlayerPanel extends LitElement implements Layer { //flag icon in the playerPanel const flagCode = other.cosmetics.flag; - const country = typeof flagCode === "string" ? Countries.find((c) => c.code === flagCode) : undefined; + const country = + typeof flagCode === "string" + ? Countries.find((c) => c.code === flagCode) + : undefined; const flagName = country?.name; return html` @@ -295,7 +298,12 @@ export class PlayerPanel extends LitElement implements Layer { bg-opacity-50 bg-gray-700 text-opacity-90 text-white rounded text-sm lg:text-xl w-full" > - ${flagName} + ${flagName} + ` diff --git a/src/client/graphics/layers/RadialMenu.ts b/src/client/graphics/layers/RadialMenu.ts index ad40dca6d..84444afd3 100644 --- a/src/client/graphics/layers/RadialMenu.ts +++ b/src/client/graphics/layers/RadialMenu.ts @@ -149,7 +149,10 @@ export class RadialMenu implements Layer { .style("position", "absolute") .style("top", "50%") .style("left", "50%") - .style("transition", `top ${this.config.menuTransitionDuration}ms ease, left ${this.config.menuTransitionDuration}ms ease`) + .style( + "transition", + `top ${this.config.menuTransitionDuration}ms ease, left ${this.config.menuTransitionDuration}ms ease`, + ) .style("transform", "translate(-50%, -50%)") .style("pointer-events", "all") .on("click", (event) => this.hideRadialMenu()); @@ -1053,13 +1056,17 @@ export class RadialMenu implements Layer { const vh = window.innerHeight; // If the menu cannot fully fit on an axis, pin it to the viewport center on that axis. - const clampedX = 2 * margin > vw ? vw / 2 : Math.min(Math.max(this.anchorX, margin), vw - margin); - const clampedY = 2 * margin > vh ? vh / 2 : Math.min(Math.max(this.anchorY, margin), vh - margin); + const clampedX = + 2 * margin > vw + ? vw / 2 + : Math.min(Math.max(this.anchorX, margin), vw - margin); + const clampedY = + 2 * margin > vh + ? vh / 2 + : Math.min(Math.max(this.anchorY, margin), vh - margin); const svgSel = this.menuElement.select("svg"); - svgSel - .style("top", `${clampedY}px`) - .style("left", `${clampedX}px`); + svgSel.style("top", `${clampedY}px`).style("left", `${clampedX}px`); } private handleResize = () => { diff --git a/src/client/graphics/layers/TeamStats.ts b/src/client/graphics/layers/TeamStats.ts index a1191989c..e22ce57f7 100644 --- a/src/client/graphics/layers/TeamStats.ts +++ b/src/client/graphics/layers/TeamStats.ts @@ -207,7 +207,9 @@ export class TeamStats extends LitElement implements Layer { this.requestUpdate(); }} > - ${this.showUnits ? translateText("leaderboard.show_control") : translateText("leaderboard.show_units")} + ${this.showUnits + ? translateText("leaderboard.show_control") + : translateText("leaderboard.show_units")} `; diff --git a/src/core/execution/FakeHumanExecution.ts b/src/core/execution/FakeHumanExecution.ts index 9692a14cb..e9750f748 100644 --- a/src/core/execution/FakeHumanExecution.ts +++ b/src/core/execution/FakeHumanExecution.ts @@ -474,7 +474,7 @@ export class FakeHumanExecution implements Execution { return bestTile; } - private * arraySampler(a: T[], sampleSize = 50): Generator { + private *arraySampler(a: T[], sampleSize = 50): Generator { if (a.length <= sampleSize) { // Return all elements yield* a; @@ -495,7 +495,9 @@ export class FakeHumanExecution implements Execution { const mg = this.mg; const otherUnits = this.player.units(type); // Prefer spacing structures out of atom bomb range - const borderSpacing = this.mg.config().nukeMagnitudes(UnitType.AtomBomb).outer; + const borderSpacing = this.mg + .config() + .nukeMagnitudes(UnitType.AtomBomb).outer; const structureSpacing = borderSpacing * 2; switch (type) { case UnitType.Port: @@ -503,7 +505,9 @@ export class FakeHumanExecution implements Execution { let w = 0; // Prefer to be far away from other structures of the same type - const otherTiles: Set = new Set(otherUnits.map((u) => u.tile())); + const otherTiles: Set = new Set( + otherUnits.map((u) => u.tile()), + ); otherTiles.delete(tile); const closestOther = closestTwoTiles(mg, otherTiles, [tile]); if (closestOther !== null) { @@ -530,7 +534,9 @@ export class FakeHumanExecution implements Execution { } // Prefer to be away from other structures of the same type - const otherTiles: Set = new Set(otherUnits.map((u) => u.tile())); + const otherTiles: Set = new Set( + otherUnits.map((u) => u.tile()), + ); otherTiles.delete(tile); const closestOther = closestTwoTiles(mg, otherTiles, [tile]); if (closestOther !== null) {