Skip to content

Commit 5c2c966

Browse files
committed
on new recording flow: disable style/early return for buttons while recording
1 parent ceec472 commit 5c2c966

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

apps/desktop/src/routes/(window-chrome)/new-main/CameraSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function CameraSelect(props: {
3838
<div class="flex flex-col gap-[0.25rem] items-stretch text-[--text-primary]">
3939
<button
4040
disabled={!!currentRecording.data || props.disabled}
41-
class="cursor-default flex flex-row gap-2 items-center px-2 w-full h-9 rounded-lg transition-colors bg-gray-3 disabled:text-gray-11 KSelect"
41+
class="flex flex-row gap-2 items-center px-2 w-full h-9 rounded-lg transition-colors cursor-default disabled:opacity-70 bg-gray-3 disabled:text-gray-11 KSelect"
4242
onClick={() => {
4343
Promise.all([
4444
CheckMenuItem.new({

apps/desktop/src/routes/(window-chrome)/new-main/MicrophoneSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function MicrophoneSelect(props: {
6666
<div class="flex flex-col gap-[0.25rem] items-stretch text-[--text-primary]">
6767
<button
6868
disabled={!!currentRecording.data || props.disabled}
69-
class="z-10 relative cursor-default flex flex-row gap-2 items-center px-2 w-full h-9 rounded-lg overflow-hidden transition-colors bg-gray-3 disabled:text-gray-11 KSelect"
69+
class="flex overflow-hidden relative z-10 flex-row gap-2 items-center px-2 w-full h-9 rounded-lg transition-colors cursor-default disabled:opacity-70 bg-gray-3 disabled:text-gray-11 KSelect"
7070
onClick={() => {
7171
Promise.all([
7272
CheckMenuItem.new({

apps/desktop/src/routes/(window-chrome)/new-main/SystemAudio.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function SystemAudio() {
1313
setOptions({ captureSystemAudio: !rawOptions.captureSystemAudio });
1414
}}
1515
disabled={!!currentRecording.data}
16-
class="curosr-default flex flex-row gap-2 items-center px-2 w-full h-9 rounded-lg transition-colors bg-gray-3 disabled:text-gray-11 KSelect"
16+
class="flex flex-row gap-2 items-center px-2 w-full h-9 rounded-lg transition-colors curosr-default disabled:opacity-70 bg-gray-3 disabled:text-gray-11 KSelect"
1717
>
1818
<IconPhMonitorBold class="text-gray-10 size-4" />
1919
<p class="flex-1 text-sm text-left truncate">

apps/desktop/src/routes/(window-chrome)/new-main/TargetTypeButton.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function TargetTypeButton(
66
selected: boolean;
77
Component: Component<ComponentProps<"svg">>;
88
name: string;
9+
disabled?: boolean;
910
} & ComponentProps<"div">,
1011
) {
1112
return (
@@ -16,6 +17,7 @@ function TargetTypeButton(
1617
props.selected
1718
? "bg-gray-3 text-white ring-blue-9 ring-1"
1819
: "ring-transparent ring-0",
20+
props.disabled ? "opacity-70 pointer-events-none" : "",
1921
)}
2022
>
2123
<props.Component

apps/desktop/src/routes/(window-chrome)/new-main/index.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { generalSettingsStore } from "~/store";
3030
import { createSignInMutation } from "~/utils/auth";
3131
import {
3232
createCameraMutation,
33+
createCurrentRecordingQuery,
3334
createLicenseQuery,
3435
listAudioDevices,
3536
listScreens,
@@ -112,6 +113,8 @@ function createUpdateCheck() {
112113

113114
function Page() {
114115
const { rawOptions, setOptions } = useRecordingOptions();
116+
const currentRecording = createCurrentRecordingQuery();
117+
const isRecording = () => !!currentRecording.data;
115118

116119
createUpdateCheck();
117120

@@ -389,27 +392,34 @@ function Page() {
389392
<TargetTypeButton
390393
selected={rawOptions.targetMode === "display"}
391394
Component={IconMdiMonitor}
392-
onClick={() =>
395+
disabled={isRecording()}
396+
onClick={() => {
397+
//if recording early return
398+
if (isRecording()) return;
393399
setOptions("targetMode", (v) =>
394400
v === "display" ? null : "display",
395-
)
396-
}
401+
);
402+
}}
397403
name="Display"
398404
/>
399405
<TargetTypeButton
400406
selected={rawOptions.targetMode === "window"}
401407
Component={IconLucideAppWindowMac}
402-
onClick={() =>
403-
setOptions("targetMode", (v) => (v === "window" ? null : "window"))
404-
}
408+
disabled={isRecording()}
409+
onClick={() => {
410+
if (isRecording()) return;
411+
setOptions("targetMode", (v) => (v === "window" ? null : "window"));
412+
}}
405413
name="Window"
406414
/>
407415
<TargetTypeButton
408416
selected={rawOptions.targetMode === "area"}
409417
Component={IconMaterialSymbolsScreenshotFrame2Rounded}
410-
onClick={() =>
411-
setOptions("targetMode", (v) => (v === "area" ? null : "area"))
412-
}
418+
disabled={isRecording()}
419+
onClick={() => {
420+
if (isRecording()) return;
421+
setOptions("targetMode", (v) => (v === "area" ? null : "area"));
422+
}}
413423
name="Area"
414424
/>
415425
</div>

0 commit comments

Comments
 (0)