diff --git a/resources/lang/en.json b/resources/lang/en.json index ff4251dff..4f41c9347 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -647,5 +647,18 @@ "radial_menu": { "delete_unit_title": "Delete Unit", "delete_unit_description": "Click to delete the nearest unit" + }, + "game_list": { + "recent_games": "Recent Games", + "game_id": "Game ID", + "mode": "Mode", + "mode_ffa": "Free-for-All", + "mode_team": "Team", + "view": "View", + "details": "Details", + "started": "Started", + "map": "Map", + "difficulty": "Difficulty", + "type": "Type" } } diff --git a/src/client/components/baseComponents/stats/GameList.ts b/src/client/components/baseComponents/stats/GameList.ts new file mode 100644 index 000000000..83b50489b --- /dev/null +++ b/src/client/components/baseComponents/stats/GameList.ts @@ -0,0 +1,150 @@ +import { LitElement, css, html } from "lit"; +import { customElement, property, state } from "lit/decorators.js"; +import { PlayerGame } from "../../../../core/ApiSchemas"; +import { GameMode } from "../../../../core/game/Game"; +import { translateText } from "../../../Utils"; + +@customElement("game-list") +export class GameList extends LitElement { + static styles = css` + .section-title { + color: #888; + font-size: 1rem; + font-weight: bold; + margin-bottom: 0.5rem; + } + .card { + background: rgba(255, 255, 255, 0.05); + border: 1px solid rgba(255, 255, 255, 0.1); + border-radius: 0.5rem; + overflow: hidden; + transition: all 0.3s ease; + } + .row { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0.5rem 1rem; + } + .title { + font-size: 0.875rem; + font-weight: 600; + color: white; + } + .subtle { + font-size: 0.75rem; + color: #9ca3af; + } + .btn { + font-size: 0.875rem; + color: #d1d5db; + background: #374151; + padding: 0.25rem 0.75rem; + border-radius: 0.25rem; + } + .btn.secondary { + background: #4b5563; + } + .details { + padding: 0 1rem 0.5rem 1rem; + font-size: 0.75rem; + color: #d1d5db; + transition: all 0.3s ease; + } + `; + + @property({ type: Array }) games: PlayerGame[] = []; + @property({ attribute: false }) onViewGame?: (id: string) => void; + + @state() private expandedGameId: string | null = null; + + private toggle(gameId: string) { + this.expandedGameId = this.expandedGameId === gameId ? null : gameId; + } + + render() { + return html`
+
+
+ 🎮 ${translateText("game_list.recent_games")} +
+
+ ${this.games.map( + (game) => html` +
+
+
+
+ ${translateText("game_list.game_id")}: ${game.gameId} +
+
+ ${translateText("game_list.mode")}: + ${game.mode === GameMode.FFA + ? translateText("game_list.mode_ffa") + : html`${translateText("game_list.mode_team")}`} +
+
+
+ + +
+
+
+
+ ${translateText("game_list.started")}: + ${new Date(game.start).toLocaleString()} +
+
+ ${translateText("game_list.mode")}: + ${game.mode === GameMode.FFA + ? translateText("game_list.mode_ffa") + : translateText("game_list.mode_team")} +
+
+ ${translateText("game_list.map")}: + ${game.map} +
+
+ ${translateText("game_list.difficulty")}: + ${game.difficulty} +
+
+ ${translateText("game_list.type")}: + ${game.type} +
+
+
+ `, + )} +
+
+
`; + } +}