From 725f9f5509c3b34079923fad47096b108568ccd6 Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 20 Sep 2024 21:56:33 +0800 Subject: [PATCH] fix: import circular and copywrite i18n Signed-off-by: Innei --- .../src/modules/settings/tabs/general.tsx | 201 +++++++++--------- .../src/pages/settings/(settings)/general.tsx | 8 +- 2 files changed, 105 insertions(+), 104 deletions(-) diff --git a/apps/renderer/src/modules/settings/tabs/general.tsx b/apps/renderer/src/modules/settings/tabs/general.tsx index c31c63747d..c37059eac5 100644 --- a/apps/renderer/src/modules/settings/tabs/general.tsx +++ b/apps/renderer/src/modules/settings/tabs/general.tsx @@ -31,7 +31,6 @@ import { clearLocalPersistStoreData } from "~/store/utils/clear" import { SettingDescription, SettingInput } from "../control" import { SettingItemGroup } from "../section" -import { SettingsTitle } from "../title" const { defineSettingItem, SettingBuilder } = createSetting( useGeneralSettingValue, @@ -54,120 +53,116 @@ export const SettingGeneral = () => { const { present } = useModalStack() return ( - <> - -
- + { - present({ - title: t("general.rebuild_database.title"), - clickOutsideToDismiss: true, - content: () => ( -
-

{t("general.rebuild_database.warning.line1")}

-

{t("general.rebuild_database.warning.line2")}

-
- -
+ defineSettingItem("sendAnonymousData", { + label: t("general.send_anonymous_data.label"), + description: t("general.send_anonymous_data.description"), + onChange(value) { + setGeneralSetting("sendAnonymousData", value) + if (value) { + initPostHog() + } else { + window.posthog?.reset() + delete window.posthog + } + }, + }), + { + label: t("general.rebuild_database.label"), + action: async () => { + present({ + title: t("general.rebuild_database.title"), + clickOutsideToDismiss: true, + content: () => ( +
+

{t("general.rebuild_database.warning.line1")}

+

{t("general.rebuild_database.warning.line2")}

+
+
- ), - }) - }, - description: t("general.rebuild_database.description"), - buttonText: t("general.rebuild_database.button"), +
+ ), + }) }, + description: t("general.rebuild_database.description"), + buttonText: t("general.rebuild_database.button"), + }, - { type: "title", value: t("general.network"), disabled: !window.electron }, - window.electron && NettingSetting, - ]} - /> -
- + { type: "title", value: t("general.network"), disabled: !window.electron }, + window.electron && NettingSetting, + ]} + /> +
) } diff --git a/apps/renderer/src/pages/settings/(settings)/general.tsx b/apps/renderer/src/pages/settings/(settings)/general.tsx index 54f2190901..23f2998d32 100644 --- a/apps/renderer/src/pages/settings/(settings)/general.tsx +++ b/apps/renderer/src/pages/settings/(settings)/general.tsx @@ -1,4 +1,5 @@ import { SettingGeneral } from "~/modules/settings/tabs/general" +import { SettingsTitle } from "~/modules/settings/title" import { defineSettingPageData } from "~/modules/settings/utils" const iconName = "i-mgc-settings-7-cute-re" @@ -11,5 +12,10 @@ export const loader = defineSettingPageData({ }) export function Component() { - return + return ( + <> + + + + ) }