Skip to content

Commit

Permalink
Fix theme not remembered if changed from settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1ck committed Mar 16, 2024
1 parent ff22bc8 commit 09ccc6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/modals/interfacepanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import React, { useCallback, useEffect, useState } from "react";
import type { ColorScheme } from "@mantine/core";
import { Checkbox, Grid, NativeSelect, NumberInput, Textarea, useMantineTheme } from "@mantine/core";
import type { UseFormReturnType } from "@mantine/form";
import ColorChooser from "components/colorchooser";
Expand All @@ -27,6 +28,7 @@ const { TAURI, invoke } = await import(/* webpackChunkName: "taurishim" */"tauri

export interface InterfaceFormValues {
interface: {
theme?: ColorScheme,
styleOverrides: StyleOverrides,
skipAddDialog: boolean,
deleteTorrentData: DeleteTorrentDataOption,
Expand All @@ -53,6 +55,10 @@ export function InterfaceSettigsPanel<V extends InterfaceFormValues>(props: { fo

const { setFieldValue } = props.form as unknown as UseFormReturnType<InterfaceFormValues>;

useEffect(() => {
setFieldValue("interface.theme", theme.colorScheme);
}, [setFieldValue, theme]);

const setTextColor = useCallback((color: ColorSetting | undefined) => {
const newStyle = { dark: { ...style.dark }, light: { ...style.light }, font: style.font };
newStyle[theme.colorScheme].color = color;
Expand Down

0 comments on commit 09ccc6a

Please sign in to comment.