mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-17 14:10:14 +02:00
add umami analytics integration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Fragment } from 'react/jsx-runtime';
|
||||
|
||||
import { AnalyticsSettings } from '/@/renderer/features/settings/components/advanced/analytics-settings';
|
||||
import { ExportImportSettings } from '/@/renderer/features/settings/components/advanced/export-import-settings';
|
||||
import { CacheSettings } from '/@/renderer/features/settings/components/window/cache-settngs';
|
||||
import { UpdateSettings } from '/@/renderer/features/settings/components/window/update-settings';
|
||||
@@ -8,6 +9,7 @@ import { Stack } from '/@/shared/components/stack/stack';
|
||||
|
||||
const sections = [
|
||||
{ component: UpdateSettings, key: 'update' },
|
||||
{ component: AnalyticsSettings, key: 'analytics' },
|
||||
{ component: ExportImportSettings, key: 'export-import' },
|
||||
{ component: CacheSettings, key: 'cache' },
|
||||
];
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import {
|
||||
SettingOption,
|
||||
SettingsSection,
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
import { Switch } from '/@/shared/components/switch/switch';
|
||||
|
||||
export const AnalyticsSettings = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleToggleAnalytics = (disable: boolean) => {
|
||||
if (disable) {
|
||||
localStorage.setItem('umami.disabled', '1');
|
||||
} else {
|
||||
localStorage.removeItem('umami.disabled');
|
||||
}
|
||||
};
|
||||
|
||||
const analyticsOptions: SettingOption[] = [
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
defaultChecked={localStorage.getItem('umami.disabled') === '1'}
|
||||
onChange={(e) => handleToggleAnalytics(e.currentTarget.checked)}
|
||||
/>
|
||||
),
|
||||
description: t('setting.analyticsDisable_description', { postProcess: 'sentenceCase' }),
|
||||
title: t('setting.analyticsDisable', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<SettingsSection
|
||||
options={analyticsOptions}
|
||||
title={t('page.setting.analytics', { postProcess: 'sentenceCase' })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user