- ${ffa ? this.renderLobbyCard(ffa, this.getLobbyTitle(ffa)) : nothing}
- ${teams
- ? this.renderLobbyCard(teams, this.getLobbyTitle(teams))
+
+
+ ${featured
+ ? html`
+ ${this.renderFeaturedLobbyCard(
+ featured,
+ this.getLobbyTitleContent(featured),
+ )}
+
+ ${upcoming.map((lobby) =>
+ this.renderUpcomingLobbyCard(
+ lobby,
+ this.getLobbyTitleContent(lobby),
+ ),
+ )}
+
+
`
: nothing}
- ${special ? this.renderSpecialLobbyCard(special) : nothing}
- ${this.renderQuickActionsSection()}
+
+
+
${this.renderSingleplayerButton()}
+
+
+
${this.renderSecondaryActions()}
`;
}
- private renderSpecialLobbyCard(lobby: PublicGameInfo) {
- const subtitle = this.getLobbyTitle(lobby);
- const mainTitle = translateText("mode_selector.special_title");
- const titleContent = subtitle
- ? html`
-
- `
- : mainTitle;
- return this.renderLobbyCard(lobby, titleContent);
+ private renderSingleplayerButton() {
+ return html`
+
+ `;
}
- private renderQuickActionsSection() {
+ private renderSecondaryActions() {
return html`
-
-
- ${this.renderSmallActionCard(
- translateText("main.solo"),
- this.openSinglePlayerModal,
- )}
- ${this.renderSmallActionCard(
- translateText("mode_selector.ranked_title"),
- this.openRankedMenu,
- )}
-
-
- ${this.renderSmallActionCard(
- translateText("main.create"),
- this.openHostLobby,
- )}
- ${this.renderSmallActionCard(
- translateText("main.join"),
- this.openJoinLobby,
- )}
-
+
+ ${this.renderSmallActionCard(
+ translateText("mode_selector.ranked_title"),
+ this.openRankedMenu,
+ )}
+ ${this.renderSmallActionCard(
+ translateText("main.create"),
+ this.openHostLobby,
+ )}
+ ${this.renderSmallActionCard(
+ translateText("main.join"),
+ this.openJoinLobby,
+ )}
`;
}
@@ -161,18 +192,92 @@ export class GameModeSelector extends LitElement {
(document.querySelector("join-lobby-modal") as JoinLobbyModal)?.open();
};
- private renderSmallActionCard(title: string, onClick: () => void) {
+ private renderFeaturedLobbyCard(
+ lobby: PublicGameInfo,
+ titleContent: string | TemplateResult,
+ ) {
+ const mapType = lobby.gameConfig!.gameMap as GameMapType;
+ const mapImageSrc = terrainMapFileLoader.getMapData(mapType).webpPath;
+ const timeRemaining = Math.max(
+ 0,
+ Math.floor((lobby.startsAt - this.serverTimeOffset - Date.now()) / 1000),
+ );
+ const timeDisplay = renderDuration(timeRemaining);
+ const mapName = getMapName(lobby.gameConfig?.gameMap);
+ const modifierLabels = this.getModifierLabels(
+ lobby.gameConfig?.publicGameModifiers,
+ );
+ if (modifierLabels.length > 1) {
+ modifierLabels.sort((a, b) => a.length - b.length);
+ }
+
return html`
`;
}
- private renderLobbyCard(
+ private renderUpcomingLobbyCard(
lobby: PublicGameInfo,
titleContent: string | TemplateResult,
) {
@@ -185,72 +290,40 @@ export class GameModeSelector extends LitElement {
const timeDisplay = renderDuration(timeRemaining);
const mapName = getMapName(lobby.gameConfig?.gameMap);
- const modifierLabels = this.getModifierLabels(
- lobby.gameConfig?.publicGameModifiers,
- );
- // Sort by length for visual consistency (shorter labels first)
- if (modifierLabels.length > 1) {
- modifierLabels.sort((a, b) => a.length - b.length);
- }
-
return html`