Fix null-session prompt, stale ready state, spectator UI, and admin cancel
- init_screen.gd: handle null sessionId from game.get_active_session.ack properly — str(null)="<null>" which passed the is_empty() check causing every player to see "active game in progress (null phase)" on login - CustomLobby.gd: call clear_state() at the start of create() and join() so that i_am_ready/partner_ready are reset between lobbies — fixes players appearing instantly ready when entering a new lobby after a previous game - game_screen.gd: in _setup_spectator_ui(), hide _settings_btn (prevents accessing the Concede button) and add a programmatic "Leave" button that calls Game.stop_spectating() and navigates back to FreePlayScreen - CustomLobbiesPage.razor: add Cancel button (admin) for Open/Full lobbies; directly sets Status=Cancelled and refreshes the list Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -73,6 +73,7 @@ else
|
||||
<th>Rules (SP/Turn, Hand)</th>
|
||||
<th>Created</th>
|
||||
<th>Session</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -111,11 +112,21 @@ else
|
||||
<span class="text-muted">—</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (lobby.Status == CustomLobbyStatus.Open || lobby.Status == CustomLobbyStatus.Full)
|
||||
{
|
||||
<button class="btn btn-outline-danger btn-sm"
|
||||
@onclick="() => CancelLobbyAsync(lobby.Id)"
|
||||
title="Force-cancel this lobby">
|
||||
Cancel
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (!FilteredLobbies.Any())
|
||||
{
|
||||
<tr><td colspan="7" class="text-center text-muted py-3">No lobbies found.</td></tr>
|
||||
<tr><td colspan="8" class="text-center text-muted py-3">No lobbies found.</td></tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -151,6 +162,16 @@ else
|
||||
? _lobbies
|
||||
: _lobbies.Where(l => l.Status.ToString() == _statusFilter);
|
||||
|
||||
private async Task CancelLobbyAsync(Guid lobbyId)
|
||||
{
|
||||
var lobby = await GameDb.CustomLobbies.FindAsync(lobbyId);
|
||||
if (lobby is null) return;
|
||||
if (lobby.Status != CustomLobbyStatus.Open && lobby.Status != CustomLobbyStatus.Full) return;
|
||||
lobby.Status = CustomLobbyStatus.Cancelled;
|
||||
await GameDb.SaveChangesAsync();
|
||||
await LoadAsync();
|
||||
}
|
||||
|
||||
private static string StatusBadge(CustomLobbyStatus status) => status switch
|
||||
{
|
||||
CustomLobbyStatus.Open => "bg-primary",
|
||||
|
||||
Reference in New Issue
Block a user