Skip to content

Build your personal knowledge base with Trilium Notes

client/options: refactor

Adorian Dorane497cf7694f5
diff --git a/apps/client/src/setup_backup.tsx b/apps/client/src/setup_backup.tsx
index a6bf88199c..f7eadcb846 100644
--- a/apps/client/src/setup_backup.tsx
+++ b/apps/client/src/setup_backup.tsx
@@ -13,7 +13,7 @@ import { t } from "./services/i18n";
import { formatSize } from "./services/utils";
import Admonition from "./widgets/react/Admonition";
import Button from "./widgets/react/Button";
-import { Card, CardOption, CardSection } from "./widgets/react/Card";
+import { Card, CardSection, OptionCardSection } from "./widgets/react/Card";
import FilesystemFriendlyName from "./widgets/react/FilesystemFriendlyName";
import FormGroup from "./widgets/react/FormGroup";
import FormPasswordWithConfirmation from "./widgets/react/FormPasswordWithConfirmation";
@@ -149,7 +149,7 @@ export function BackupParameters({ defaults, onContinue, footer }: {
does: the stored passphrase cannot be shown, so choosing it is the only way
to ask for the password the user has already set up. */}
{defaults?.storedPassphrase && (
- <CardOption
+ <OptionCardSection
name="backup-use-stored-password"
label={t("setup.backup-use-stored-password")}
description={t("setup.backup-use-stored-password-description")}
@@ -167,7 +167,7 @@ export function BackupParameters({ defaults, onContinue, footer }: {
}
}}
/>
- </CardOption>
+ </OptionCardSection>
)}
{!useStoredPassphrase && (
@@ -183,13 +183,13 @@ export function BackupParameters({ defaults, onContinue, footer }: {
)}
{defaults && (
- <CardOption
+ <OptionCardSection
name="backup-compress"
label={t("setup.backup-compress")}
description={t("setup.backup-compress-description")}
>
<FormToggle currentValue={compress} onChange={setCompress} />
- </CardOption>
+ </OptionCardSection>
)}
</Card>
</form>
diff --git a/apps/client/src/setup_existing.tsx b/apps/client/src/setup_existing.tsx
index cfcc6ad7f4..1abeb7e575 100644
--- a/apps/client/src/setup_existing.tsx
+++ b/apps/client/src/setup_existing.tsx
@@ -17,7 +17,7 @@ import { formatSize, isElectron } from "./services/utils";
import { BackupDownloadPanel, BackupParameters, useBackupDownload } from "./setup_backup";
import Admonition from "./widgets/react/Admonition";
import Button from "./widgets/react/Button";
-import { Card, CardOption, CardSection } from "./widgets/react/Card";
+import { Card, CardSection, OptionCardSection } from "./widgets/react/Card";
import FormRadioGroup from "./widgets/react/FormRadioGroup";
import Icon from "./widgets/react/Icon";
import SetupPage from "./widgets/react/SetupPage";
@@ -379,17 +379,17 @@ export function ExistingDataBackedUp({ backup, onContinue, onCancel }: {
}
>
<Card>
- <CardOption label={t("setup.existing-data-file-name")}>
+ <OptionCardSection label={t("setup.existing-data-file-name")}>
<span class="existing-data-file-name">{backup.fileName}</span>
- </CardOption>
+ </OptionCardSection>
- <CardOption label={t("setup.existing-data-file-path")}>
+ <OptionCardSection label={t("setup.existing-data-file-path")}>
<BackupDirectory path={backup.directoryPath} />
- </CardOption>
+ </OptionCardSection>
- <CardOption label={t("setup.existing-data-file-size")}>
+ <OptionCardSection label={t("setup.existing-data-file-size")}>
{formatSize(backup.fileSize)}
- </CardOption>
+ </OptionCardSection>
<CardSection className="existing-data-actions">
<Button
diff --git a/apps/client/src/widgets/react/Card.spec.tsx b/apps/client/src/widgets/react/Card.spec.tsx
index 979ff673a2..1b4611bcc3 100644
--- a/apps/client/src/widgets/react/Card.spec.tsx
+++ b/apps/client/src/widgets/react/Card.spec.tsx
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import { renderInto } from "../../test/render";
-import { Card, CardFrame, CardOption, CardSection } from "./Card";
+import { Card, CardFrame, CardSection, OptionCardSection } from "./Card";
describe("Card", () => {
it("carries a heading, a sentence and controls of its own, and drops the heading line with nothing on it", () => {
@@ -61,10 +61,10 @@ describe("CardSection", () => {
});
});
-describe("CardOption", () => {
+describe("OptionCardSection", () => {
it("ties the label to its control when named, and leaves it loose when not", () => {
const bound = renderInto(
- <CardOption name="word-wrap" label="Word wrapping"><input type="checkbox" /></CardOption>
+ <OptionCardSection name="word-wrap" label="Word wrapping"><input type="checkbox" /></OptionCardSection>
);
const input = bound.querySelector("input");
expect(bound.querySelector("label")?.getAttribute("for")).toBe(input?.id);
@@ -72,13 +72,13 @@ describe("CardOption", () => {
// Nothing to point at: a set of buttons, not one control.
const loose = renderInto(
- <CardOption label="Shortcut"><button>a</button><button>b</button></CardOption>
+ <OptionCardSection label="Shortcut"><button>a</button><button>b</button></OptionCardSection>
);
expect(loose.querySelector("label")?.getAttribute("for")).toBeNull();
});
it("keeps the sentence with the label, so the two read as one name", () => {
- const container = renderInto(<CardOption label="Word wrapping" description="Wraps long lines." />);
+ const container = renderInto(<OptionCardSection label="Word wrapping" description="Wraps long lines." />);
const label = container.querySelector(".tn-card-option-label");
expect(label?.firstChild?.textContent).toBe("Word wrapping");
@@ -87,7 +87,7 @@ describe("CardOption", () => {
it("holds a name made of several things together, rather than stacking its parts", () => {
const container = renderInto(
- <CardOption
+ <OptionCardSection
label={<>Background effects <span className="platforms" /></>}
description="Blurs the window behind."
/>
@@ -102,17 +102,17 @@ describe("CardOption", () => {
});
it("puts the control on the line below when stacked", () => {
- const inline = renderInto(<CardOption label="Address"><input /></CardOption>);
+ const inline = renderInto(<OptionCardSection label="Address"><input /></OptionCardSection>);
expect(inline.querySelector(".tn-card-option")?.className).not.toContain("tn-card-option-stacked");
- const stacked = renderInto(<CardOption label="Address" stacked><input /></CardOption>);
+ const stacked = renderInto(<OptionCardSection label="Address" stacked><input /></OptionCardSection>);
expect(stacked.querySelector(".tn-card-option")?.className).toContain("tn-card-option-stacked");
});
});
describe("a segment that leads somewhere", () => {
it("becomes a link carrying a chevron, rather than a section", () => {
- const container = renderInto(<CardOption label="Backup" href="#root/_hidden/_options/_optionsBackup" />);
+ const container = renderInto(<OptionCardSection label="Backup" href="#root/_hidden/_options/_optionsBackup" />);
const link = container.querySelector("a");
expect(container.querySelector("section")).toBeNull();
@@ -127,7 +127,7 @@ describe("a segment that leads somewhere", () => {
it("hands its handler the event, which is what lets an entry navigate for itself", () => {
const onAction = vi.fn();
- const container = renderInto(<CardOption label="Task states" href="#root/_hidden/_taskStates" onAction={onAction} />);
+ const container = renderInto(<OptionCardSection label="Task states" href="#root/_hidden/_taskStates" onAction={onAction} />);
container.querySelector("a")?.click();
expect(onAction).toHaveBeenCalledTimes(1);
@@ -135,10 +135,10 @@ describe("a segment that leads somewhere", () => {
});
it("opts out of the dialog's contained navigation only when told to", () => {
- const contained = renderInto(<CardOption label="Backup" href="#a" />);
+ const contained = renderInto(<OptionCardSection label="Backup" href="#a" />);
expect(contained.querySelector("a")?.hasAttribute("data-no-contained-navigation")).toBe(false);
- const own = renderInto(<CardOption label="Backup" href="#a" noContainedNavigation />);
+ const own = renderInto(<OptionCardSection label="Backup" href="#a" noContainedNavigation />);
expect(own.querySelector("a")?.hasAttribute("data-no-contained-navigation")).toBe(true);
});
});
diff --git a/apps/client/src/widgets/react/Card.tsx b/apps/client/src/widgets/react/Card.tsx
index b99d540270..095fab9796 100644
--- a/apps/client/src/widgets/react/Card.tsx
+++ b/apps/client/src/widgets/react/Card.tsx
@@ -127,9 +127,9 @@ export function CardSection(props: {children: ComponentChildren} & CardSectionPr
// #endregion
-// #region Card Option
+// #region Option Card Section
-export interface CardOptionProps extends CardSectionProps {
+export interface OptionCardSectionProps extends CardSectionProps {
label: ComponentChildren;
description?: ComponentChildren;
/**
@@ -150,7 +150,7 @@ export interface CardOptionProps extends CardSectionProps {
* A card section built as one setting: what it is on the leading edge, what changes it on the
* trailing one, with the sentence explaining it below the label.
*/
-export function CardOption(props: CardOptionProps) {
+export function OptionCardSection(props: OptionCardSectionProps) {
const {label, description, name, stacked, children, className, ...rest} = props;
const id = useUniqueName(name);
const bound = !!name && isValidElement(children);
diff --git a/apps/client/src/widgets/type_widgets/options/advanced.tsx b/apps/client/src/widgets/type_widgets/options/advanced.tsx
index c12caa48f1..cc80a1ef9a 100644
--- a/apps/client/src/widgets/type_widgets/options/advanced.tsx
+++ b/apps/client/src/widgets/type_widgets/options/advanced.tsx
@@ -5,7 +5,7 @@ import { t } from "../../../services/i18n";
import server from "../../../services/server";
import toast from "../../../services/toast";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import FormToggle from "../../react/FormToggle";
import { useTriliumOptionJson } from "../../react/hooks";
import OptionsPageHeader from "./components/OptionsPageHeader";
@@ -42,7 +42,7 @@ function ExperimentalOptions() {
description={t("experimental_features.disclaimer")}
>
{filteredFeatures.map((feature) => (
- <CardOption
+ <OptionCardSection
key={feature.id}
name={`experimental-${feature.id}`}
label={feature.name}
@@ -52,7 +52,7 @@ function ExperimentalOptions() {
currentValue={enabledFeatures.includes(feature.id)}
onChange={(enabled) => toggleFeature(feature.id, enabled)}
/>
- </CardOption>
+ </OptionCardSection>
))}
</Card>
);
@@ -61,7 +61,7 @@ function ExperimentalOptions() {
function AdvancedSyncOptions() {
return (
<Card heading={t("sync.title")}>
- <CardOption
+ <OptionCardSection
label={t("sync.force_full_sync_label")}
description={t("sync.force_full_sync_description")}
>
@@ -74,9 +74,9 @@ function AdvancedSyncOptions() {
toast.showMessage(t("sync.full_sync_triggered"));
}}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("sync.fill_entity_changes_label")}
description={t("sync.fill_entity_changes_description")}
>
@@ -90,7 +90,7 @@ function AdvancedSyncOptions() {
toast.showMessage(t("sync.sync_rows_filled_successfully"));
}}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index 793975b1f5..93929b6c61 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -12,7 +12,7 @@ import { t } from "../../../services/i18n";
import server from "../../../services/server";
import { isElectron, isMobile, reloadFrontendApp } from "../../../services/utils";
import { VerticalLayoutIcon } from "../../buttons/global_menu";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import Dropdown from "../../react/Dropdown";
import FormList, { FormListHeader, FormListItem } from "../../react/FormList";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
@@ -179,7 +179,7 @@ function UserInterface() {
return (
<Card heading={t("theme.title")}>
- <CardOption name="theme" label={t("theme.theme_label")}>
+ <OptionCardSection name="theme" label={t("theme.theme_label")}>
<Dropdown
text={<>
<span className={currentFamilyIcon} style={{ marginRight: "8px" }} />
@@ -214,9 +214,9 @@ function UserInterface() {
</>
)}
</Dropdown>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="color-scheme"
label={t("theme.color_scheme")}
description={isCustom ? t("theme.color_scheme_custom_disabled") : undefined}
@@ -230,10 +230,10 @@ function UserInterface() {
disabled={isCustom}
collapseOnMobile
/>
- </CardOption>
+ </OptionCardSection>
{!isMobile() && !newLayout && (
- <CardOption
+ <OptionCardSection
name="edited-notes-open-in-ribbon"
label={t("ribbon.edited_notes_message")}
>
@@ -241,7 +241,7 @@ function UserInterface() {
currentValue={editedNotesOpenInRibbon}
onChange={setEditedNotesOpenInRibbon}
/>
- </CardOption>
+ </OptionCardSection>
)}
</Card>
);
@@ -451,7 +451,7 @@ function Fonts() {
return (
<Card className="appearance-fonts" heading={t("fonts.fonts")}>
- <CardOption
+ <OptionCardSection
name="override-theme-fonts"
label={t("fonts.custom_fonts")}
description={t("fonts.not_all_fonts_available")}
@@ -467,20 +467,20 @@ function Fonts() {
]}
>
<FormToggle currentValue={overrideThemeFonts} onChange={setOverrideThemeFonts} />
- </CardOption>
+ </OptionCardSection>
{/*
* Deliberately not nested under `overrideThemeFonts` like the fonts above: the
* ligatures come from the *theme's* monospace font, so the setting is needed exactly
* when custom fonts are off. Gating it would put it out of reach of everyone affected.
*/}
- <CardOption
+ <OptionCardSection
name="monospace-ligatures-enabled"
label={t("fonts.monospace_ligatures")}
description={t("fonts.monospace_ligatures_description")}
>
<FormToggle currentValue={ligaturesEnabled} onChange={setLigaturesEnabled} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -529,7 +529,7 @@ function Font({ label, description, sizeDescription, fontFamilyOption, fontSizeO
return (
<>
- <CardOption
+ <OptionCardSection
className={clsx("font-option", disabled && "disabled")}
label={label}
description={description}
@@ -539,7 +539,7 @@ function Font({ label, description, sizeDescription, fontFamilyOption, fontSizeO
<span className="font-option-specimen" style={{ fontFamily: getFontFamily(fontFamily ?? ""), fontSize: `${fontSize}%` }}>{displayLabel}</span>
<span className="bx bx-chevron-right" />
</span>
- </CardOption>
+ </OptionCardSection>
<FontPickerModal
show={showModal}
@@ -648,7 +648,7 @@ function ElectronIntegration() {
return (
<>
<Card className="appearance-electron" heading={t("electron_integration.desktop-application")}>
- <CardOption
+ <OptionCardSection
name="zoom-factor"
label={t("electron_integration.zoom-factor")}
description={t("zoom_factor.description")}
@@ -660,17 +660,17 @@ function ElectronIntegration() {
onChange={(v) => zoomService.setZoomFactorAndSave(parseInt(v, 10) / 100)}
unit={t("units.percentage")}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="native-title-bar"
label={t("electron_integration.native-title-bar")}
description={t("electron_integration.native-title-bar-description")}
>
<FormToggle currentValue={nativeTitleBarVisible} onChange={setNativeTitleBarVisible} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="background-effects"
label={<>{t("electron_integration.background-effects")} <PlatformIndicator windows="11" mac /></>}
description={t("electron_integration.background-effects-description")}
@@ -680,7 +680,7 @@ function ElectronIntegration() {
onChange={setBackgroundEffects}
disabled={nativeTitleBarVisible || !backgroundEffectsSupported}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
<RestartAction text={t("electron_integration.restart-app-button")} icon="bx-refresh" />
@@ -695,18 +695,18 @@ function Performance() {
return (
<Card heading={t("ui-performance.title")}>
- <CardOption name="motion-enabled" label={t("ui-performance.enable-motion")}>
+ <OptionCardSection name="motion-enabled" label={t("ui-performance.enable-motion")}>
<FormToggle currentValue={motionEnabled} onChange={setMotionEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption name="shadows-enabled" label={t("ui-performance.enable-shadows")}>
+ <OptionCardSection name="shadows-enabled" label={t("ui-performance.enable-shadows")}>
<FormToggle currentValue={shadowsEnabled} onChange={setShadowsEnabled} />
- </CardOption>
+ </OptionCardSection>
{!isMobile() && (
- <CardOption name="backdrop-effects-enabled" label={t("ui-performance.enable-backdrop-effects")}>
+ <OptionCardSection name="backdrop-effects-enabled" label={t("ui-performance.enable-backdrop-effects")}>
<FormToggle currentValue={backdropEffectsEnabled} onChange={setBackdropEffectsEnabled} />
- </CardOption>
+ </OptionCardSection>
)}
{isElectron() && <SmoothScrollEnabledOption />}
@@ -720,13 +720,13 @@ function SmoothScrollEnabledOption() {
const [ smoothScrollEnabled, setSmoothScrollEnabled ] = useTriliumOptionBool("smoothScrollEnabled");
return (
- <CardOption
+ <OptionCardSection
name="smooth-scroll-enabled"
label={t("ui-performance.enable-smooth-scroll")}
description={t("ui-performance.app-restart-required")}
>
<FormToggle currentValue={smoothScrollEnabled} onChange={setSmoothScrollEnabled} />
- </CardOption>
+ </OptionCardSection>
);
}
@@ -734,13 +734,13 @@ function HardwareAccelerationOption() {
const [ hardwareAccelerationEnabled, setHardwareAccelerationEnabled ] = useTriliumOptionBool("hardwareAccelerationEnabled");
return (
- <CardOption
+ <OptionCardSection
name="hardware-acceleration-enabled"
label={t("ui-performance.enable-hardware-acceleration")}
description={t("ui-performance.enable-hardware-acceleration-description")}
>
<FormToggle currentValue={hardwareAccelerationEnabled} onChange={setHardwareAccelerationEnabled} />
- </CardOption>
+ </OptionCardSection>
);
}
@@ -754,7 +754,7 @@ function MaxContentWidth() {
description={t("max_content_width.default_description")}
actions={<HelpButton helpPage="t596jLvPrqkS" />}
>
- <CardOption
+ <OptionCardSection
name="max-content-width"
label={t("max_content_width.max_width_label")}
>
@@ -763,11 +763,11 @@ function MaxContentWidth() {
currentValue={maxContentWidth} onBlur={setMaxContentWidth}
unit={t("max_content_width.max_width_unit")}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption name="center-content" label={t("max_content_width.centerContent")}>
+ <OptionCardSection name="center-content" label={t("max_content_width.centerContent")}>
<FormToggle currentValue={centerContent} onChange={setCenterContent} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/backup.location.spec.tsx b/apps/client/src/widgets/type_widgets/options/backup.location.spec.tsx
index 232be5b6b8..098c96c846 100644
--- a/apps/client/src/widgets/type_widgets/options/backup.location.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/backup.location.spec.tsx
@@ -8,7 +8,8 @@ const mocks = vi.hoisted(() => ({
customDir: ""
}));
-// Partial-mock so sibling components (e.g. `useUniqueName` in OptionsRow) keep their real implementation.
+// Partial-mock so sibling components (e.g. `useUniqueName` in OptionCardSection) keep their real
+// implementation.
vi.mock("../../react/hooks", async (importOriginal) => ({
...(await importOriginal<typeof import("../../react/hooks")>()),
useTriliumOption: () => [mocks.customDir, mocks.setCustomDir]
diff --git a/apps/client/src/widgets/type_widgets/options/backup.tsx b/apps/client/src/widgets/type_widgets/options/backup.tsx
index aa92405df7..84514693be 100644
--- a/apps/client/src/widgets/type_widgets/options/backup.tsx
+++ b/apps/client/src/widgets/type_widgets/options/backup.tsx
@@ -18,7 +18,7 @@ import { bootToSetup, canBootToSetup } from "../../../services/setup_mode";
import toast from "../../../services/toast";
import { isElectron } from "../../../services/utils";
import Button from "../../react/Button";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import DirectoryLink from "../../react/DirectoryLink";
import FormPasswordWithConfirmation from "../../react/FormPasswordWithConfirmation";
import FormText from "../../react/FormText";
@@ -210,26 +210,26 @@ export function BackupConfiguration() {
heading={t("backup.automatic_backups_title")}
description={t("backup.automatic_backups_description")}
>
- <CardOption name="daily-backup-enabled" label={t("backup.enable_daily_backup")}>
+ <OptionCardSection name="daily-backup-enabled" label={t("backup.enable_daily_backup")}>
<FormToggle
currentValue={dailyBackupEnabled}
onChange={setDailyBackupEnabled}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption name="weekly-backup-enabled" label={t("backup.enable_weekly_backup")}>
+ <OptionCardSection name="weekly-backup-enabled" label={t("backup.enable_weekly_backup")}>
<FormToggle
currentValue={weeklyBackupEnabled}
onChange={setWeeklyBackupEnabled}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption name="monthly-backup-enabled" label={t("backup.enable_monthly_backup")}>
+ <OptionCardSection name="monthly-backup-enabled" label={t("backup.enable_monthly_backup")}>
<FormToggle
currentValue={monthlyBackupEnabled}
onChange={setMonthlyBackupEnabled}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -367,7 +367,7 @@ export function BackupOptions() {
return (
<>
<Card heading={t("backup.options_title")}>
- <CardOption
+ <OptionCardSection
label={t("backup.enable_encryption")}
description={passphrase.available
? t("backup.enable_encryption_description")
@@ -395,9 +395,9 @@ export function BackupOptions() {
onClick={() => setPasswordModalShown(true)}
/>
)}
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="backup-compression-enabled"
label={t("backup.enable_compression")}
description={t("backup.enable_compression_description")}
@@ -406,7 +406,7 @@ export function BackupOptions() {
currentValue={compressionEnabled}
onChange={setCompressionEnabled}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
<BackupPasswordModal
diff --git a/apps/client/src/widgets/type_widgets/options/code_notes.tsx b/apps/client/src/widgets/type_widgets/options/code_notes.tsx
index 14da7db2fc..4de1ea819f 100644
--- a/apps/client/src/widgets/type_widgets/options/code_notes.tsx
+++ b/apps/client/src/widgets/type_widgets/options/code_notes.tsx
@@ -4,7 +4,7 @@ import CodeMirror, { ColorThemes, getThemeById, type ThemeVariant } from "@trili
import { useEffect, useMemo, useRef } from "preact/hooks";
import { t } from "../../../services/i18n";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import FormSelect from "../../react/FormSelect";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import FormToggle from "../../react/FormToggle";
@@ -43,12 +43,12 @@ function Editor({ wordWrapping, setWordWrapping }: EditorProps) {
return (
<Card heading={t("code-editor-options.title")}>
- <CardOption name="word-wrap" label={t("code_theme.word_wrapping")}>
+ <OptionCardSection name="word-wrap" label={t("code_theme.word_wrapping")}>
<FormToggle currentValue={wordWrapping} onChange={setWordWrapping} />
- </CardOption>
+ </OptionCardSection>
{/* Avoid using "code" in the name of numeric inputs to prevent KeepassXC from triggering. */}
- <CardOption
+ <OptionCardSection
name="editor-tab-width"
label={t("code-editor-options.tab_width")}
>
@@ -59,9 +59,9 @@ function Editor({ wordWrapping, setWordWrapping }: EditorProps) {
onChange={setCodeNoteTabWidth}
onBlur={setCodeNoteTabWidth}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="source-readonly-threshold"
label={t("code_auto_read_only_size.label")}
description={t("text_auto_read_only_size.description")}
@@ -72,15 +72,15 @@ function Editor({ wordWrapping, setWordWrapping }: EditorProps) {
currentValue={autoReadonlySize}
onBlur={setAutoReadonlySize}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="vim-keymap-enabled"
label={t("vim_key_bindings.use_vim_keybindings_in_code_notes")}
description={t("vim_key_bindings.enable_vim_keybindings")}
>
<FormToggle currentValue={vimKeymapEnabled} onChange={setVimKeymapEnabled} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -122,29 +122,29 @@ function Appearance({ wordWrapping, indentSize }: AppearanceProps) {
{matchesApp ? (
<>
- <CardOption name="light-theme" label={t("code_theme.light_theme")}>
+ <OptionCardSection name="light-theme" label={t("code_theme.light_theme")}>
<FormSelect
values={lightThemes}
keyProperty="id" titleProperty="name"
currentValue={lightTheme} onChange={setLightTheme}
/>
- </CardOption>
- <CardOption name="dark-theme" label={t("code_theme.dark_theme")}>
+ </OptionCardSection>
+ <OptionCardSection name="dark-theme" label={t("code_theme.dark_theme")}>
<FormSelect
values={darkThemes}
keyProperty="id" titleProperty="name"
currentValue={darkTheme} onChange={setDarkTheme}
/>
- </CardOption>
+ </OptionCardSection>
</>
) : (
- <CardOption name="color-scheme" label={t("code_theme.color-scheme")}>
+ <OptionCardSection name="color-scheme" label={t("code_theme.color-scheme")}>
<FormSelect
values={allThemes}
keyProperty="id" titleProperty="name"
currentValue={codeNoteTheme} onChange={setCodeNoteTheme}
/>
- </CardOption>
+ </OptionCardSection>
)}
{/* A specimen of the editor rather than a control standing beside a label, shown
diff --git a/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx b/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx
index 4167a6122f..00a060bc16 100644
--- a/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx
@@ -7,7 +7,7 @@ import { type DatabaseFile, describeDatabaseFile } from "../../../../services/da
import { t } from "../../../../services/i18n";
import open from "../../../../services/open";
import ActionButton from "../../../react/ActionButton";
-import { Card, CardOption, CardSection } from "../../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../../react/Card";
import DatabaseFileBadges from "../../../react/DatabaseFileBadges";
import NoItems from "../../../react/NoItems";
@@ -52,7 +52,7 @@ export default function DatabaseFileList<T extends DatabaseFile>(props: Database
<Card className="database-file-list" heading={title} description={description}>
{sortedFiles.length > 0 ? (
sortedFiles.map((file) => (
- <CardOption
+ <OptionCardSection
key={file.filePath}
label={
<span className="database-file-label">
@@ -78,7 +78,7 @@ export default function DatabaseFileList<T extends DatabaseFile>(props: Database
onClick={() => onDelete(file)}
/>
)}
- </CardOption>
+ </OptionCardSection>
))
) : (
<CardSection>
diff --git a/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx b/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx
index aa7650947e..6e86a75821 100644
--- a/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/RelatedSettings.tsx
@@ -1,6 +1,6 @@
import appContext from "../../../../components/app_context";
import { t } from "../../../../services/i18n";
-import { Card, CardOption } from "../../../react/Card";
+import { Card, OptionCardSection } from "../../../react/Card";
import type { OptionPages } from "../../ContentWidget";
interface RelatedSettingsItem {
@@ -38,7 +38,7 @@ export default function RelatedSettings({ items, title }: RelatedSettingsProps)
{filteredItems.map((item) => {
const { targetPage, targetNoteId, onClick } = item;
return (
- <CardOption
+ <OptionCardSection
key={targetPage ?? targetNoteId}
label={item.title}
description={item.description}
diff --git a/apps/client/src/widgets/type_widgets/options/components/ThemeModeSelector.tsx b/apps/client/src/widgets/type_widgets/options/components/ThemeModeSelector.tsx
index 2aff8f76b9..16fd86dae1 100644
--- a/apps/client/src/widgets/type_widgets/options/components/ThemeModeSelector.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/ThemeModeSelector.tsx
@@ -1,5 +1,5 @@
import { t } from "../../../../services/i18n";
-import { CardOption } from "../../../react/Card";
+import { OptionCardSection } from "../../../react/Card";
import SegmentedChoice, { SegmentedChoiceOption } from "../../../react/SegmentedChoice";
type ThemeMode = "app" | "fixed";
@@ -16,13 +16,13 @@ export default function ThemeModeSelector({ matchesApp, onMatchesAppChange }: Th
];
return (
- <CardOption name="theme-mode" label={t("code_theme.theme_mode")}>
+ <OptionCardSection name="theme-mode" label={t("code_theme.theme_mode")}>
<SegmentedChoice
options={modes}
currentValue={matchesApp ? "app" : "fixed"}
onChange={(mode) => onMatchesAppChange(mode === "app")}
collapseOnMobile
/>
- </CardOption>
+ </OptionCardSection>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/database.tsx b/apps/client/src/widgets/type_widgets/options/database.tsx
index 9cca2630c2..3af91d312a 100644
--- a/apps/client/src/widgets/type_widgets/options/database.tsx
+++ b/apps/client/src/widgets/type_widgets/options/database.tsx
@@ -28,7 +28,7 @@ import { formatSize, isStandalone } from "../../../services/utils";
import { formatDateTime } from "../../../utils/formatters";
import Admonition from "../../react/Admonition";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import DirectoryLink, { FileLink } from "../../react/DirectoryLink";
import { useNoteContext } from "../../react/hooks";
import { useFetch } from "../../react/use_fetch";
@@ -108,7 +108,7 @@ function DatabaseInfo({ refreshToken }: { refreshToken: number }) {
return (
<Card className="database-info" heading={t("database.info")}>
- <CardOption label={t("database.info_location")}>
+ <OptionCardSection label={t("database.info_location")}>
<span className="database-info-value">
{/* Revealed rather than opened: a file manager is what a path is useful in,
and the database's own reader is Trilium. Where there is no path, the
@@ -117,25 +117,25 @@ function DatabaseInfo({ refreshToken }: { refreshToken: number }) {
? <FileLink filePath={info.filePath} />
: t("database.info_location_opfs")}
</span>
- </CardOption>
+ </OptionCardSection>
- <CardOption label={t("database.info_content")}>
+ <OptionCardSection label={t("database.info_content")}>
<span className="database-info-value">
{t("database.info_notes", { count: info.noteCount })}
{", "}
{t("database.info_attachments", { count: info.attachmentCount })}
</span>
- </CardOption>
+ </OptionCardSection>
- <CardOption label={t("database.info_created")}>
+ <OptionCardSection label={t("database.info_created")}>
<span className="database-info-value">
{formatDateTime(info.utcDateCreated, "long", "none")}
</span>
- </CardOption>
+ </OptionCardSection>
- <CardOption label={t("database.info_size")}>
+ <OptionCardSection label={t("database.info_size")}>
<span className="database-info-value">{formatSize(info.sizeBytes)}</span>
- </CardOption>
+ </OptionCardSection>
{/* Absent where backups are not kept at all: the browser build's one backup is a
download, taken there and then, so there is nothing standing to state. */}
@@ -158,7 +158,7 @@ function BackupStanding({ refreshToken }: { refreshToken: number }) {
}
return (
- <CardOption label={t("database.info_backup")}>
+ <OptionCardSection label={t("database.info_backup")}>
{/* The whole value is the way to the page that acts on it: this row states how the
backups stand, and everything else about them is done there. */}
<span className="database-info-value">
@@ -166,7 +166,7 @@ function BackupStanding({ refreshToken }: { refreshToken: number }) {
{summarizeBackups(backups.backups) ?? t("database.info_no_backup")}
</a>
</span>
- </CardOption>
+ </OptionCardSection>
);
}
@@ -185,7 +185,7 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => vo
return (
<Card heading={t("database.maintenance")}>
- <CardOption
+ <OptionCardSection
label={t("database.cleanup")}
description={t("database.cleanup_description")}
>
@@ -203,9 +203,9 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => vo
}
})}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("database.analyze_space_usage")}
description={t("database.analyze_space_usage_description")}
>
@@ -222,9 +222,9 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => vo
void noteContext?.setNote("_optionsContentManager", { keepActiveDialog: true });
}}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("consistency_checks.find_and_fix_label")}
description={t("consistency_checks.find_and_fix_description")}
>
@@ -234,9 +234,9 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => vo
size="micro"
onClick={fixConsistencyIssues}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("database_integrity_check.check_integrity_label")}
description={t("database_integrity_check.check_integrity_description")}
>
@@ -246,14 +246,14 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => vo
size="micro"
onClick={checkIntegrity}
/>
- </CardOption>
+ </OptionCardSection>
{/* Offered everywhere the rebuild has somewhere to happen. The browser build keeps
the temporary store in memory, so compacting would ask it for the size of the
database over again at the very moment there is too little room — which is why
the cleanup tool leaves compaction out there as well. */}
{!isStandalone && (
- <CardOption
+ <OptionCardSection
label={t("vacuum_database.vacuum_label")}
description={t("vacuum_database.vacuum_description")}
>
@@ -266,7 +266,7 @@ function MaintenanceOptions({ onDatabaseChanged }: { onDatabaseChanged: () => vo
onDatabaseChanged();
}}
/>
- </CardOption>
+ </OptionCardSection>
)}
</Card>
);
@@ -365,7 +365,7 @@ function AnonymizationOptions() {
heading={t("database_anonymization.title")}
description={t("database_anonymization.description")}
>
- <CardOption
+ <OptionCardSection
label={t("database_anonymization.full_anonymization")}
description={t("database_anonymization.full_anonymization_description")}
>
@@ -376,9 +376,9 @@ function AnonymizationOptions() {
disabled={anonymizationInProgress}
onClick={() => void anonymize("full")}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("database_anonymization.light_anonymization")}
description={t("database_anonymization.light_anonymization_description")}
>
@@ -389,7 +389,7 @@ function AnonymizationOptions() {
disabled={anonymizationInProgress}
onClick={() => void anonymize("light")}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
{/* Where the copies are kept is stated only once there is one to find there: an empty
@@ -423,7 +423,7 @@ function AnonymizationOptions() {
function StartOverOption({ state }: { state: ReturnType<typeof useStartOver> }) {
return (
<Card className="start-over">
- <CardOption
+ <OptionCardSection
label={t("database.start_over")}
description={t("database.start_over_description")}
>
@@ -435,7 +435,7 @@ function StartOverOption({ state }: { state: ReturnType<typeof useStartOver> })
disabled={state.busy || state.pending}
onClick={() => void state.begin()}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/desktop.tsx b/apps/client/src/widgets/type_widgets/options/desktop.tsx
index 3f9ed341fb..638e798e83 100644
--- a/apps/client/src/widgets/type_widgets/options/desktop.tsx
+++ b/apps/client/src/widgets/type_widgets/options/desktop.tsx
@@ -5,7 +5,7 @@ import { useMemo } from "preact/hooks";
import { t } from "../../../services/i18n";
import utils, { isElectron } from "../../../services/utils";
import { Badge } from "../../react/Badge";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import FormTextBox from "../../react/FormTextBox";
import FormToggle from "../../react/FormToggle";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
@@ -41,7 +41,7 @@ function TrayOptionsSettings() {
return (
<Card heading={t("tray.title")}>
- <CardOption
+ <OptionCardSection
name="tray-enabled"
label={t("tray.enable_tray")}
description={t("tray.enable_tray_description")}
@@ -54,9 +54,9 @@ function TrayOptionsSettings() {
utils.reloadTray();
}}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="close-to-tray"
label={t("tray.close_to_tray")}
description={t("tray.close_to_tray_description")}
@@ -67,7 +67,7 @@ function TrayOptionsSettings() {
disabled={disableTray}
onChange={setCloseToTray}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -79,7 +79,7 @@ function StartupSettings() {
return (
<Card heading={t("startup.title")}>
- <CardOption
+ <OptionCardSection
name="launch-on-startup"
label={t("startup.launch_on_startup")}
description={t("startup.launch_on_startup_description")}
@@ -92,9 +92,9 @@ function StartupSettings() {
utils.reapplyLaunchOnStartup();
}}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="hide-on-auto-start"
label={t("startup.hide_on_auto_start")}
description={t("startup.hide_on_auto_start_description")}
@@ -110,7 +110,7 @@ function StartupSettings() {
utils.reapplyLaunchOnStartup();
}}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -133,7 +133,7 @@ function SearchEngineSettings() {
heading={t("search_engine.title")}
description={t("search_engine.custom_search_engine_info")}
>
- <CardOption label={t("search_engine.predefined_templates_label")}>
+ <OptionCardSection label={t("search_engine.predefined_templates_label")}>
<div className="search-engine-templates">
{searchEngines.map(engine => (
<Badge
@@ -148,9 +148,9 @@ function SearchEngineSettings() {
/>
))}
</div>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
className="desktop-search-name"
name="custom-name"
label={t("search_engine.custom_name_label")}
@@ -159,9 +159,9 @@ function SearchEngineSettings() {
currentValue={customSearchEngineName} onBlur={setCustomSearchEngineName}
placeholder={t("search_engine.custom_name_placeholder")}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="custom-url"
label={t("search_engine.custom_url_label")}
description={t("search_engine.custom_url_description")}
@@ -171,7 +171,7 @@ function SearchEngineSettings() {
currentValue={customSearchEngineUrl} onBlur={setCustomSearchEngineUrl}
placeholder={t("search_engine.custom_url_placeholder")}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/etapi.tsx b/apps/client/src/widgets/type_widgets/options/etapi.tsx
index 8e0b374fb7..174d30503d 100644
--- a/apps/client/src/widgets/type_widgets/options/etapi.tsx
+++ b/apps/client/src/widgets/type_widgets/options/etapi.tsx
@@ -10,7 +10,7 @@ import toast from "../../../services/toast";
import { formatDateTime } from "../../../utils/formatters";
import ActionButton from "../../react/ActionButton";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import { useTriliumEvent } from "../../react/hooks";
import NoItems from "../../react/NoItems";
import OptionsPageHeader from "./components/OptionsPageHeader";
@@ -113,7 +113,7 @@ function TokenList({ tokens }: { tokens: EtapiToken[] }) {
return (
<Card>
{tokens.map(({ etapiTokenId, name, utcDateCreated }) => (
- <CardOption
+ <OptionCardSection
key={etapiTokenId ?? name}
label={name}
description={formatDateTime(utcDateCreated)}
@@ -134,7 +134,7 @@ function TokenList({ tokens }: { tokens: EtapiToken[] }) {
/>
</span>
)}
- </CardOption>
+ </OptionCardSection>
))}
</Card>
);
diff --git a/apps/client/src/widgets/type_widgets/options/i18n.tsx b/apps/client/src/widgets/type_widgets/options/i18n.tsx
index e4257ad30f..0fc756d824 100644
--- a/apps/client/src/widgets/type_widgets/options/i18n.tsx
+++ b/apps/client/src/widgets/type_widgets/options/i18n.tsx
@@ -5,7 +5,7 @@ import { useMemo } from "preact/hooks";
import { getAvailableLocales, t } from "../../../services/i18n";
import { isElectron } from "../../../services/utils";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import FormSelect from "../../react/FormSelect";
import { useTriliumOption, useTriliumOptionJson } from "../../react/hooks";
import CheckboxList from "./components/CheckboxList";
@@ -65,20 +65,20 @@ function LocalizationOptions() {
return (
<Card heading={t("i18n.title")}>
- <CardOption name="language" label={t("i18n.language")}>
+ <OptionCardSection name="language" label={t("i18n.language")}>
<LocaleSelector locales={uiLocales} currentValue={locale} onChange={setLocale} />
- </CardOption>
+ </OptionCardSection>
- <CardOption name="formatting-locale" label={t("i18n.formatting-locale")}>
+ <OptionCardSection name="formatting-locale" label={t("i18n.formatting-locale")}>
<LocaleSelector
locales={contentLocales}
currentValue={formattingLocale}
onChange={setFormattingLocale}
defaultLocale={{ id: "", name: t("i18n.formatting-locale-auto") }}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="default-content-language"
label={t("i18n.default-content-language")}
description={t("i18n.default-content-language-description")}
@@ -89,7 +89,7 @@ function LocalizationOptions() {
onChange={setDefaultContentLanguage}
defaultLocale={{ id: "", name: t("i18n.default-content-language-auto") }}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
)
}
@@ -106,7 +106,7 @@ function DateSettings() {
return (
<Card heading={t("i18n.dates-title")}>
- <CardOption name="first-day-of-week" label={t("i18n.first-day-of-the-week")}>
+ <OptionCardSection name="first-day-of-week" label={t("i18n.first-day-of-the-week")}>
<FormSelect
name="first-day-of-week"
currentValue={firstDayOfWeek}
@@ -123,9 +123,9 @@ function DateSettings() {
{ value: "7", label: t("i18n.sunday") },
]}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="first-week-of-year"
label={t("i18n.first-week-of-the-year")}
description={t("i18n.first-week-warning")}
@@ -142,17 +142,17 @@ function DateSettings() {
{ value: "2", label: t("i18n.first-week-has-minimum-days") }
]}
/>
- </CardOption>
+ </OptionCardSection>
{firstWeekOfYear === "2" && (
- <CardOption name="min-days-in-first-week" label={t("i18n.min-days-in-first-week")}>
+ <OptionCardSection name="min-days-in-first-week" label={t("i18n.min-days-in-first-week")}>
<FormSelect
keyProperty="days"
currentValue={minDaysInFirstWeek} onChange={setMinDaysInFirstWeek}
values={Array.from(
{ length: 7 },
(_, i) => ({ days: String(i + 1) }))} />
- </CardOption>
+ </OptionCardSection>
)}
</Card>
)
diff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsx
index 915c8df2ad..a5a77d4b3f 100644
--- a/apps/client/src/widgets/type_widgets/options/llm.tsx
+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx
@@ -9,7 +9,7 @@ import server from "../../../services/server";
import { isStandalone } from "../../../services/utils";
import ActionButton from "../../react/ActionButton";
import Button from "../../react/Button";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import CodeBlock from "../../react/CodeBlock";
import Collapsible from "../../react/Collapsible";
import FormTextBox from "../../react/FormTextBox";
@@ -30,14 +30,14 @@ export default function LlmSettings() {
<OptionsPageHeader
helpUrl="GBBMSlVSOIGP"
below={
- <CardOption
+ <OptionCardSection
className="options-header-switch"
name="ai-enabled"
label={t("llm.enabled")}
description={t("llm.enabled_description")}
>
<FormToggle currentValue={aiEnabled} onChange={setAiEnabled} />
- </CardOption>
+ </OptionCardSection>
}
/>
@@ -158,7 +158,7 @@ function McpSettings() {
return (
<Card heading={t("llm.mcp_title")}>
- <CardOption
+ <OptionCardSection
name="mcp-enabled"
label={t("llm.mcp_enabled")}
description={mcpUnavailable ? t("llm.mcp_unavailable_standalone") : t("llm.mcp_enabled_description")}
@@ -168,11 +168,11 @@ function McpSettings() {
onChange={setMcpEnabled}
disabled={mcpUnavailable}
/>
- </CardOption>
+ </OptionCardSection>
{mcpServing && (
<>
- <CardOption
+ <OptionCardSection
name="mcp-endpoint"
label={t("llm.mcp_endpoint_title")}
description={t("llm.mcp_endpoint_description")}
@@ -187,7 +187,7 @@ function McpSettings() {
<p class="mcp-endpoint-note">{t("llm.mcp_endpoint_loopback_only")}</p>
)}
</div>
- </CardOption>
+ </OptionCardSection>
<CardSection>
<Collapsible title={t("llm.mcp_config_title")} initiallyExpanded>
@@ -278,7 +278,7 @@ function ProviderList({ providers, onEdit, onDelete }: ProviderListProps) {
const providerType = PROVIDER_TYPES.find(p => p.id === provider.provider);
const modelCount = provider.selectedModels?.length ?? 0;
return (
- <CardOption
+ <OptionCardSection
key={provider.id}
label={
<span className="llm-provider-name">
@@ -303,7 +303,7 @@ function ProviderList({ providers, onEdit, onDelete }: ProviderListProps) {
onClick={() => onDelete(provider.id, provider.name)}
/>
</span>
- </CardOption>
+ </OptionCardSection>
);
})}
</>;
diff --git a/apps/client/src/widgets/type_widgets/options/media.tsx b/apps/client/src/widgets/type_widgets/options/media.tsx
index 47a03ff881..17a7bd7c8d 100644
--- a/apps/client/src/widgets/type_widgets/options/media.tsx
+++ b/apps/client/src/widgets/type_widgets/options/media.tsx
@@ -19,7 +19,7 @@ import {
ResizeImageSection
} from "../../dialogs/image_compression/image_compression_sections";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import FormToggle from "../../react/FormToggle";
import HelpButton from "../../react/HelpButton";
import { useTriliumOption, useTriliumOptionBool, useTriliumOptionInt } from "../../react/hooks";
@@ -67,7 +67,7 @@ function ImageSettings() {
return (
<Card className="media-images" heading={t("images.images_section_title")}>
- <CardOption
+ <OptionCardSection
name="download-images-automatically"
label={t("images.download_images_automatically")}
description={t("images.download_images_description")}
@@ -76,12 +76,12 @@ function ImageSettings() {
currentValue={downloadImagesAutomatically}
onChange={setDownloadImagesAutomatically}
/>
- </CardOption>
+ </OptionCardSection>
{/* Not the tool's own "Compress images": that is something the user does to images
already stored, where this is a standing instruction about every image still to
arrive. Saying which is which is the whole of the label. */}
- <CardOption
+ <OptionCardSection
name="compress-images"
label={t("images.automatic_image_compression")}
description={t("images.enable_image_compression_description")}
@@ -93,7 +93,7 @@ function ImageSettings() {
]}
>
<FormToggle currentValue={compressImages} onChange={setCompressImages} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -149,15 +149,15 @@ function OcrSettings() {
heading={t("images.ocr_section_title")}
actions={<HelpButton helpPage="TiQbQDgP8L5t" />}
>
- <CardOption
+ <OptionCardSection
name="ocr-auto-process"
label={t("images.ocr_auto_process")}
description={t("images.ocr_auto_process_description")}
>
<FormToggle currentValue={ocrAutoProcess} onChange={setOcrAutoProcess} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="ocr-min-confidence"
label={`${t("images.ocr_min_confidence")} (${confidence}%)`}
description={t("images.ocr_confidence_description")}
@@ -167,7 +167,7 @@ function OcrSettings() {
value={confidence}
onChange={(value) => setOcrMinConfidence(String(value / 100))}
/>
- </CardOption>
+ </OptionCardSection>
{/* Running OCR needs the engine the server holds; a standalone client only ever
reads text extracted elsewhere and synced to it. */}
@@ -239,7 +239,7 @@ function BatchProcessing() {
const isRunning = progress?.inProgress ?? false;
return (
- <CardOption
+ <OptionCardSection
className="media-batch-ocr"
label={t("images.batch_ocr_title")}
description={t("images.batch_ocr_description")}
@@ -263,6 +263,6 @@ function BatchProcessing() {
onClick={startBatch}
/>
)}
- </CardOption>
+ </OptionCardSection>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/other.tsx b/apps/client/src/widgets/type_widgets/options/other.tsx
index 1054f89233..4b4657ea08 100644
--- a/apps/client/src/widgets/type_widgets/options/other.tsx
+++ b/apps/client/src/widgets/type_widgets/options/other.tsx
@@ -7,7 +7,7 @@ import search from "../../../services/search";
import server from "../../../services/server";
import toast from "../../../services/toast";
import Button from "../../react/Button";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import FormToggle from "../../react/FormToggle";
import { useNoteContext, useTriliumOption, useTriliumOptionBool, useTriliumOptionJson } from "../../react/hooks";
@@ -65,21 +65,21 @@ function SearchSettings() {
return (
<Card heading={t("search.title")}>
- <CardOption
+ <OptionCardSection
name="search-fuzzy-matching"
label={t("search.fuzzy_matching_label")}
description={t("search.fuzzy_matching_description")}
>
<FormToggle currentValue={fuzzyEnabled} onChange={setFuzzyEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="search-autocomplete-fuzzy"
label={t("search.autocomplete_fuzzy_label")}
description={t("search.autocomplete_fuzzy_description")}
>
<FormToggle currentValue={autocompleteFuzzy} onChange={setAutocompleteFuzzy} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -90,7 +90,7 @@ function NoteErasureTimeout() {
heading={t("note_erasure_timeout.note_erasure_timeout_title")}
description={t("note_erasure_timeout.description")}
>
- <CardOption
+ <OptionCardSection
name="erase-entities-after"
label={t("note_erasure_timeout.erase_notes_after")}
description={t("note_erasure_timeout.erase_notes_after_description")}
@@ -99,9 +99,9 @@ function NoteErasureTimeout() {
name="erase-entities-after"
optionValueId="eraseEntitiesAfterTimeInSeconds" optionTimeScaleId="eraseEntitiesAfterTimeScale"
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("note_erasure_timeout.erase_deleted_notes_now")}
description={t("note_erasure_timeout.manual_erasing_description")}
>
@@ -115,7 +115,7 @@ function NoteErasureTimeout() {
});
}}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -126,7 +126,7 @@ function AttachmentErasureTimeout() {
heading={t("attachment_erasure_timeout.attachment_erasure_timeout")}
description={t("attachment_erasure_timeout.description")}
>
- <CardOption
+ <OptionCardSection
name="erase-unused-attachments-after"
label={t("attachment_erasure_timeout.erase_attachments_after")}
description={t("attachment_erasure_timeout.erase_attachments_after_description")}
@@ -135,9 +135,9 @@ function AttachmentErasureTimeout() {
name="erase-unused-attachments-after"
optionValueId="eraseUnusedAttachmentsAfterSeconds" optionTimeScaleId="eraseUnusedAttachmentsAfterTimeScale"
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("attachment_erasure_timeout.erase_unused_attachments_now")}
description={t("attachment_erasure_timeout.manual_erasing_description")}
>
@@ -151,7 +151,7 @@ function AttachmentErasureTimeout() {
});
}}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -162,7 +162,7 @@ function RevisionSettings() {
return (
<Card heading={t("revisions_snapshot.title")}>
- <CardOption
+ <OptionCardSection
name="revision-snapshot-time-interval"
label={t("revisions_snapshot_interval.snapshot_time_interval_label")}
description={t("revisions_snapshot_interval.note_revisions_snapshot_description_short")}
@@ -172,9 +172,9 @@ function RevisionSettings() {
optionValueId="revisionSnapshotTimeInterval" optionTimeScaleId="revisionSnapshotTimeIntervalTimeScale"
minimumSeconds={10}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="revision-snapshot-number-limit"
label={t("revisions_snapshot_limit.snapshot_number_limit_label")}
description={t("revisions_snapshot_limit.note_revisions_snapshot_limit_description_short")}
@@ -190,17 +190,17 @@ function RevisionSettings() {
}
}}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="revision-keep-named-snapshots"
label={t("revisions_snapshot_limit.keep_named_revisions_label")}
description={t("revisions_snapshot_limit.keep_named_revisions_description")}
>
<FormToggle currentValue={revisionIgnoreNamedSnapshots} onChange={setRevisionIgnoreNamedSnapshots} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("revisions_snapshot_limit.erase_excess_revision_snapshots")}
description={t("revisions_snapshot_limit.erase_excess_revision_snapshots_description")}
>
@@ -217,7 +217,7 @@ function RevisionSettings() {
toast.showMessage(t("revisions_snapshot_limit.erase_excess_revision_snapshots_prompt"));
}}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -263,7 +263,7 @@ function ShareSettings() {
return (
<Card heading={t("share.title")}>
- <CardOption
+ <OptionCardSection
name="redirect-bare-domain"
label={t("share.redirect_bare_domain")}
description={t("share.redirect_bare_domain_description")}
@@ -286,15 +286,15 @@ function ShareSettings() {
setRedirectBareDomain(value);
}}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="show-login-in-share-theme"
label={t("share.show_login_link")}
description={t("share.show_login_link_description")}
>
<FormToggle currentValue={showLogInShareTheme} onChange={setShowLogInShareTheme} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -304,13 +304,13 @@ function NetworkSettings() {
return (
<Card heading={t("network_connections.network_connections_title")}>
- <CardOption
+ <OptionCardSection
name="check-for-updates"
label={t("network_connections.check_for_updates")}
description={t("network_connections.check_for_updates_description")}
>
<FormToggle currentValue={checkForUpdates} onChange={setCheckForUpdates} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/password.tsx b/apps/client/src/widgets/type_widgets/options/password.tsx
index a05e7f93b5..242f1eb1e8 100644
--- a/apps/client/src/widgets/type_widgets/options/password.tsx
+++ b/apps/client/src/widgets/type_widgets/options/password.tsx
@@ -13,7 +13,7 @@ import toast from "../../../services/toast";
import { isElectron } from "../../../services/utils";
import { ExtendedAdmonition } from "../../react/Admonition";
import Button from "../../react/Button";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import FormGroup from "../../react/FormGroup";
import FormSelect from "../../react/FormSelect";
import FormText from "../../react/FormText";
@@ -45,7 +45,7 @@ function ChangePassword() {
return (<>
<Card heading={t("password.heading")}>
- <CardOption
+ <OptionCardSection
label={t("password.change_password")}
description={t("password.change_password_description")}
>
@@ -55,9 +55,9 @@ function ChangePassword() {
size="micro"
onClick={() => setShowModal(true)}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("password.reset_password")}
description={t("password.reset_password_description")}
>
@@ -74,7 +74,7 @@ function ChangePassword() {
toast.showError(t("password.reset_success_message"));
}}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
{createPortal(
@@ -172,7 +172,7 @@ function ChangePasswordModal({ show, onHidden }: ChangePasswordModalProps) {
function ProtectedSessionTimeout() {
return (
<Card heading={t("password.protected_session_timeout")}>
- <CardOption
+ <OptionCardSection
name="protected-session-timeout"
label={t("password.protected_session_timeout_label")}
description={<>{t("password.protected_session_timeout_description")} <a class="tn-link" href="https://triliumnext.github.io/Docs/Wiki/protected-notes.html">{t("password.wiki")}</a> {t("password.for_more_info")}</>}
@@ -183,7 +183,7 @@ function ProtectedSessionTimeout() {
optionTimeScaleId="protectedSessionTimeoutTimeScale"
minimumSeconds={60}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -219,7 +219,7 @@ function SignInMethod() {
return (
<>
<Card className="signin-method" heading={t("multi_factor_authentication.authentication_title")}>
- <CardOption name="signin-method" label={t("multi_factor_authentication.signin_method")}>
+ <OptionCardSection name="signin-method" label={t("multi_factor_authentication.signin_method")}>
<FormSelect
values={[
{ value: "local", label: t("multi_factor_authentication.signin_local") },
@@ -229,7 +229,7 @@ function SignInMethod() {
currentValue={usingOAuth ? "oauth" : "local"}
onChange={(value) => setMfaMethod(value === "oauth" ? "oauth" : "totp")}
/>
- </CardOption>
+ </OptionCardSection>
{/* What the chosen method means, below the choice rather than above it — it
describes what was picked, not what is on offer. */}
@@ -323,14 +323,14 @@ function OAuthStatusCard({ status, refreshStatus }: { status?: OAuthStatus, refr
) : enrolled ? (
<>
<OAuthProviderRows status={status} />
- <CardOption label={t("multi_factor_authentication.oauth_user_account")}>
+ <OptionCardSection label={t("multi_factor_authentication.oauth_user_account")}>
<span>{status?.name ?? t("multi_factor_authentication.oauth_user_not_logged_in")}</span>
- </CardOption>
- <CardOption label={t("multi_factor_authentication.oauth_user_email")}>
+ </OptionCardSection>
+ <OptionCardSection label={t("multi_factor_authentication.oauth_user_email")}>
<span>{status?.email ?? t("multi_factor_authentication.oauth_user_not_logged_in")}</span>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("multi_factor_authentication.oauth_disconnect_label")}
description={t("multi_factor_authentication.oauth_disconnect_description")}
>
@@ -342,7 +342,7 @@ function OAuthStatusCard({ status, refreshStatus }: { status?: OAuthStatus, refr
size="micro"
onClick={() => void disconnectAccount()}
/>
- </CardOption>
+ </OptionCardSection>
</>
) : (
<>
@@ -360,7 +360,7 @@ function OAuthStatusCard({ status, refreshStatus }: { status?: OAuthStatus, refr
<OAuthProviderRows status={status} />
- <CardOption
+ <OptionCardSection
label={t("multi_factor_authentication.oauth_connect_label")}
description={t("multi_factor_authentication.oauth_connect_description")}
>
@@ -371,7 +371,7 @@ function OAuthStatusCard({ status, refreshStatus }: { status?: OAuthStatus, refr
size="micro"
onClick={connectAccount}
/>
- </CardOption>
+ </OptionCardSection>
</>
)}
</Card>
@@ -386,16 +386,16 @@ function OAuthProviderRows({ status }: { status?: OAuthStatus }) {
const displayName = oauthProviderDisplayName(status);
return (
<>
- <CardOption label={t("multi_factor_authentication.oauth_provider")}>
+ <OptionCardSection label={t("multi_factor_authentication.oauth_provider")}>
<span className="oauth-provider">
<OAuthProviderIcon src={status?.issuerIcon} />
<span>{displayName}</span>
</span>
- </CardOption>
+ </OptionCardSection>
{ status?.issuerUrl && (
- <CardOption label={t("multi_factor_authentication.oauth_provider_url")}>
+ <OptionCardSection label={t("multi_factor_authentication.oauth_provider_url")}>
<span>{status.issuerUrl}</span>
- </CardOption>
+ </OptionCardSection>
)}
</>
);
diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsx
index 0131e39c12..ac2a6510f8 100644
--- a/apps/client/src/widgets/type_widgets/options/security.tsx
+++ b/apps/client/src/widgets/type_widgets/options/security.tsx
@@ -2,7 +2,7 @@ import { useState } from "preact/hooks";
import { t } from "../../../services/i18n";
import { isElectron } from "../../../services/utils";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import CodeBlock from "../../react/CodeBlock";
import Collapsible from "../../react/Collapsible";
import FormToggle from "../../react/FormToggle";
@@ -98,7 +98,7 @@ function BackendScriptingSettings({ liveValue, pendingValue, setPendingValue }:
description={t("security.backend_scripting_section_description")}
actions={<HelpButton helpPage="SPirpZypehBG" />}
>
- <CardOption
+ <OptionCardSection
name="backend-scripting-enabled"
label={t("security.backend_scripting_label")}
description={hasPendingChange
@@ -106,7 +106,7 @@ function BackendScriptingSettings({ liveValue, pendingValue, setPendingValue }:
: t("security.backend_scripting_description")}
>
<FormToggle currentValue={displayValue} onChange={handleToggle} disabled={!isDesktop} />
- </CardOption>
+ </OptionCardSection>
<ServerConfigHint
configKey="backendScriptingEnabled"
@@ -134,7 +134,7 @@ function SqlConsoleSettings({ liveValue, pendingValue, setPendingValue }: Toggle
description={t("security.sql_console_section_description")}
actions={<HelpButton helpPage="YKWqdJhzi2VY" />}
>
- <CardOption
+ <OptionCardSection
name="sql-console-enabled"
label={t("security.sql_console_label")}
description={hasPendingChange
@@ -142,7 +142,7 @@ function SqlConsoleSettings({ liveValue, pendingValue, setPendingValue }: Toggle
: t("security.sql_console_description")}
>
<FormToggle currentValue={displayValue} onChange={handleToggle} disabled={!isDesktop} />
- </CardOption>
+ </OptionCardSection>
<ServerConfigHint
configKey="sqlConsoleEnabled"
@@ -172,7 +172,7 @@ function LanAccessSettings({ liveValue, pendingValue, setPendingValue }: ToggleS
description={t("security.lan_access_section_description")}
actions={<HelpButton helpPage="swSFivWk6KkA" />}
>
- <CardOption
+ <OptionCardSection
name="lan-access-enabled"
label={t("security.lan_access_label")}
description={hasPendingChange
@@ -180,7 +180,7 @@ function LanAccessSettings({ liveValue, pendingValue, setPendingValue }: ToggleS
: t("security.lan_access_description")}
>
<FormToggle currentValue={displayValue} onChange={handleToggle} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
index bf4a07cec0..09ab8c76c4 100644
--- a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
@@ -16,7 +16,7 @@ import { arrayEqual, isElectron, isMobile, reloadFrontendApp } from "../../../se
import ActionButton from "../../react/ActionButton";
import { Badge } from "../../react/Badge";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import Dropdown from "../../react/Dropdown";
import { FormDropdownDivider, FormListItem } from "../../react/FormList";
import FormTextBox from "../../react/FormTextBox";
@@ -432,7 +432,7 @@ export function filterKeyboardAction(action: ActionKeyboardShortcut, filter: str
*/
function ShortcutRow({ action, conflicts }: { action: ActionKeyboardShortcut; conflicts?: ShortcutConflicts }) {
return (
- <CardOption
+ <OptionCardSection
label={
<>
{isShortcutModified(action) &&
@@ -443,7 +443,7 @@ function ShortcutRow({ action, conflicts }: { action: ActionKeyboardShortcut; co
description={action.description}
>
<ShortcutEditor keyboardShortcut={action} conflicts={conflicts} />
- </CardOption>
+ </OptionCardSection>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/spellcheck.spec.tsx b/apps/client/src/widgets/type_widgets/options/spellcheck.spec.tsx
index 5c889cd6bb..29aada075f 100644
--- a/apps/client/src/widgets/type_widgets/options/spellcheck.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/spellcheck.spec.tsx
@@ -13,7 +13,7 @@ const setSpellCheckLanguageCode = vi.fn();
// `useTriliumOptionBool` drives the enabled state, `useTriliumOption` drives the language codes; both
// return the value plus a setter spy so we can assert the persisted option is written. Partial-mock so
-// other hooks used by sibling components (e.g. `useUniqueName` in OptionsRow) keep their real impl.
+// other hooks used by sibling components (e.g. `useUniqueName` in OptionCardSection) keep their real impl.
vi.mock("../../react/hooks", async (importOriginal) => ({
...(await importOriginal<typeof import("../../react/hooks")>()),
useTriliumOptionBool: vi.fn(() => [true, setSpellCheckEnabled]),
diff --git a/apps/client/src/widgets/type_widgets/options/spellcheck.tsx b/apps/client/src/widgets/type_widgets/options/spellcheck.tsx
index 466d940856..deccf757b4 100644
--- a/apps/client/src/widgets/type_widgets/options/spellcheck.tsx
+++ b/apps/client/src/widgets/type_widgets/options/spellcheck.tsx
@@ -4,7 +4,7 @@ import appContext from "../../../components/app_context";
import { t } from "../../../services/i18n";
import { isElectron } from "../../../services/utils";
import Button from "../../react/Button";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import FormToggle from "../../react/FormToggle";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import NoItems from "../../react/NoItems";
@@ -44,14 +44,14 @@ function ElectronSpellcheckSettings() {
header — on the row below the title, clear of the dialog's own close button. */}
<OptionsPageHeader
below={
- <CardOption
+ <OptionCardSection
className="options-header-switch"
name="spellcheck-enabled"
label={t("spellcheck.enable")}
description={t("spellcheck.enable_description")}
>
<FormToggle currentValue={spellCheckEnabled} onChange={onToggle} />
- </CardOption>
+ </OptionCardSection>
}
/>
@@ -123,7 +123,7 @@ function CustomDictionary() {
heading={t("spellcheck.custom_dictionary_title")}
description={t("spellcheck.custom_dictionary_description")}
>
- <CardOption
+ <OptionCardSection
label={t("spellcheck.custom_dictionary_edit")}
description={t("spellcheck.custom_dictionary_edit_description")}
>
@@ -134,7 +134,7 @@ function CustomDictionary() {
size="micro"
onClick={openDictionary}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/sync.tsx b/apps/client/src/widgets/type_widgets/options/sync.tsx
index 941e127f15..c3183ab8c4 100644
--- a/apps/client/src/widgets/type_widgets/options/sync.tsx
+++ b/apps/client/src/widgets/type_widgets/options/sync.tsx
@@ -5,7 +5,7 @@ import { t } from "../../../services/i18n";
import server from "../../../services/server";
import toast from "../../../services/toast";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import FormTextBox from "../../react/FormTextBox";
import { useTriliumOption } from "../../react/hooks";
import OptionsPageHeader from "./components/OptionsPageHeader";
@@ -53,7 +53,7 @@ export function SyncConfiguration() {
return (
<>
<Card heading={t("sync_2.config_title")}>
- <CardOption
+ <OptionCardSection
name="sync-server-host"
label={t("sync_2.server_address")}
description={t("sync_2.server_address_description")}
@@ -65,9 +65,9 @@ export function SyncConfiguration() {
onChange={setLocalHost}
onBlur={setSyncServerHost}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="sync-proxy"
label={t("sync_2.proxy_label")}
description={t("sync_2.proxy_description")}
@@ -79,9 +79,9 @@ export function SyncConfiguration() {
onChange={setLocalProxy}
onBlur={setSyncProxy}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="sync-server-timeout"
label={t("sync_2.timeout")}
description={t("sync_2.timeout_description")}
@@ -92,11 +92,11 @@ export function SyncConfiguration() {
optionTimeScaleId="syncServerTimeoutTimeScale"
minimumSeconds={1}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
<Card>
- <CardOption
+ <OptionCardSection
label={t("sync_2.test_title")}
description={t("sync_2.test_description")}
>
@@ -106,7 +106,7 @@ export function SyncConfiguration() {
size="micro"
onClick={() => void testConnection()}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
</>
);
diff --git a/apps/client/src/widgets/type_widgets/options/text_notes.tsx b/apps/client/src/widgets/type_widgets/options/text_notes.tsx
index 7ff496dfc4..dba25b25bf 100644
--- a/apps/client/src/widgets/type_widgets/options/text_notes.tsx
+++ b/apps/client/src/widgets/type_widgets/options/text_notes.tsx
@@ -10,7 +10,7 @@ import { t } from "../../../services/i18n";
import { ensureMimeTypesForHighlighting, loadHighlightingTheme } from "../../../services/syntax_highlight";
import { formatDateTime, toggleBodyClass } from "../../../services/utils";
import ActionButton from "../../react/ActionButton";
-import { Card, CardOption, CardSection } from "../../react/Card";
+import { Card, CardSection, OptionCardSection } from "../../react/Card";
import Dropdown from "../../react/Dropdown";
import FormGroup from "../../react/FormGroup";
import { FormListItem } from "../../react/FormList";
@@ -58,7 +58,7 @@ function FormattingToolbar() {
return (
<Card heading={t("editing.editor_type.label")}>
- <CardOption
+ <OptionCardSection
name="multiline-toolbar"
label={t("editing.editor_type.multiline-toolbar")}
>
@@ -68,7 +68,7 @@ function FormattingToolbar() {
// Nothing to wrap onto a second line where the toolbar follows the cursor.
disabled={textNoteEditorType === "ckeditor-balloon"}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -157,53 +157,53 @@ function EditorFeatures() {
return (
<Card heading={t("editorfeatures.title")}>
- <CardOption
+ <OptionCardSection
name="emoji-completion-enabled"
label={t("editorfeatures.emoji_completion_enabled")}
description={t("editorfeatures.emoji_completion_description")}
>
<FormToggle currentValue={emojiCompletionEnabled} onChange={setEmojiCompletionEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="auto-link-previews-enabled"
label={t("editorfeatures.auto_link_previews_enabled")}
description={t("editorfeatures.auto_link_previews_description")}
>
<FormToggle currentValue={autoLinkPreviewsEnabled} onChange={setAutoLinkPreviewsEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="note-completion-enabled"
label={t("editorfeatures.note_completion_enabled")}
description={t("editorfeatures.note_completion_description")}
>
<FormToggle currentValue={noteCompletionEnabled} onChange={setNoteCompletionEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="slash-commands-enabled"
label={t("editorfeatures.slash_commands_enabled")}
description={t("editorfeatures.slash_commands_description")}
>
<FormToggle currentValue={slashCommandsEnabled} onChange={setSlashCommandsEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="content-hints-enabled"
label={t("editorfeatures.content_hints_enabled")}
description={t("editorfeatures.content_hints_description")}
>
<FormToggle currentValue={contentHintsEnabled} onChange={setContentHintsEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="html-support-enabled"
label={t("editorfeatures.html_support_enabled")}
description={t("editorfeatures.html_support_description")}
>
<FormToggle currentValue={htmlSupportEnabled} onChange={setHtmlSupportEnabled} />
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -225,45 +225,45 @@ function AutomaticReplacements() {
heading={t("automatic_replacements.title")}
description={t("automatic_replacements.description")}
>
- <CardOption
+ <OptionCardSection
name="double-quote-style"
label={t("automatic_replacements.double_quotes")}
description={t("automatic_replacements.double_quotes_description")}
>
<QuoteStyleSelect currentValue={doubleQuoteStyle} onChange={setDoubleQuoteStyle} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="single-quote-style"
label={t("automatic_replacements.single_quotes")}
description={t("automatic_replacements.single_quotes_description")}
>
<QuoteStyleSelect currentValue={singleQuoteStyle} onChange={setSingleQuoteStyle} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="punctuation-replacements-enabled"
label={t("automatic_replacements.punctuation")}
description={t("automatic_replacements.punctuation_description")}
>
<FormToggle currentValue={punctuationEnabled} onChange={setPunctuationEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="math-replacements-enabled"
label={t("automatic_replacements.math")}
description={t("automatic_replacements.math_description")}
>
<FormToggle currentValue={mathEnabled} onChange={setMathEnabled} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="symbol-replacements-enabled"
label={t("automatic_replacements.symbols")}
description={t("automatic_replacements.symbols_description")}
>
<FormToggle currentValue={symbolsEnabled} onChange={setSymbolsEnabled} />
- </CardOption>
+ </OptionCardSection>
<CustomReplacements />
</Card>
@@ -341,7 +341,7 @@ export function CustomReplacements() {
}
return (
- <CardOption
+ <OptionCardSection
className="custom-replacements"
label={t("automatic_replacements.custom")}
description={t("automatic_replacements.custom_description")}
@@ -417,15 +417,15 @@ function Editor() {
return (
<Card className="text-notes-editor" heading={t("text_editor.title")}>
- <CardOption
+ <OptionCardSection
name="heading-style"
label={t("heading_style.title")}
description={t("heading_style.description")}
>
<HeadingStyleSelector currentValue={headingStyle} onChange={setHeadingStyle} />
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="auto-readonly-size-text"
label={t("text_auto_read_only_size.label")}
description={t("text_auto_read_only_size.description")}
@@ -436,9 +436,9 @@ function Editor() {
currentValue={autoReadonlySize}
onBlur={setAutoReadonlySize}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
name="custom-date-time-format"
label={t("custom_date_time_format.title")}
description={<>{t("custom_date_time_format.description_short")} {t("custom_date_time_format.preview", { preview: formatDateTime(new Date(), customDateTimeFormat) })}</>}
@@ -447,7 +447,7 @@ function Editor() {
placeholder="YYYY-MM-DD HH:mm"
currentValue={customDateTimeFormat || "YYYY-MM-DD HH:mm"} onBlur={setCustomDateTimeFormat}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}
@@ -556,37 +556,37 @@ function CodeBlockStyle() {
{matchesApp ? (
<>
- <CardOption name="light-theme" label={t("code_theme.light_theme")}>
+ <OptionCardSection name="light-theme" label={t("code_theme.light_theme")}>
<FormSelect
values={lightThemes}
keyProperty="val" titleProperty="title"
currentValue={lightTheme} onChange={setLightTheme}
/>
- </CardOption>
- <CardOption name="dark-theme" label={t("code_theme.dark_theme")}>
+ </OptionCardSection>
+ <OptionCardSection name="dark-theme" label={t("code_theme.dark_theme")}>
<FormSelect
values={darkThemes}
keyProperty="val" titleProperty="title"
currentValue={darkTheme} onChange={setDarkTheme}
/>
- </CardOption>
+ </OptionCardSection>
</>
) : (
- <CardOption name="code-block-theme" label={t("highlighting.color-scheme")}>
+ <OptionCardSection name="code-block-theme" label={t("highlighting.color-scheme")}>
<FormSelectWithGroups
values={groupedThemes}
keyProperty="val" titleProperty="title"
currentValue={codeBlockTheme} onChange={setCodeBlockTheme}
/>
- </CardOption>
+ </OptionCardSection>
)}
- <CardOption name="code-block-word-wrap" label={t("code_block.word_wrapping")}>
+ <OptionCardSection name="code-block-word-wrap" label={t("code_block.word_wrapping")}>
<FormToggle currentValue={codeBlockWordWrap} onChange={setCodeBlockWordWrap} />
- </CardOption>
+ </OptionCardSection>
{/* Avoid using "code" in the name of numeric inputs to prevent KeepassXC from triggering. */}
- <CardOption name="block-tab-width" label={t("code_block.tab_width")}>
+ <OptionCardSection name="block-tab-width" label={t("code_block.tab_width")}>
<FormTextBoxWithUnit
type="number" min={1} max={16} step={1}
unit={t("code_block.tab_width_unit")}
@@ -594,7 +594,7 @@ function CodeBlockStyle() {
onChange={setCodeBlockTabWidth}
onBlur={setCodeBlockTabWidth}
/>
- </CardOption>
+ </OptionCardSection>
<CardSection className="code-block-preview">
<CodeBlockPreview theme={effectiveTheme} wordWrap={codeBlockWordWrap} tabWidth={codeBlockTabWidth} />
diff --git a/apps/client/src/widgets/type_widgets/options/totp.tsx b/apps/client/src/widgets/type_widgets/options/totp.tsx
index 742337e4cd..5771295ba8 100644
--- a/apps/client/src/widgets/type_widgets/options/totp.tsx
+++ b/apps/client/src/widgets/type_widgets/options/totp.tsx
@@ -14,7 +14,7 @@ import toast from "../../../services/toast";
import utils from "../../../services/utils";
import Admonition from "../../react/Admonition";
import Button from "../../react/Button";
-import { Card, CardOption } from "../../react/Card";
+import { Card, OptionCardSection } from "../../react/Card";
import FormCheckbox from "../../react/FormCheckbox";
import FormGroup from "../../react/FormGroup";
import FormText from "../../react/FormText";
@@ -125,7 +125,7 @@ export function TotpSettings({ totpStatus, refreshTotpStatus }: {
onRemoveTotp={removeTotp}
/>
: <Card heading={t("multi_factor_authentication.totp_section_title")} actions={totpBadge}>
- <CardOption
+ <OptionCardSection
label={t("multi_factor_authentication.totp_setup_label")}
description={t("multi_factor_authentication.totp_setup_description")}
>
@@ -136,7 +136,7 @@ export function TotpSettings({ totpStatus, refreshTotpStatus }: {
size="micro"
onClick={() => setShowEnroll(true)}
/>
- </CardOption>
+ </OptionCardSection>
</Card>}
{createPortal(
@@ -505,7 +505,7 @@ function TotpRecoveryKeys({ badge, status, onRegenerate, onRemoveTotp }: {
return (
<Card heading={t("multi_factor_authentication.totp_section_title")} actions={badge}>
- <CardOption
+ <OptionCardSection
label={
<span className="recovery-codes-title">
{t("multi_factor_authentication.recovery_keys_label")}
@@ -523,9 +523,9 @@ function TotpRecoveryKeys({ badge, status, onRegenerate, onRemoveTotp }: {
size="micro"
onClick={onRegenerate}
/>
- </CardOption>
+ </OptionCardSection>
- <CardOption
+ <OptionCardSection
label={t("multi_factor_authentication.totp_remove_label")}
description={t("multi_factor_authentication.totp_remove_description")}
>
@@ -537,7 +537,7 @@ function TotpRecoveryKeys({ badge, status, onRegenerate, onRemoveTotp }: {
size="micro"
onClick={onRemoveTotp}
/>
- </CardOption>
+ </OptionCardSection>
</Card>
);
}