diff --git a/src/client/components/Maps.ts b/src/client/components/Maps.ts index f4f111f65..a4dd9cea6 100644 --- a/src/client/components/Maps.ts +++ b/src/client/components/Maps.ts @@ -1,6 +1,7 @@ import { LitElement, html, css } from "lit"; import { customElement, property } from "lit/decorators.js"; import { GameMapType } from "../../core/game/Game"; +import { getMapsImage } from "../utilities/Maps"; // Add map descriptions export const MapDescription: Record = { @@ -13,14 +14,6 @@ export const MapDescription: Record = { Africa: "Africa", }; -import world from "../../../resources/maps/WorldMap.png"; -import oceania from "../../../resources/maps/Oceania.png"; -import europe from "../../../resources/maps/Europe.png"; -import mena from "../../../resources/maps/Mena.png"; -import northAmerica from "../../../resources/maps/NorthAmerica.png"; -import blackSea from "../../../resources/maps/BlackSea.png"; -import africa from "../../../resources/maps/Africa.png"; - @customElement("map-display") export class MapDisplay extends LitElement { @property({ type: String }) mapKey = ""; @@ -75,35 +68,14 @@ export class MapDisplay extends LitElement { } `; - private getMapsImage(map: GameMapType): string { - switch (map) { - case GameMapType.World: - return world; - case GameMapType.Oceania: - return oceania; - case GameMapType.Europe: - return europe; - case GameMapType.Mena: - return mena; - case GameMapType.NorthAmerica: - return northAmerica; - case GameMapType.BlackSea: - return blackSea; - case GameMapType.Africa: - return africa; - default: - return ""; - } - } - render() { const mapValue = GameMapType[this.mapKey as keyof typeof GameMapType]; return html`
- ${this.getMapsImage(mapValue) + ${getMapsImage(mapValue) ? html`${this.mapKey}`