mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 19:01:40 +00:00
[enhancement]: support serach on settings page
This commit is contained in:
parent
683bb0222c
commit
645697367d
21 changed files with 439 additions and 385 deletions
|
|
@ -3,8 +3,11 @@ import { useQueryClient } from '@tanstack/react-query';
|
|||
import isElectron from 'is-electron';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, ConfirmModal, toast } from '/@/renderer/components';
|
||||
import { SettingsOptions } from '/@/renderer/features/settings/components/settings-option';
|
||||
import { useCallback, useState } from 'react';
|
||||
import {
|
||||
SettingOption,
|
||||
SettingsSection,
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
|
||||
const browser = isElectron() ? window.electron.browser : null;
|
||||
|
||||
|
|
@ -50,42 +53,46 @@ export const CacheSettings = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const options: SettingOption[] = [
|
||||
{
|
||||
control: (
|
||||
<Button
|
||||
compact
|
||||
disabled={isClearing}
|
||||
variant="filled"
|
||||
onClick={() => openResetConfirmModal(false)}
|
||||
>
|
||||
{t('common.clear', { postProcess: 'sentenceCase' })}
|
||||
</Button>
|
||||
),
|
||||
description: t('setting.clearQueryCache', {
|
||||
context: 'description',
|
||||
}),
|
||||
title: t('setting.clearQueryCache'),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<Button
|
||||
compact
|
||||
disabled={isClearing}
|
||||
variant="filled"
|
||||
onClick={() => openResetConfirmModal(true)}
|
||||
>
|
||||
{t('common.clear', { postProcess: 'sentenceCase' })}
|
||||
</Button>
|
||||
),
|
||||
description: t('setting.clearCache', {
|
||||
context: 'description',
|
||||
}),
|
||||
isHidden: !browser,
|
||||
title: t('setting.clearCache'),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsOptions
|
||||
control={
|
||||
<Button
|
||||
compact
|
||||
disabled={isClearing}
|
||||
variant="filled"
|
||||
onClick={() => openResetConfirmModal(false)}
|
||||
>
|
||||
{t('common.clear', { postProcess: 'sentenceCase' })}
|
||||
</Button>
|
||||
}
|
||||
description={t('setting.clearQueryCache', {
|
||||
context: 'description',
|
||||
})}
|
||||
title={t('setting.clearQueryCache')}
|
||||
/>
|
||||
{browser && (
|
||||
<SettingsOptions
|
||||
control={
|
||||
<Button
|
||||
compact
|
||||
disabled={isClearing}
|
||||
variant="filled"
|
||||
onClick={() => openResetConfirmModal(true)}
|
||||
>
|
||||
{t('common.clear', { postProcess: 'sentenceCase' })}
|
||||
</Button>
|
||||
}
|
||||
description={t('setting.clearCache', {
|
||||
context: 'description',
|
||||
})}
|
||||
title={t('setting.clearCache')}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
<SettingsSection
|
||||
divider={false}
|
||||
options={options}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,5 +52,10 @@ export const PasswordSettings = () => {
|
|||
},
|
||||
];
|
||||
|
||||
return <SettingsSection options={updateOptions} />;
|
||||
return (
|
||||
<SettingsSection
|
||||
divider={false}
|
||||
options={updateOptions}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
import { Switch } from '/@/renderer/components';
|
||||
|
||||
const localSettings = isElectron() ? window.electron.localSettings : null;
|
||||
const utils = isElectron() ? window.electron.utils : null;
|
||||
|
||||
export const UpdateSettings = () => {
|
||||
const { t } = useTranslation();
|
||||
|
|
@ -42,5 +43,10 @@ export const UpdateSettings = () => {
|
|||
},
|
||||
];
|
||||
|
||||
return <SettingsSection options={updateOptions} />;
|
||||
return (
|
||||
<SettingsSection
|
||||
divider={utils?.isLinux()}
|
||||
options={updateOptions}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Divider, Stack } from '@mantine/core';
|
||||
import { Stack } from '@mantine/core';
|
||||
import { UpdateSettings } from '/@/renderer/features/settings/components/window/update-settings';
|
||||
import { WindowSettings } from '/@/renderer/features/settings/components/window/window-settings';
|
||||
import { DiscordSettings } from '/@/renderer/features/settings/components/window/discord-settings';
|
||||
|
|
@ -11,13 +11,10 @@ export const WindowTab = () => {
|
|||
return (
|
||||
<Stack spacing="md">
|
||||
<WindowSettings />
|
||||
<Divider />
|
||||
<DiscordSettings />
|
||||
<Divider />
|
||||
<UpdateSettings />
|
||||
{utils?.isLinux() && (
|
||||
<>
|
||||
<Divider />
|
||||
<PasswordSettings />
|
||||
</>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue