show game map name in public lobby

This commit is contained in:
Evan
2025-02-09 13:15:06 -08:00
parent 6ff4e10a7e
commit b3498976fb
4 changed files with 11 additions and 4 deletions
+8 -3
View File
@@ -20,7 +20,7 @@ export class PublicLobby extends LitElement {
this.fetchAndUpdateLobbies();
this.lobbiesInterval = window.setInterval(
() => this.fetchAndUpdateLobbies(),
1000,
1000
);
}
@@ -74,6 +74,11 @@ export class PublicLobby extends LitElement {
>
<div class="text-lg md:text-2xl font-semibold mb-2">Next Game</div>
<div class="flex items-center justify-center gap-4">
<div class="flex flex-col items-start">
<div class="text-md font-medium text-blue-100">
${lobby.gameConfig.gameMap}
</div>
</div>
<div class="flex flex-col items-start">
<div class="text-md font-medium text-blue-100">
${lobby.numClients}
@@ -106,7 +111,7 @@ export class PublicLobby extends LitElement {
},
bubbles: true,
composed: true,
}),
})
);
} else {
this.dispatchEvent(
@@ -114,7 +119,7 @@ export class PublicLobby extends LitElement {
detail: { lobby: this.currLobby },
bubbles: true,
composed: true,
}),
})
);
this.currLobby = null;
}
+1
View File
@@ -85,6 +85,7 @@ export interface Lobby {
id: string;
msUntilStart?: number;
numClients?: number;
gameConfig?: GameConfig;
}
const GameConfigSchema = z.object({
+1 -1
View File
@@ -47,7 +47,7 @@ export class GameServer {
public readonly createdAt: number,
public readonly isPublic: boolean,
private config: ServerConfig,
private gameConfig: GameConfig,
public gameConfig: GameConfig,
) {}
public updateGameConfig(gameConfig: GameConfig): void {
+1
View File
@@ -195,6 +195,7 @@ function updateLobbies() {
id: g.id,
msUntilStart: g.startTime() - Date.now(),
numClients: g.numClients(),
gameConfig: g.gameConfig,
}))
.sort((a, b) => a.msUntilStart - b.msUntilStart),
});