Skip to content

Commit 1fa2685

Browse files
committed
format using prettier
1 parent fc8e663 commit 1fa2685

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

src/client/graphics/layers/PlayerPanel.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { AllPlayers, PlayerActions } from "../../../core/game/Game";
1313
import { TileRef } from "../../../core/game/GameMap";
1414
import { GameView, PlayerView } from "../../../core/game/GameView";
1515
import { flattenedEmojiTable } from "../../../core/Util";
16+
import Countries from "../../data/countries.json";
1617
import { CloseViewEvent, MouseUpEvent } from "../../InputHandler";
1718
import {
1819
SendAllianceRequestIntentEvent,
@@ -26,7 +27,6 @@ import {
2627
import { renderNumber, renderTroops } from "../../Utils";
2728
import { UIState } from "../UIState";
2829
import { ChatModal } from "./ChatModal";
29-
import Countries from "../../data/countries.json";
3030
import { EmojiTable } from "./EmojiTable";
3131
import { Layer } from "./Layer";
3232

@@ -247,7 +247,10 @@ export class PlayerPanel extends LitElement implements Layer {
247247

248248
//flag icon in the playerPanel
249249
const flagCode = other.cosmetics.flag;
250-
const country = typeof flagCode === "string" ? Countries.find((c) => c.code === flagCode) : undefined;
250+
const country =
251+
typeof flagCode === "string"
252+
? Countries.find((c) => c.code === flagCode)
253+
: undefined;
251254
const flagName = country?.name;
252255

253256
return html`
@@ -295,7 +298,12 @@ export class PlayerPanel extends LitElement implements Layer {
295298
bg-opacity-50 bg-gray-700 text-opacity-90 text-white
296299
rounded text-sm lg:text-xl w-full"
297300
>
298-
${flagName} <img src="/flags/${flagCode}.svg" width=60 height=60>
301+
${flagName}
302+
<img
303+
src="/flags/${flagCode}.svg"
304+
width="60"
305+
height="60"
306+
/>
299307
</div>
300308
</div>
301309
`

src/client/graphics/layers/RadialMenu.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ export class RadialMenu implements Layer {
149149
.style("position", "absolute")
150150
.style("top", "50%")
151151
.style("left", "50%")
152-
.style("transition", `top ${this.config.menuTransitionDuration}ms ease, left ${this.config.menuTransitionDuration}ms ease`)
152+
.style(
153+
"transition",
154+
`top ${this.config.menuTransitionDuration}ms ease, left ${this.config.menuTransitionDuration}ms ease`,
155+
)
153156
.style("transform", "translate(-50%, -50%)")
154157
.style("pointer-events", "all")
155158
.on("click", (event) => this.hideRadialMenu());
@@ -1053,13 +1056,17 @@ export class RadialMenu implements Layer {
10531056
const vh = window.innerHeight;
10541057

10551058
// If the menu cannot fully fit on an axis, pin it to the viewport center on that axis.
1056-
const clampedX = 2 * margin > vw ? vw / 2 : Math.min(Math.max(this.anchorX, margin), vw - margin);
1057-
const clampedY = 2 * margin > vh ? vh / 2 : Math.min(Math.max(this.anchorY, margin), vh - margin);
1059+
const clampedX =
1060+
2 * margin > vw
1061+
? vw / 2
1062+
: Math.min(Math.max(this.anchorX, margin), vw - margin);
1063+
const clampedY =
1064+
2 * margin > vh
1065+
? vh / 2
1066+
: Math.min(Math.max(this.anchorY, margin), vh - margin);
10581067

10591068
const svgSel = this.menuElement.select("svg");
1060-
svgSel
1061-
.style("top", `${clampedY}px`)
1062-
.style("left", `${clampedX}px`);
1069+
svgSel.style("top", `${clampedY}px`).style("left", `${clampedX}px`);
10631070
}
10641071

10651072
private handleResize = () => {

src/client/graphics/layers/TeamStats.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ export class TeamStats extends LitElement implements Layer {
207207
this.requestUpdate();
208208
}}
209209
>
210-
${this.showUnits ? translateText("leaderboard.show_control") : translateText("leaderboard.show_units")}
210+
${this.showUnits
211+
? translateText("leaderboard.show_control")
212+
: translateText("leaderboard.show_units")}
211213
</button>
212214
</div>
213215
`;

src/core/execution/FakeHumanExecution.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ export class FakeHumanExecution implements Execution {
474474
return bestTile;
475475
}
476476

477-
private * arraySampler<T>(a: T[], sampleSize = 50): Generator<T> {
477+
private *arraySampler<T>(a: T[], sampleSize = 50): Generator<T> {
478478
if (a.length <= sampleSize) {
479479
// Return all elements
480480
yield* a;
@@ -495,15 +495,19 @@ export class FakeHumanExecution implements Execution {
495495
const mg = this.mg;
496496
const otherUnits = this.player.units(type);
497497
// Prefer spacing structures out of atom bomb range
498-
const borderSpacing = this.mg.config().nukeMagnitudes(UnitType.AtomBomb).outer;
498+
const borderSpacing = this.mg
499+
.config()
500+
.nukeMagnitudes(UnitType.AtomBomb).outer;
499501
const structureSpacing = borderSpacing * 2;
500502
switch (type) {
501503
case UnitType.Port:
502504
return (tile) => {
503505
let w = 0;
504506

505507
// Prefer to be far away from other structures of the same type
506-
const otherTiles: Set<TileRef> = new Set(otherUnits.map((u) => u.tile()));
508+
const otherTiles: Set<TileRef> = new Set(
509+
otherUnits.map((u) => u.tile()),
510+
);
507511
otherTiles.delete(tile);
508512
const closestOther = closestTwoTiles(mg, otherTiles, [tile]);
509513
if (closestOther !== null) {
@@ -530,7 +534,9 @@ export class FakeHumanExecution implements Execution {
530534
}
531535

532536
// Prefer to be away from other structures of the same type
533-
const otherTiles: Set<TileRef> = new Set(otherUnits.map((u) => u.tile()));
537+
const otherTiles: Set<TileRef> = new Set(
538+
otherUnits.map((u) => u.tile()),
539+
);
534540
otherTiles.delete(tile);
535541
const closestOther = closestTwoTiles(mg, otherTiles, [tile]);
536542
if (closestOther !== null) {

0 commit comments

Comments
 (0)