Skip to content

Commit 41102e2

Browse files
fix
1 parent ce5d707 commit 41102e2

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

apps/desktop/src/routes/in-progress-recording.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
} from "~/utils/queries";
2222
import { handleRecordingResult } from "~/utils/recording";
2323
import { commands, events } from "~/utils/tauri";
24-
import { useRecordingOptions } from "./(window-chrome)/OptionsContext";
2524

2625
type State =
2726
| { variant: "countdown"; from: number; current: number }
@@ -50,7 +49,6 @@ export default function () {
5049
const [start, setStart] = createSignal(Date.now());
5150
const [time, setTime] = createSignal(Date.now());
5251
const currentRecording = createCurrentRecordingQuery();
53-
const { setOptions } = useRecordingOptions();
5452
const optionsQuery = createOptionsQuery();
5553
const auth = authStore.createQuery();
5654

@@ -131,7 +129,7 @@ export default function () {
131129

132130
if (!shouldRestart) return;
133131

134-
await handleRecordingResult(commands.restartRecording(), setOptions);
132+
await handleRecordingResult(commands.restartRecording(), undefined);
135133

136134
setState({ variant: "recording" });
137135
setTime(Date.now());

apps/desktop/src/utils/recording.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { emit } from "@tauri-apps/api/event";
22
import * as dialog from "@tauri-apps/plugin-dialog";
3-
import type { SetStoreFunction } from "solid-js/store";
43
import type { createOptionsQuery } from "./queries";
5-
import {
6-
commands,
7-
type RecordingAction,
8-
type StartRecordingInputs,
9-
} from "./tauri";
10-
11-
const buttons = {
12-
yes: "Login",
13-
no: "Switch to Studio mode",
14-
cancel: "Cancel",
15-
};
4+
import { commands, type RecordingAction } from "./tauri";
165

176
export function handleRecordingResult(
187
result: Promise<RecordingAction>,
19-
setOptions: ReturnType<typeof createOptionsQuery>["setOptions"],
8+
setOptions: ReturnType<typeof createOptionsQuery>["setOptions"] | undefined,
209
) {
2110
return result
2211
.then(async (result) => {
2312
if (result === "InvalidAuthentication") {
13+
const buttons = setOptions
14+
? {
15+
yes: "Login",
16+
no: "Switch to Studio mode",
17+
cancel: "Cancel",
18+
}
19+
: {
20+
ok: "Login",
21+
cancel: "Cancel",
22+
};
23+
2424
const result = await dialog.message(
2525
"You must be authenticated to start an instant mode recording. Login or switch to Studio mode.",
2626
{
@@ -29,8 +29,10 @@ export function handleRecordingResult(
2929
},
3030
);
3131

32-
if (result === buttons.yes) emit("start-sign-in");
33-
else if (result === buttons.no) setOptions({ mode: "studio" });
32+
if (result === buttons.yes || result === buttons.ok)
33+
emit("start-sign-in");
34+
else if (result === buttons.no && setOptions)
35+
setOptions({ mode: "studio" });
3436
} else if (result === "UpgradeRequired") commands.showWindow("Upgrade");
3537
else
3638
await dialog.message(`Error: ${result}`, {

0 commit comments

Comments
 (0)