diff --git a/apps/client/src/widgets/react/Column.tsx b/apps/client/src/widgets/react/Column.tsx
index 682d750d6..12b8ac9e5 100644
--- a/apps/client/src/widgets/react/Column.tsx
+++ b/apps/client/src/widgets/react/Column.tsx
@@ -1,13 +1,14 @@
import type { ComponentChildren } from "preact";
interface ColumnProps {
- md: number;
+ md?: number;
children: ComponentChildren;
+ className?: string;
}
-export default function Column({ md, children }: ColumnProps) {
+export default function Column({ md, children, className }: ColumnProps) {
return (
-
+
{children}
)
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index a99fa45dc..fd3f4763e 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -5,6 +5,7 @@ import SpacedUpdate from "../../services/spaced_update";
import { OptionNames } from "@triliumnext/commons";
import options from "../../services/options";
import utils, { reloadFrontendApp } from "../../services/utils";
+import { __values } from "tslib";
/**
* Allows a React component to react to Trilium events (e.g. `entitiesReloaded`). When the desired event is triggered, the handler is invoked with the event parameters.
@@ -93,6 +94,14 @@ export function useTriliumOption(name: OptionNames, needsRefresh?: boolean): [st
]
}
+export function useTriliumOptionBool(name: OptionNames): [boolean, (newValue: boolean) => Promise
] {
+ const [ value, setValue ] = useTriliumOption(name);
+ return [
+ (value === "true"),
+ (newValue) => setValue(newValue ? "true" : "false")
+ ]
+}
+
/**
* Generates a unique name via a random alphanumeric string of a fixed length.
*
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index 9d5fa674d..57d6f06dc 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -4,9 +4,10 @@ import { isMobile, reloadFrontendApp } from "../../../services/utils";
import Column from "../../react/Column";
import FormRadioGroup from "../../react/FormRadioGroup";
import FormSelect from "../../react/FormSelect";
-import { useTriliumOption } from "../../react/hooks";
+import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import OptionsSection from "./components/OptionsSection";
import server from "../../../services/server";
+import FormCheckbox from "../../react/FormCheckbox";
interface Theme {
val: string;
@@ -26,6 +27,7 @@ const BUILTIN_THEMES: Theme[] = [
export default function AppearanceSettings() {
const [ layoutOrientation, setLayoutOrientation ] = useTriliumOption("layoutOrientation", true);
const [ theme, setTheme ] = useTriliumOption("theme", true);
+ const [ overrideThemeFonts, setOverrideThemeFonts ] = useTriliumOptionBool("overrideThemeFonts");
const [ themes, setThemes ] = useState([]);
@@ -58,10 +60,17 @@ export default function AppearanceSettings() {
-
+
+
+
+
+
>
)
diff --git a/apps/client/src/widgets/type_widgets/options/appearance/theme.ts b/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
deleted file mode 100644
index a183815ed..000000000
--- a/apps/client/src/widgets/type_widgets/options/appearance/theme.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import OptionsWidget from "../options_widget.js";
-import server from "../../../../services/server.js";
-import utils from "../../../../services/utils.js";
-import { t } from "../../../../services/i18n.js";
-import type { OptionMap } from "@triliumnext/commons";
-
-const TPL = /*html*/`
-
-`;
-
-export default class ThemeOptions extends OptionsWidget {
-
- private $overrideThemeFonts!: JQuery;
-
- doRender() {
- this.$widget = $(TPL);
- this.$themeSelect = this.$widget.find(".theme-select");
- this.$overrideThemeFonts = this.$widget.find(".override-theme-fonts");
-
-
- this.$overrideThemeFonts.on("change", () => this.updateCheckboxOption("overrideThemeFonts", this.$overrideThemeFonts));
- }
-
- async optionsLoaded(options: OptionMap) {
- this.setCheckboxState(this.$overrideThemeFonts, options.overrideThemeFonts);
-
- this.$widget.find(`input[name="layout-orientation"][value="${options.layoutOrientation}"]`).prop("checked", "true");
- }
-}
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx
index 3f54cd6af..d81f208a7 100644
--- a/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx
@@ -10,7 +10,9 @@ export default function OptionsSection({ title, children }: OptionsSectionProps)
{title}
- {children}
+
+ {children}
+
);
}