From 64bff4efb314ecdf301fd1933f45512b981cb709 Mon Sep 17 00:00:00 2001 From: DEV-bot Date: Sun, 1 Mar 2026 10:11:29 +0000 Subject: [PATCH] feat(player): show reconnect banner with retry action --- lobby/templates/lobby/player_screen.html | 22 ++++++++++++++++------ lobby/tests.py | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lobby/templates/lobby/player_screen.html b/lobby/templates/lobby/player_screen.html index 4dac763..e66f661 100644 --- a/lobby/templates/lobby/player_screen.html +++ b/lobby/templates/lobby/player_screen.html @@ -9,6 +9,9 @@ #joinStatus { margin: 6px 0 10px; font-size: 0.95rem; color: #333; } #contextLockHint { margin: 6px 0 10px; font-size: 0.95rem; color: #333; } #phaseStatus { margin: 6px 0 10px; font-size: 0.95rem; color: #333; } +#connectionBanner { margin: 8px 0 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid #b91c1c; background: #fee2e2; color: #7f1d1d; display: none; } +#connectionBanner button { margin-left: 8px; border: 1px solid #991b1b; background: #fff; color: #7f1d1d; border-radius: 6px; padding: 4px 8px; cursor: pointer; } +#connectionBanner button[disabled] { opacity: 0.55; cursor: not-allowed; } #lieStatus.locked { color: #0a5f2d; font-weight: 600; } #guessStatus.locked { color: #0a5f2d; font-weight: 600; } @@ -38,6 +41,7 @@

Session-data ikke opdateret endnu.

Fase: ukendt (opdatér session-status).

Ingen fejl.

+
Forbindelsen til serveren blev afbrudt.
Klar.
diff --git a/lobby/tests.py b/lobby/tests.py index 051298a..81dc680 100644 --- a/lobby/tests.py +++ b/lobby/tests.py @@ -866,6 +866,19 @@ class UiScreenTests(TestCase): self.assertContains(response, "Round question-id er låst mens session-opdatering kører.") self.assertContains(response, "Kategori er låst mens session-opdatering kører.") self.assertContains(response, "categorySelect.disabled=hostActionInFlight||sessionDetailInFlight||!hasCode||phase!==") + self.assertContains(response, "hostShellRouteFromPath") + self.assertContains(response, "syncHostShellRoute") + self.assertContains(response, "Deep-link route guard: omdirigeret") + + def test_host_screen_deeplink_requires_login(self): + response = self.client.get(reverse("lobby:host_screen_deeplink", kwargs={"spa_path": "guess"})) + self.assertEqual(response.status_code, 302) + + def test_host_screen_deeplink_renders_for_logged_in_user(self): + self.client.login(username="host_ui", password="secret123") + response = self.client.get(reverse("lobby:host_screen_deeplink", kwargs={"spa_path": "guess"})) + self.assertEqual(response.status_code, 200) + self.assertContains(response, "Host panel") def test_player_screen_is_public(self): response = self.client.get(reverse("lobby:player_screen")) @@ -898,6 +911,11 @@ class UiScreenTests(TestCase): self.assertContains(response, "Udfyld kode og nickname for at join.") self.assertContains(response, "Afvent aktiv session-opdatering før join.") self.assertContains(response, "btn.disabled=joinInFlight||sessionDetailInFlight||joined||!canJoin") + self.assertContains(response, "id=\"connectionBanner\"") + self.assertContains(response, "id=\"connectionRetryBtn\"") + self.assertContains(response, "retryConnection") + self.assertContains(response, "setConnectionLost") + self.assertContains(response, "connection_lost") self.assertContains(response, "id=\"contextLockHint\"") self.assertContains(response, "updateContextLockState") self.assertContains(response, "Spillerkontekst er låst efter join.")