Skip to content

Commit

Permalink
feat: Remember previous export selection
Browse files Browse the repository at this point in the history
  • Loading branch information
richiemcilroy committed Jan 15, 2025
1 parent 1eb580c commit e945492
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/desktop/src/routes/editor/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,28 @@ export function Header() {
const { videoId, project, prettyName } = useEditorContext();

const [showExportOptions, setShowExportOptions] = createSignal(false);
const [selectedFps, setSelectedFps] = createSignal(30);
const [selectedFps, setSelectedFps] = createSignal(
Number(localStorage.getItem("cap-export-fps")) || 30
);
const [selectedResolution, setSelectedResolution] =
createSignal<ResolutionOption>(RESOLUTION_OPTIONS[1]);
createSignal<ResolutionOption>(
RESOLUTION_OPTIONS.find(
(opt) => opt.value === localStorage.getItem("cap-export-resolution")
) || RESOLUTION_OPTIONS[0]
);

let unlistenTitlebar: UnlistenFn | undefined;
onMount(async () => {
unlistenTitlebar = await initializeTitlebar();
});
onCleanup(() => unlistenTitlebar?.());

// Save settings when they change
createEffect(() => {
localStorage.setItem("cap-export-fps", selectedFps().toString());
localStorage.setItem("cap-export-resolution", selectedResolution().value);
});

createEffect(() => {
const state = progressState;
if (state === undefined || state.type === "idle") {
Expand Down

0 comments on commit e945492

Please sign in to comment.