From 735ebe189b1446babf32a89366d3c14a42e671a5 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Mon, 20 Apr 2026 22:32:03 +1000 Subject: [PATCH] fix: wire mic toggle in recording HUD, make dimension memos reactive, localize account button - RecordingControls now accepts and wires toggleMicrophone so the mic button actually works during recording - gifOutputDimensions and desiredMp4SourceDimensions now use a reactive videoDimensions state (set on loadedmetadata) instead of reading from a ref in useMemo, fixing stale 1920x1080 fallback on first render - Account button text now goes through i18n with translations for all 5 locales --- .../launch/LaunchWindow/HudControls.tsx | 3 +++ src/components/launch/LaunchWindow/index.tsx | 3 +-- src/components/video-editor/EditorSidebar.tsx | 4 +-- .../video-editor/hooks/useEditorWiring.ts | 27 ++++++++++++++----- src/i18n/locales/en/editor.json | 6 ++++- src/i18n/locales/es/editor.json | 6 ++++- src/i18n/locales/ko/editor.json | 6 ++++- src/i18n/locales/nl/editor.json | 6 ++++- src/i18n/locales/zh-CN/editor.json | 6 ++++- 9 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/components/launch/LaunchWindow/HudControls.tsx b/src/components/launch/LaunchWindow/HudControls.tsx index bbee287b..67e197e8 100644 --- a/src/components/launch/LaunchWindow/HudControls.tsx +++ b/src/components/launch/LaunchWindow/HudControls.tsx @@ -97,6 +97,7 @@ interface RecordingControlsProps { elapsed: number; formatTime: (s: number) => string; microphoneEnabled: boolean; + toggleMicrophone: () => void; resumeRecording: () => void; pauseRecording: () => void; toggleRecording: () => void; @@ -108,6 +109,7 @@ export function RecordingControls({ elapsed, formatTime, microphoneEnabled, + toggleMicrophone, resumeRecording, pauseRecording, toggleRecording, @@ -137,6 +139,7 @@ export function RecordingControls({ toast.info("Account coming soon")} - title="Account" + onClick={() => toast.info(t("sidebar.accountComingSoon", "Account coming soon"))} + title={t("sidebar.account", "Account")} className="group relative flex h-9 w-9 items-center justify-center rounded-lg text-foreground/55 outline-none transition hover:text-foreground focus:outline-none focus-visible:outline-none" whileHover={{ opacity: 1 }} initial={{ opacity: 0.55 }} diff --git a/src/components/video-editor/hooks/useEditorWiring.ts b/src/components/video-editor/hooks/useEditorWiring.ts index e60f7d77..9b6e9fae 100644 --- a/src/components/video-editor/hooks/useEditorWiring.ts +++ b/src/components/video-editor/hooks/useEditorWiring.ts @@ -92,6 +92,21 @@ export function useEditorWiring({ ); // ── Dimension calculations ─────────────────────────────────────── + const [videoDimensions, setVideoDimensions] = useState({ width: 1920, height: 1080 }); + + useEffect(() => { + const video = videoPlaybackRef.current?.video; + if (!video) return; + const update = () => { + if (video.videoWidth > 0 && video.videoHeight > 0) { + setVideoDimensions({ width: video.videoWidth, height: video.videoHeight }); + } + }; + update(); + video.addEventListener("loadedmetadata", update); + return () => video.removeEventListener("loadedmetadata", update); + }, [videoPlaybackRef]); + const [supportedMp4SourceDimensions, setSupportedMp4SourceDimensions] = useState({ width: 1920, @@ -103,22 +118,22 @@ export function useEditorWiring({ const gifOutputDimensions = useMemo( () => calculateOutputDimensions( - videoPlaybackRef.current?.video?.videoWidth || 1920, - videoPlaybackRef.current?.video?.videoHeight || 1080, + videoDimensions.width, + videoDimensions.height, prefs.gifSizePreset, GIF_SIZE_PRESETS, ), - [prefs.gifSizePreset], + [videoDimensions.width, videoDimensions.height, prefs.gifSizePreset], ); const desiredMp4SourceDimensions = useMemo( () => calculateMp4SourceDimensions( - videoPlaybackRef.current?.video?.videoWidth || 1920, - videoPlaybackRef.current?.video?.videoHeight || 1080, + videoDimensions.width, + videoDimensions.height, prefs.aspectRatio, ), - [prefs.aspectRatio], + [videoDimensions.width, videoDimensions.height, prefs.aspectRatio], ); const mp4OutputDimensions = useMemo(() => { diff --git a/src/i18n/locales/en/editor.json b/src/i18n/locales/en/editor.json index 93443f96..0b2f9ef5 100644 --- a/src/i18n/locales/en/editor.json +++ b/src/i18n/locales/en/editor.json @@ -135,5 +135,9 @@ "expand": "Expand Timeline", "collapse": "Collapse Timeline" }, - "openRecordingsFolder": "Open recordings folder" + "openRecordingsFolder": "Open recordings folder", + "sidebar": { + "account": "Account", + "accountComingSoon": "Account coming soon" + } } diff --git a/src/i18n/locales/es/editor.json b/src/i18n/locales/es/editor.json index 59f78e54..4e22d2ad 100644 --- a/src/i18n/locales/es/editor.json +++ b/src/i18n/locales/es/editor.json @@ -135,5 +135,9 @@ "expand": "Expandir línea de tiempo", "collapse": "Contraer línea de tiempo" }, - "openRecordingsFolder": "Abrir carpeta de grabaciones" + "openRecordingsFolder": "Abrir carpeta de grabaciones", + "sidebar": { + "account": "Cuenta", + "accountComingSoon": "Cuenta próximamente" + } } diff --git a/src/i18n/locales/ko/editor.json b/src/i18n/locales/ko/editor.json index 436f5d32..c32bda70 100644 --- a/src/i18n/locales/ko/editor.json +++ b/src/i18n/locales/ko/editor.json @@ -136,5 +136,9 @@ "expand": "타임라인 펼치기", "collapse": "타임라인 접기" }, - "openRecordingsFolder": "녹화 폴더 열기" + "openRecordingsFolder": "녹화 폴더 열기", + "sidebar": { + "account": "계정", + "accountComingSoon": "계정 기능이 곧 추가됩니다" + } } diff --git a/src/i18n/locales/nl/editor.json b/src/i18n/locales/nl/editor.json index b2fed059..0c0af247 100644 --- a/src/i18n/locales/nl/editor.json +++ b/src/i18n/locales/nl/editor.json @@ -136,5 +136,9 @@ "expand": "Tijdlijn uitvouwen", "collapse": "Tijdlijn samenvouwen" }, - "openRecordingsFolder": "Opnamemap openen" + "openRecordingsFolder": "Opnamemap openen", + "sidebar": { + "account": "Account", + "accountComingSoon": "Account binnenkort beschikbaar" + } } diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.json index a3e0da18..5e897db9 100644 --- a/src/i18n/locales/zh-CN/editor.json +++ b/src/i18n/locales/zh-CN/editor.json @@ -135,5 +135,9 @@ "expand": "展开时间轴", "collapse": "折叠时间轴" }, - "openRecordingsFolder": "打开录制文件夹" + "openRecordingsFolder": "打开录制文件夹", + "sidebar": { + "account": "账户", + "accountComingSoon": "账户功能即将推出" + } }