mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 15:25:44 +00:00
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
This commit is contained in:
@@ -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({
|
||||
<Separator />
|
||||
|
||||
<IconButton
|
||||
onClick={toggleMicrophone}
|
||||
title={
|
||||
microphoneEnabled
|
||||
? t("recording.disableMicrophone")
|
||||
|
||||
@@ -328,8 +328,7 @@ export function LaunchWindow() {
|
||||
paused={paused}
|
||||
elapsed={elapsed}
|
||||
formatTime={formatTime}
|
||||
microphoneEnabled={microphoneEnabled}
|
||||
resumeRecording={resumeRecording}
|
||||
microphoneEnabled={microphoneEnabled} toggleMicrophone={toggleMicrophone} resumeRecording={resumeRecording}
|
||||
pauseRecording={pauseRecording}
|
||||
toggleRecording={toggleRecording}
|
||||
cancelRecording={cancelRecording}
|
||||
|
||||
@@ -136,8 +136,8 @@ export function EditorSidebar({
|
||||
<div className="mt-auto pt-3">
|
||||
<motion.button
|
||||
type="button"
|
||||
onClick={() => 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 }}
|
||||
|
||||
@@ -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<SupportedMp4Dimensions>({
|
||||
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(() => {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,5 +136,9 @@
|
||||
"expand": "타임라인 펼치기",
|
||||
"collapse": "타임라인 접기"
|
||||
},
|
||||
"openRecordingsFolder": "녹화 폴더 열기"
|
||||
"openRecordingsFolder": "녹화 폴더 열기",
|
||||
"sidebar": {
|
||||
"account": "계정",
|
||||
"accountComingSoon": "계정 기능이 곧 추가됩니다"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,5 +136,9 @@
|
||||
"expand": "Tijdlijn uitvouwen",
|
||||
"collapse": "Tijdlijn samenvouwen"
|
||||
},
|
||||
"openRecordingsFolder": "Opnamemap openen"
|
||||
"openRecordingsFolder": "Opnamemap openen",
|
||||
"sidebar": {
|
||||
"account": "Account",
|
||||
"accountComingSoon": "Account binnenkort beschikbaar"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,5 +135,9 @@
|
||||
"expand": "展开时间轴",
|
||||
"collapse": "折叠时间轴"
|
||||
},
|
||||
"openRecordingsFolder": "打开录制文件夹"
|
||||
"openRecordingsFolder": "打开录制文件夹",
|
||||
"sidebar": {
|
||||
"account": "账户",
|
||||
"accountComingSoon": "账户功能即将推出"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user