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(react/settings): port advanced sync options
Elian Doran96eb1be55609
diff --git a/apps/client/src/widgets/type_widgets/content_widget.tsx b/apps/client/src/widgets/type_widgets/content_widget.tsxindex ec68cc5ea0..a5178c372e 100644--- a/apps/client/src/widgets/type_widgets/content_widget.tsx+++ b/apps/client/src/widgets/type_widgets/content_widget.tsx@@ -1,8 +1,4 @@import TypeWidget from "./type_widget.js";-import ElectronIntegrationOptions from "./options/appearance/electron_integration.js";-import ThemeOptions from "./options/appearance/theme.js";-import FontsOptions from "./options/appearance/fonts.js";-import MaxContentWidthOptions from "./options/appearance/max_content_width.js";import KeyboardShortcutsOptions from "./options/shortcuts.js";import HeadingStyleOptions from "./options/text_notes/heading_style.js";import TableOfContentsOptions from "./options/text_notes/table_of_contents.js";@@ -12,7 +8,6 @@ import DateTimeFormatOptions from "./options/text_notes/date_time_format.js";import CodeEditorOptions from "./options/code_notes/code_editor.js";import CodeAutoReadOnlySizeOptions from "./options/code_notes/code_auto_read_only_size.js";import CodeMimeTypesOptions from "./options/code_notes/code_mime_types.js";-import ImageOptions from "./options/images/images.js";import SpellcheckOptions from "./options/spellcheck.js";import PasswordOptions from "./options/password/password.js";import ProtectedSessionTimeoutOptions from "./options/password/protected_session_timeout.js";@@ -50,6 +45,7 @@ import type { JSX } from "preact/jsx-runtime";import AppearanceSettings from "./options/appearance.jsx";import { renderReactWidget } from "../react/ReactBasicWidget.jsx";import ImageSettings from "./options/images.jsx";+import AdvancedSettings from "./options/advanced.jsx";const TPL = /*html*/`<div class="note-detail-content-widget note-detail-printable"><style>@@ -131,12 +127,7 @@ const CONTENT_WIDGETS: Record<OptionPages | "_backendLog", ((typeof NoteContextALocalizationOptions,LanguageOptions],- _optionsAdvanced: [- AdvancedSyncOptions,- DatabaseIntegrityCheckOptions,- DatabaseAnonymizationOptions,- VacuumDatabaseOptions- ],+ _optionsAdvanced: <AdvancedSettings />,_backendLog: [BackendLogWidget]diff --git a/apps/client/src/widgets/type_widgets/options/advanced.tsx b/apps/client/src/widgets/type_widgets/options/advanced.tsxnew file mode 100644index 0000000000..e2d8ec1c2c--- /dev/null+++ b/apps/client/src/widgets/type_widgets/options/advanced.tsx@@ -0,0 +1,34 @@+import { t } from "../../../services/i18n";+import server from "../../../services/server";+import toast from "../../../services/toast";+import Button from "../../react/Button";+import OptionsSection from "./components/OptionsSection"++export default function AdvancedSettings() {+ return <>+ <AdvancedSyncOptions />+ </>;+}++function AdvancedSyncOptions() {+ return (+ <OptionsSection title={t("sync.title")}>+ <Button+ text={t("sync.force_full_sync_button")}+ onClick={async () => {+ await server.post("sync/force-full-sync");+ toast.showMessage(t("sync.full_sync_triggered"));+ }}+ />++ <Button+ text={t("sync.fill_entity_changes_button")}+ onClick={async () => {+ toast.showMessage(t("sync.filling_entity_changes"));+ await server.post("sync/fill-entity-changes");+ toast.showMessage(t("sync.sync_rows_filled_successfully"));+ }}+ />+ </OptionsSection>+ );+}\ No newline at end of filediff --git a/apps/client/src/widgets/type_widgets/options/advanced/sync.ts b/apps/client/src/widgets/type_widgets/options/advanced/sync.tsdeleted file mode 100644index 503ad1b3ab..0000000000--- a/apps/client/src/widgets/type_widgets/options/advanced/sync.ts+++ /dev/null@@ -1,40 +0,0 @@-import OptionsWidget from "../options_widget.js";-import server from "../../../../services/server.js";-import toastService from "../../../../services/toast.js";-import { t } from "../../../../services/i18n.js";-import type { OptionMap } from "@triliumnext/commons";--const TPL = /*html*/`-<div class="options-section">- <h4>${t("sync.title")}</h4>- <button class="force-full-sync-button btn btn-secondary">${t("sync.force_full_sync_button")}</button>-- <button class="fill-entity-changes-button btn btn-secondary">${t("sync.fill_entity_changes_button")}</button>-</div>`;--export default class AdvancedSyncOptions extends OptionsWidget {-- private $forceFullSyncButton!: JQuery<HTMLElement>;- private $fillEntityChangesButton!: JQuery<HTMLElement>;-- doRender() {- this.$widget = $(TPL);- this.$forceFullSyncButton = this.$widget.find(".force-full-sync-button");- this.$fillEntityChangesButton = this.$widget.find(".fill-entity-changes-button");- this.$forceFullSyncButton.on("click", async () => {- await server.post("sync/force-full-sync");-- toastService.showMessage(t("sync.full_sync_triggered"));- });-- this.$fillEntityChangesButton.on("click", async () => {- toastService.showMessage(t("sync.filling_entity_changes"));-- await server.post("sync/fill-entity-changes");-- toastService.showMessage(t("sync.sync_rows_filled_successfully"));- });- }-- async optionsLoaded(options: OptionMap) {}-}