mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 17:26:26 +01:00
Merge branch 'feature/add-basic-authentication' of https://github.com/ajnart/homarr into feature/add-basic-authentication
This commit is contained in:
@@ -1,76 +1,25 @@
|
||||
import { Alert, Stack, Switch } from '@mantine/core';
|
||||
import { IconInfoCircle } from '@tabler/icons-react';
|
||||
import { BaseSyntheticEvent } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useConfigContext } from '../../../../config/provider';
|
||||
import { useConfigStore } from '../../../../config/store';
|
||||
import { useFormContext } from '~/pages/user/preferences';
|
||||
|
||||
export const AccessibilitySettings = () => {
|
||||
const { t } = useTranslation('settings/customization/accessibility');
|
||||
const { updateConfig } = useConfigStore();
|
||||
const { config, name: configName } = useConfigContext();
|
||||
|
||||
const form = useFormContext();
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Switch
|
||||
label={t('disablePulse.label')}
|
||||
description={t('disablePulse.description')}
|
||||
defaultChecked={config?.settings.customization.accessibility?.disablePingPulse ?? false}
|
||||
onChange={(value: BaseSyntheticEvent) => {
|
||||
if (!configName) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig(
|
||||
configName,
|
||||
(previousConfig) => ({
|
||||
...previousConfig,
|
||||
settings: {
|
||||
...previousConfig.settings,
|
||||
customization: {
|
||||
...previousConfig.settings.customization,
|
||||
accessibility: {
|
||||
...previousConfig.settings.customization.accessibility,
|
||||
disablePingPulse: value.target.checked,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}}
|
||||
{...form.getInputProps('disablePingPulse')}
|
||||
/>
|
||||
|
||||
<Switch
|
||||
label={t('replaceIconsWithDots.label')}
|
||||
description={t('replaceIconsWithDots.description')}
|
||||
defaultChecked={config?.settings.customization.accessibility?.disablePingPulse ?? false}
|
||||
onChange={(value: BaseSyntheticEvent) => {
|
||||
if (!configName) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig(
|
||||
configName,
|
||||
(previousConfig) => ({
|
||||
...previousConfig,
|
||||
settings: {
|
||||
...previousConfig.settings,
|
||||
customization: {
|
||||
...previousConfig.settings.customization,
|
||||
accessibility: {
|
||||
...previousConfig.settings.customization.accessibility,
|
||||
replacePingDotsWithIcons: value.target.checked,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}}
|
||||
{...form.getInputProps('replaceDotsWithIcons')}
|
||||
/>
|
||||
|
||||
<Alert icon={<IconInfoCircle size="1rem" />} color="blue">
|
||||
|
||||
Reference in New Issue
Block a user