mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-11 05:28:25 +00:00
0a40bcebf0
## Description: Enable the `sort-imports` eslint rule. Fixes #1784 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { LitElement, html } from "lit";
|
|
import { customElement, state } from "lit/decorators.js";
|
|
import { GameView } from "../../../core/game/GameView";
|
|
import { Layer } from "./Layer";
|
|
import { translateText } from "../../Utils";
|
|
|
|
@customElement("heads-up-message")
|
|
export class HeadsUpMessage extends LitElement implements Layer {
|
|
public game: GameView;
|
|
|
|
@state()
|
|
private isVisible = false;
|
|
|
|
createRenderRoot() {
|
|
return this;
|
|
}
|
|
|
|
init() {
|
|
this.isVisible = true;
|
|
this.requestUpdate();
|
|
}
|
|
|
|
tick() {
|
|
if (!this.game.inSpawnPhase()) {
|
|
this.isVisible = false;
|
|
this.requestUpdate();
|
|
}
|
|
}
|
|
|
|
render() {
|
|
if (!this.isVisible) {
|
|
return html``;
|
|
}
|
|
|
|
return html`
|
|
<div
|
|
class="flex items-center relative
|
|
w-full justify-evenly h-8 lg:h-10 md:top-[70px] left-0 lg:left-4
|
|
bg-opacity-60 bg-gray-900 rounded-md lg:rounded-lg
|
|
backdrop-blur-md text-white text-md lg:text-xl p-1 lg:p-2"
|
|
@contextmenu=${(e: MouseEvent) => e.preventDefault()}
|
|
>
|
|
${translateText("heads_up_message.choose_spawn")}
|
|
</div>
|
|
`;
|
|
}
|
|
}
|