fix(chess): filter own games from live list, dismissable errors, clickable avatars and completed games
- Filter user's own games from public "Live Games" list in lobby - Fix broken addSpectatingGame filter (playerPubkey is always viewerPubkey) - Add removeGame() to clean up stale entries when "Game not found" - Make player avatars clickable to open profile on game screen - Make completed game cards clickable to view final board state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -252,8 +252,12 @@ fun ChessScreen(
|
||||
// Main content
|
||||
if (selectedGameId != null) {
|
||||
// Set focused game mode - only poll this game, not others
|
||||
// If game isn't in active/spectating maps (e.g. completed game), load from relays
|
||||
LaunchedEffect(selectedGameId) {
|
||||
viewModel.setFocusedGame(selectedGameId!!)
|
||||
if (viewModel.getGameState(selectedGameId!!) == null) {
|
||||
viewModel.loadGame(selectedGameId!!)
|
||||
}
|
||||
}
|
||||
|
||||
// Use stateVersion to ensure recomposition when game state changes
|
||||
@@ -591,6 +595,7 @@ private fun ChessLobby(
|
||||
didUserWin = game.didUserWin(userPubkey),
|
||||
isDraw = game.isDraw,
|
||||
moveCount = game.moveCount,
|
||||
onClick = { onSelectGame(game.gameId) },
|
||||
avatar = {
|
||||
UserAvatar(
|
||||
userHex = opponentPubkey,
|
||||
|
||||
+2
@@ -174,6 +174,8 @@ class DesktopChessViewModelNew(
|
||||
|
||||
fun stopSpectating(gameId: String) = logic.stopSpectating(gameId)
|
||||
|
||||
fun removeGame(gameId: String) = logic.removeGame(gameId)
|
||||
|
||||
// ============================================
|
||||
// Utility
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user