Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(options): move page-wide enable toggles into the page header
Elian Doran9dc02c4ca55f
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.css b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.cssindex 0d77d49f87..c69c862a65 100644--- a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.css+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.css@@ -64,6 +64,9 @@.options-page-header-actions {flex: 1 1 auto;min-width: 0;+ display: flex;+ align-items: center;+ justify-content: flex-end;}/* A full-width bar that sticks to the top of the scrolling content, so cards scroll cleanly beneathdiff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsxindex b82c22af70..2009bc2c89 100644--- a/apps/client/src/widgets/type_widgets/options/llm.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx@@ -6,6 +6,7 @@ import { isStandalone } from "../../../services/utils";import ActionButton from "../../react/ActionButton";import Button from "../../react/Button";import FormTextBox from "../../react/FormTextBox";+import FormToggle from "../../react/FormToggle";import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";import NoItems from "../../react/NoItems";import OptionsPageHeader from "./components/OptionsPageHeader";@@ -29,18 +30,18 @@ export default function LlmSettings() {return (<>- <OptionsPageHeader helpUrl="GBBMSlVSOIGP" />- <OptionsSection- description={t("llm.settings_description")}- >- <OptionsRowWithToggle- name="ai-enabled"- label={t("experimental_features.llm_name")}- description={t("experimental_features.llm_description")}- currentValue={aiEnabled}- onChange={setAiEnabled}- />- </OptionsSection>+ <OptionsPageHeader+ helpUrl="GBBMSlVSOIGP"+ actions={+ <FormToggle+ switchOnName="" switchOffName=""+ switchOnTooltip={t("experimental_features.llm_name")}+ switchOffTooltip={t("experimental_features.llm_name")}+ currentValue={aiEnabled}+ onChange={setAiEnabled}+ />+ }+ />{aiEnabled && (<>diff --git a/apps/client/src/widgets/type_widgets/options/spellcheck.tsx b/apps/client/src/widgets/type_widgets/options/spellcheck.tsxindex 582c5f1236..a8f8a15ee9 100644--- a/apps/client/src/widgets/type_widgets/options/spellcheck.tsx+++ b/apps/client/src/widgets/type_widgets/options/spellcheck.tsx@@ -5,21 +5,17 @@ import { t } from "../../../services/i18n";import { isElectron } from "../../../services/utils";import Button from "../../react/Button";import FormText from "../../react/FormText";+import FormToggle from "../../react/FormToggle";import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";import NoItems from "../../react/NoItems";import CheckboxList from "./components/CheckboxList";import OptionsPageHeader from "./components/OptionsPageHeader";-import OptionsRow, { OptionsRowWithToggle } from "./components/OptionsRow";+import OptionsRow from "./components/OptionsRow";import OptionsSection from "./components/OptionsSection";export default function SpellcheckSettings() {if (isElectron()) {- return (- <>- <OptionsPageHeader />- <ElectronSpellcheckSettings />- </>- );+ return <ElectronSpellcheckSettings />;}return (<>@@ -46,14 +42,15 @@ function ElectronSpellcheckSettings() {return (<>- <OptionsSection title={t("spellcheck.title")}>- <OptionsRowWithToggle- name="spell-check-enabled"- label={t("spellcheck.enable")}+ <OptionsPageHeader actions={+ <FormToggle+ switchOnName="" switchOffName=""+ switchOnTooltip={t("spellcheck.enable")}+ switchOffTooltip={t("spellcheck.enable")}currentValue={spellCheckEnabled}onChange={onToggle}/>- </OptionsSection>+ } />{spellCheckEnabled && <SpellcheckLanguages />}{spellCheckEnabled && <CustomDictionary />}