mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-18 01:14:22 +02:00
optimize settings store
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { memo } from 'react';
|
||||
import { Fragment } from 'react/jsx-runtime';
|
||||
|
||||
import { AnalyticsSettings } from '/@/renderer/features/settings/components/advanced/analytics-settings';
|
||||
@@ -16,7 +17,7 @@ const sections = [
|
||||
{ component: CacheSettings, key: 'cache' },
|
||||
];
|
||||
|
||||
export const AdvancedTab = () => {
|
||||
export const AdvancedTab = memo(() => {
|
||||
return (
|
||||
<Stack gap="md">
|
||||
{sections.map(({ component: Section, key }, index) => (
|
||||
@@ -27,4 +28,4 @@ export const AdvancedTab = () => {
|
||||
))}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import {
|
||||
@@ -6,7 +7,7 @@ import {
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
import { Switch } from '/@/shared/components/switch/switch';
|
||||
|
||||
export const AnalyticsSettings = () => {
|
||||
export const AnalyticsSettings = memo(() => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleToggleAnalytics = (disable: boolean) => {
|
||||
@@ -36,4 +37,4 @@ export const AnalyticsSettings = () => {
|
||||
title={t('page.setting.analytics', { postProcess: 'sentenceCase' })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { openModal } from '@mantine/modals';
|
||||
import { t } from 'i18next';
|
||||
import { useCallback } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
|
||||
import { ExportImportSettingsModal } from '/@/renderer/components/export-import-settings-modal/export-import-settings-modal';
|
||||
import {
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import { useSettingsForExport } from '/@/renderer/store';
|
||||
import { Button } from '/@/shared/components/button/button';
|
||||
|
||||
export const ExportImportSettings = () => {
|
||||
export const ExportImportSettings = memo(() => {
|
||||
const settingForExport = useSettingsForExport();
|
||||
|
||||
const onExportSettings = useCallback(() => {
|
||||
@@ -68,4 +68,4 @@ export const ExportImportSettings = () => {
|
||||
title={t('page.setting.exportImport', { postProcess: 'sentenceCase' })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import {
|
||||
@@ -9,7 +10,7 @@ import { Select } from '/@/shared/components/select/select';
|
||||
|
||||
const DEFAULT_LOG_LEVEL: LogLevel = process.env.NODE_ENV === 'production' ? 'info' : 'debug';
|
||||
|
||||
export const LoggerSettings = () => {
|
||||
export const LoggerSettings = memo(() => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const getCurrentLogLevel = (): LogLevel => {
|
||||
@@ -84,4 +85,4 @@ export const LoggerSettings = () => {
|
||||
title={t('page.setting.logger', { postProcess: 'sentenceCase' })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { memo, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { SettingsOptions } from '/@/renderer/features/settings/components/settings-option';
|
||||
@@ -10,7 +10,7 @@ import { Switch } from '/@/shared/components/switch/switch';
|
||||
import { Text } from '/@/shared/components/text/text';
|
||||
import { Textarea } from '/@/shared/components/textarea/textarea';
|
||||
|
||||
export const StylesSettings = () => {
|
||||
export const StylesSettings = memo(() => {
|
||||
const [open, setOpen] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -108,4 +108,4 @@ export const StylesSettings = () => {
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user