From 5db88b25cb7b7370a12b2ae290893a012a5c2c5a Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Wed, 29 Apr 2026 12:44:02 +0800 Subject: [PATCH] fix: add syncCompleted reset, Escape key handler, and a11y attributes to sync overlay --- app/(manage)/manage/games/games-client.tsx | 25 ++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/app/(manage)/manage/games/games-client.tsx b/app/(manage)/manage/games/games-client.tsx index 639cb0f..5532d9d 100644 --- a/app/(manage)/manage/games/games-client.tsx +++ b/app/(manage)/manage/games/games-client.tsx @@ -102,6 +102,7 @@ export function GamesClient() { } setSyncing(true) + setSyncCompleted(false) setSyncProgress({ isRunning: true, current: 0, @@ -208,6 +209,7 @@ export function GamesClient() { return } + setSyncCompleted(false) setSyncProgress({ isRunning: true, current: 0, @@ -302,6 +304,16 @@ export function GamesClient() { }) } + // Close sync overlay on Escape key + useEffect(() => { + if (!syncCompleted) return + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === "Escape") closeSyncOverlay() + } + document.addEventListener("keydown", handleKeyDown) + return () => document.removeEventListener("keydown", handleKeyDown) + }, [syncCompleted]) + const isSearchChangeRef = useRef(false) const handleSearchChange = (value: string) => { @@ -595,7 +607,12 @@ export function GamesClient() { {(syncProgress.isRunning || syncCompleted) && createPortal(
-
+
{syncProgress.isRunning ? ( <>
@@ -606,7 +623,7 @@ export function GamesClient() {
-

Syncing Games

+

Syncing Games

{syncProgress.current} of {syncProgress.total} games

@@ -642,7 +659,7 @@ export function GamesClient() {
-

Sync Complete

+

Sync Complete

{syncProgress.synced} synced, {syncProgress.failed} failed

@@ -698,7 +715,7 @@ export function GamesClient() { {game?.title || gameId} {!result.success && result.error && ( - + {result.error} )}