mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:40:46 +00:00
715775065d
## Description: waiting https://github.com/openfrontio/OpenFrontIO/pull/2088 This PR adds the game-list component, which displays player-stats-table and wlr. It provides basic functionality such as toggling details and viewing a specific game, but does not yet include full UI integration. In later PRs, this component will be shown together with the modal for viewing player stats. It should look like this: <img width="218" height="515" alt="スクリーンショット 2025-09-26 16 23 00" src="https://github.com/user-attachments/assets/e0aa4cc6-e3c5-4b91-9331-a1d90222ae9e" /> ## 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 ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri --------- Co-authored-by: evanpelle <evanpelle@gmail.com>
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { LitElement, css, html } from "lit";
|
|
import { customElement, property } from "lit/decorators.js";
|
|
|
|
@customElement("player-stats-grid")
|
|
export class PlayerStatsGrid extends LitElement {
|
|
static styles = css`
|
|
.grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 1rem;
|
|
}
|
|
@media (min-width: 640px) {
|
|
.grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
}
|
|
.stat {
|
|
text-align: center;
|
|
color: white;
|
|
font-size: 1rem;
|
|
}
|
|
.stat-title {
|
|
color: #bbb;
|
|
font-size: 0.9rem;
|
|
}
|
|
.stat-value {
|
|
font-size: 1.25rem;
|
|
font-weight: bold;
|
|
}
|
|
`;
|
|
|
|
@property({ type: Array }) titles: string[] = [];
|
|
@property({ type: Array }) values: Array<string | number> = [];
|
|
|
|
// Currently fixed to display 4 stats (can be changed if needed)
|
|
private readonly VISIBLE_STATS_COUNT = 4;
|
|
|
|
render() {
|
|
return html`
|
|
<div class="grid mb-2">
|
|
${Array(this.VISIBLE_STATS_COUNT)
|
|
.fill(0)
|
|
.map(
|
|
(_, i) => html`
|
|
<div class="stat">
|
|
<div class="stat-value">${this.values[i] ?? ""}</div>
|
|
<div class="stat-title">${this.titles[i] ?? ""}</div>
|
|
</div>
|
|
`,
|
|
)}
|
|
</div>
|
|
`;
|
|
}
|
|
}
|