import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators.js"; import { PlayerGame } from "../../../../core/ApiSchemas"; import { GameMode } from "../../../../core/game/Game"; import { GameInfoModal } from "../../../GameInfoModal"; import { translateText } from "../../../Utils"; import "../../CopyButton"; @customElement("game-list") export class GameList extends LitElement { createRenderRoot() { return this; } @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; } private showRanking(gameId: string) { const gameInfoModal = document.querySelector( "game-info-modal", ) as GameInfoModal; if (!gameInfoModal) { console.warn("Game info modal element not found"); } else { gameInfoModal.loadGame(gameId); gameInfoModal.open(); } } render() { return html`