Skip to content

Commit 55b6689

Browse files
committed
style: fix prettier formatting
1 parent 7c23c69 commit 55b6689

File tree

4 files changed

+85
-44
lines changed

4 files changed

+85
-44
lines changed

src/client/InputHandler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,9 @@ export class InputHandler {
598598
this.setGhostStructure(null);
599599
return;
600600
}
601-
this.eventBus.emit(new ContextMenuEvent(event.clientX, event.clientY, true));
601+
this.eventBus.emit(
602+
new ContextMenuEvent(event.clientX, event.clientY, true),
603+
);
602604
}
603605

604606
private setGhostStructure(ghostStructure: PlayerBuildableUnitType | null) {

src/client/graphics/GameRenderer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ import { NukeTrajectoryPreviewLayer } from "./layers/NukeTrajectoryPreviewLayer"
3232
import { PerformanceOverlay } from "./layers/PerformanceOverlay";
3333
import { PlayerInfoOverlay } from "./layers/PlayerInfoOverlay";
3434
import { PlayerPanel } from "./layers/PlayerPanel";
35+
import { QuickChatConfigModal } from "./layers/QuickChatConfigModal";
3536
import { RailroadLayer } from "./layers/RailroadLayer";
3637
import { ReplayPanel } from "./layers/ReplayPanel";
3738
import { SAMRadiusLayer } from "./layers/SAMRadiusLayer";
3839
import { SettingsModal } from "./layers/SettingsModal";
3940
import { SpawnTimer } from "./layers/SpawnTimer";
4041
import { StructureIconsLayer } from "./layers/StructureIconsLayer";
4142
import { StructureLayer } from "./layers/StructureLayer";
43+
import { TargetSelectionLayer } from "./layers/TargetSelectionLayer";
4244
import { TeamStats } from "./layers/TeamStats";
4345
import { TerrainLayer } from "./layers/TerrainLayer";
4446
import { TerritoryLayer } from "./layers/TerritoryLayer";
4547
import { UILayer } from "./layers/UILayer";
4648
import { UnitDisplay } from "./layers/UnitDisplay";
4749
import { UnitLayer } from "./layers/UnitLayer";
4850
import { WinModal } from "./layers/WinModal";
49-
import { QuickChatConfigModal } from "./layers/QuickChatConfigModal";
50-
import { TargetSelectionLayer } from "./layers/TargetSelectionLayer";
5151

5252
export function createRenderer(
5353
canvas: HTMLCanvasElement,

src/client/graphics/layers/QuickChatConfigModal.ts

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { LitElement, html } from "lit";
22
import { customElement, query, state } from "lit/decorators.js";
3+
import { translateText } from "../../Utils";
34
import { quickChatPhrases } from "./ChatModal";
45
import {
56
DEFAULT_PRESETS,
67
PresetSlot,
78
QuickChatPresetService,
89
} from "./QuickChatPresetService";
9-
import { translateText } from "../../Utils";
1010

1111
const MAX_SLOTS = 5;
1212

@@ -159,64 +159,89 @@ export class QuickChatConfigModal extends LitElement {
159159
return html`
160160
<o-modal title="${translateText("quick_chat.configure_presets")}">
161161
<div class="chat-columns">
162-
163162
<!-- Column 1: preset slots -->
164163
<div class="chat-column">
165-
<div class="column-title">${translateText("quick_chat.preset_label")}</div>
164+
<div class="column-title">
165+
${translateText("quick_chat.preset_label")}
166+
</div>
166167
167168
${this.slots.map(
168169
(slot, i) => html`
169170
<div style="display:flex;gap:4px;">
170171
<button
171-
class="chat-option-button ${this.editingIndex === i ? "selected" : ""}"
172+
class="chat-option-button ${this.editingIndex === i
173+
? "selected"
174+
: ""}"
172175
style="flex:1;"
173176
@click=${() => this.selectSlot(i)}
174-
>${i + 1}. ${this.slotLabel(slot)}</button>
177+
>
178+
${i + 1}. ${this.slotLabel(slot)}
179+
</button>
175180
${this.slots.length > 1
176181
? html`<button
177182
class="chat-option-button"
178183
style="padding:8px 10px;"
179-
@click=${(e: Event) => { e.stopPropagation(); this.removeSlot(i); }}
180-
></button>`
184+
@click=${(e: Event) => {
185+
e.stopPropagation();
186+
this.removeSlot(i);
187+
}}
188+
>
189+
190+
</button>`
181191
: null}
182192
</div>
183193
`,
184194
)}
185-
186195
${this.slots.length < MAX_SLOTS
187-
? html`<button
188-
class="chat-option-button"
189-
@click=${this.addSlot}
190-
>${translateText("quick_chat.add_preset")}</button>`
196+
? html`<button class="chat-option-button" @click=${this.addSlot}>
197+
${translateText("quick_chat.add_preset")}
198+
</button>`
191199
: null}
192200
</div>
193201
194202
<!-- Column 2: category + actions -->
195203
${editing !== null
196204
? html`
197205
<div class="chat-column">
198-
<div class="column-title">${translateText("chat.category")}</div>
206+
<div class="column-title">
207+
${translateText("chat.category")}
208+
</div>
199209
200210
${categories.map(
201211
(cat) => html`
202212
<button
203-
class="chat-option-button ${this.selectedCategory === cat ? "selected" : ""}"
213+
class="chat-option-button ${this.selectedCategory ===
214+
cat
215+
? "selected"
216+
: ""}"
204217
@click=${() => this.selectCategory(cat)}
205-
>${translateText(`chat.cat.${cat}`)}</button>
218+
>
219+
${translateText(`chat.cat.${cat}`)}
220+
</button>
206221
`,
207222
)}
208223
209-
<div class="column-title" style="margin-top:8px;">${translateText("quick_chat.actions")}</div>
224+
<div class="column-title" style="margin-top:8px;">
225+
${translateText("quick_chat.actions")}
226+
</div>
210227
211228
<button
212-
class="chat-option-button ${editing.type === "emoji" ? "selected" : ""}"
229+
class="chat-option-button ${editing.type === "emoji"
230+
? "selected"
231+
: ""}"
213232
@click=${() => this.assignSpecial("emoji")}
214-
>${translateText("quick_chat.emoji_panel")}</button>
233+
>
234+
${translateText("quick_chat.emoji_panel")}
235+
</button>
215236
216237
<button
217-
class="chat-option-button ${editing.type === "trade" ? "selected" : ""}"
238+
class="chat-option-button ${editing.type === "trade"
239+
? "selected"
240+
: ""}"
218241
@click=${() => this.assignSpecial("trade")}
219-
>${translateText("quick_chat.trade_toggle")}</button>
242+
>
243+
${translateText("quick_chat.trade_toggle")}
244+
</button>
220245
</div>
221246
`
222247
: null}
@@ -225,7 +250,9 @@ export class QuickChatConfigModal extends LitElement {
225250
${editing !== null && this.selectedCategory
226251
? html`
227252
<div class="chat-column">
228-
<div class="column-title">${translateText("chat.phrase")}</div>
253+
<div class="column-title">
254+
${translateText("chat.phrase")}
255+
</div>
229256
<div class="phrase-scroll-area">
230257
${(quickChatPhrases[this.selectedCategory] ?? []).map(
231258
(phrase) => {
@@ -238,7 +265,9 @@ export class QuickChatConfigModal extends LitElement {
238265
editing.key === phrase.key;
239266
return html`
240267
<button
241-
class="chat-option-button ${isActive ? "selected" : ""}"
268+
class="chat-option-button ${isActive
269+
? "selected"
270+
: ""}"
242271
@click=${() =>
243272
this.assignQcPhrase(
244273
this.selectedCategory!,
@@ -247,7 +276,10 @@ export class QuickChatConfigModal extends LitElement {
247276
>
248277
${label}
249278
${phrase.requiresPlayer
250-
? html`<span style="font-size:10px;opacity:0.4;margin-left:4px;">[needs target]</span>`
279+
? html`<span
280+
style="font-size:10px;opacity:0.4;margin-left:4px;"
281+
>[needs target]</span
282+
>`
251283
: null}
252284
</button>
253285
`;
@@ -261,7 +293,9 @@ export class QuickChatConfigModal extends LitElement {
261293
262294
<div class="chat-preview" style="font-size:12px;color:#aaa;">
263295
${editing !== null
264-
? translateText("quick_chat.editing_hint", { n: (this.editingIndex ?? 0) + 1 })
296+
? translateText("quick_chat.editing_hint", {
297+
n: (this.editingIndex ?? 0) + 1,
298+
})
265299
: translateText("quick_chat.select_hint")}
266300
</div>
267301
@@ -273,9 +307,11 @@ export class QuickChatConfigModal extends LitElement {
273307
class="chat-option-button"
274308
style="${this.confirmReset ? "color:#f87171;" : "opacity:0.45;"}"
275309
@click=${this.reset}
276-
>${this.confirmReset
277-
? translateText("quick_chat.confirm_reset")
278-
: translateText("quick_chat.reset_defaults")}</button>
310+
>
311+
${this.confirmReset
312+
? translateText("quick_chat.confirm_reset")
313+
: translateText("quick_chat.reset_defaults")}
314+
</button>
279315
</div>
280316
</o-modal>
281317
`;

src/client/graphics/layers/RadialMenuElements.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import { Emoji, findClosestBy, flattenedEmojiTable } from "../../../core/Util";
1414
import { renderNumber, translateText } from "../../Utils";
1515
import { UIState } from "../UIState";
1616
import { BuildItemDisplay, BuildMenu, flattenedBuildTable } from "./BuildMenu";
17-
import { quickChatPhrases } from "./ChatModal";
1817
import { ChatIntegration } from "./ChatIntegration";
18+
import { quickChatPhrases } from "./ChatModal";
1919
import { EmojiTable } from "./EmojiTable";
2020
import { PlayerActionHandler } from "./PlayerActionHandler";
2121
import { PlayerPanel } from "./PlayerPanel";
22+
import { PresetSlot, QuickChatPresetService } from "./QuickChatPresetService";
2223
import { TooltipItem } from "./RadialMenu";
23-
import { QuickChatPresetService, PresetSlot } from "./QuickChatPresetService";
2424
import { TargetSelectionMode } from "./TargetSelectionMode";
2525

2626
import { EventBus } from "../../../core/EventBus";
@@ -375,14 +375,13 @@ const infoEmojiElement: MenuElement = {
375375

376376
/** Shortens a phrase label to fit inside a radial menu arc segment. */
377377
function shortenPresetText(text: string, maxLength = 15): string {
378-
return text.length <= maxLength ? text : text.substring(0, maxLength - 3) + "...";
378+
return text.length <= maxLength
379+
? text
380+
: text.substring(0, maxLength - 3) + "...";
379381
}
380382

381383
/** Builds a single MenuElement from a PresetSlot at runtime. */
382-
function buildPresetItem(
383-
slot: PresetSlot,
384-
recipient: PlayerView,
385-
): MenuElement {
384+
function buildPresetItem(slot: PresetSlot, recipient: PlayerView): MenuElement {
386385
// --- Quick Chat ---
387386
if (slot.type === "quickchat" && slot.category && slot.key) {
388387
const phrase = quickChatPhrases[slot.category]?.find(
@@ -441,10 +440,11 @@ function buildPresetItem(
441440
return {
442441
id: "preset-trade-toggle",
443442
name: "trade",
444-
disabled: (p: MenuElementParams) =>
445-
p.selected === null,
443+
disabled: (p: MenuElementParams) => p.selected === null,
446444
color: (p: MenuElementParams) =>
447-
p.playerActions?.interaction?.canEmbargo ? COLORS.embargo : COLORS.trade,
445+
p.playerActions?.interaction?.canEmbargo
446+
? COLORS.embargo
447+
: COLORS.trade,
448448
text: (p: MenuElementParams) => {
449449
const label = p.playerActions?.interaction?.canEmbargo
450450
? translateText("player_panel.stop_trade")
@@ -493,9 +493,7 @@ export const infoMenuElement: MenuElement = {
493493
const recipient = params.selected;
494494
const presets = QuickChatPresetService.getInstance().load();
495495

496-
const presetItems = presets.map((slot) =>
497-
buildPresetItem(slot, recipient),
498-
);
496+
const presetItems = presets.map((slot) => buildPresetItem(slot, recipient));
499497

500498
// Permanent: open the player info panel (original Info button behaviour)
501499
const playerInfoItem: MenuElement = {
@@ -517,7 +515,12 @@ export const infoMenuElement: MenuElement = {
517515
disabled: () => false,
518516
icon: settingsIcon,
519517
color: COLORS.infoDetails,
520-
tooltipItems: [{ text: translateText("quick_chat.configure_presets"), className: "title" }],
518+
tooltipItems: [
519+
{
520+
text: translateText("quick_chat.configure_presets"),
521+
className: "title",
522+
},
523+
],
521524
action: (p: MenuElementParams) => {
522525
const modal = document.querySelector("quick-chat-config-modal") as any;
523526
if (modal) {

0 commit comments

Comments
 (0)