From 976244892995f9b320f3b2123a46ef4c614f62f3 Mon Sep 17 00:00:00 2001 From: Etienne Lescot Date: Fri, 27 Mar 2026 14:53:41 +0100 Subject: [PATCH] fix: address coderabbit comments (loading state + keyboard access) - LaunchWindow: expose isLoading/error from useCameraDevices; show 'Searching...' only while enumeration is in flight, 'Camera unavailable' on error, 'No camera found' when list is empty (fixes perpetual loading state) - LaunchWindow: keep { - setSelectedMicId(e.target.value); - setMicrophoneDeviceId(e.target.value); - }} - className="w-full appearance-none bg-white/5 text-white text-[11px] rounded-lg pl-2 pr-6 py-1 border border-white/10 outline-none hover:bg-white/10 transition-colors cursor-pointer" - > - {micDevices.map((device) => ( - - ))} - - - + )} + + {micExpanded && ( + )} )} @@ -304,43 +308,73 @@ export function LaunchWindow() { {/* Webcam selector */} {showWebcamControls && (
setIsWebcamHovered(true)} onMouseLeave={() => setIsWebcamHovered(false)} - style={{ width: isWebcamHovered ? "240px" : "140px", transition: "width 300ms ease" }} + onFocus={() => setIsWebcamFocused(true)} + onBlur={() => setIsWebcamFocused(false)} + style={{ width: webcamExpanded ? "240px" : "140px", transition: "width 300ms ease" }} >
- {!isWebcamHovered ? ( + {!webcamExpanded && (
{selectedCameraLabel}
- ) : cameraDevices.length > 0 ? ( - <> - - - - ) : ( - {t("webcam.searching")} + )} + {webcamExpanded && + (isCameraDevicesLoading ? ( + + {t("webcam.searching")} + + ) : cameraDevicesError ? ( + + {t("webcam.unavailable")} + + ) : cameraDevices.length === 0 ? ( + + {t("webcam.noneFound")} + + ) : ( + <> + + + + ))} + {!webcamExpanded && ( + )}
diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.json index f01e295..6e4a4ed 100644 --- a/src/i18n/locales/en/launch.json +++ b/src/i18n/locales/en/launch.json @@ -17,7 +17,9 @@ "enableWebcam": "Enable webcam", "disableWebcam": "Disable webcam", "defaultCamera": "Default Camera", - "searching": "Searching..." + "searching": "Searching...", + "noneFound": "No camera found", + "unavailable": "Camera unavailable" }, "sourceSelector": { "loading": "Loading sources...", diff --git a/src/i18n/locales/es/launch.json b/src/i18n/locales/es/launch.json index 4902404..b25ec3d 100644 --- a/src/i18n/locales/es/launch.json +++ b/src/i18n/locales/es/launch.json @@ -17,7 +17,9 @@ "enableWebcam": "Activar cámara web", "disableWebcam": "Desactivar cámara web", "defaultCamera": "Cámara predeterminada", - "searching": "Buscando..." + "searching": "Buscando...", + "noneFound": "No se encontró cámara", + "unavailable": "Cámara no disponible" }, "sourceSelector": { "loading": "Cargando fuentes...", diff --git a/src/i18n/locales/zh-CN/launch.json b/src/i18n/locales/zh-CN/launch.json index 48846a0..84fdcef 100644 --- a/src/i18n/locales/zh-CN/launch.json +++ b/src/i18n/locales/zh-CN/launch.json @@ -17,7 +17,9 @@ "enableWebcam": "启用摄像头", "disableWebcam": "禁用摄像头", "defaultCamera": "默认摄像头", - "searching": "正在搜索..." + "searching": "正在搜索...", + "noneFound": "未找到摄像头", + "unavailable": "摄像头不可用" }, "sourceSelector": { "loading": "正在加载源...",