mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2026-08-27 04:17:08 +00:00
review fix
This commit is contained in:
parent
3e233c241f
commit
821f350ddc
6 changed files with 27 additions and 4 deletions
|
|
@ -26,6 +26,7 @@ type Props = {
|
|||
divider?: boolean;
|
||||
align?: 'top' | 'center';
|
||||
largeTitle?: boolean;
|
||||
inputClassName?: string;
|
||||
};
|
||||
|
||||
export const SettingRow = (props: Props) => {
|
||||
|
|
@ -142,7 +143,7 @@ export const SettingRow = (props: Props) => {
|
|||
<div class={s.divider} />
|
||||
</Show>
|
||||
<div
|
||||
class={cn(s.input, props.largeTitle && s.largeTitle)}
|
||||
class={cn(s.input, props.inputClassName, props.largeTitle && s.largeTitle)}
|
||||
onClick={handleInputClick}
|
||||
>
|
||||
<Show when={isSwitchVariant()}>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {
|
|||
setDhcpConfig,
|
||||
resetDhcp,
|
||||
} from 'panel/stores/dhcp';
|
||||
import { addErrorToast } from 'panel/stores/toasts';
|
||||
import { addWarningToast } from 'panel/stores/toasts';
|
||||
|
||||
import { DhcpToggle } from './blocks/DhcpToggle';
|
||||
import { InterfaceSelector } from './blocks/InterfaceSelector';
|
||||
|
|
@ -78,7 +78,7 @@ export const Dhcp = () => {
|
|||
check &&
|
||||
(check.v4?.other_server?.found === 'yes' || check.v6?.other_server?.found === 'yes')
|
||||
) {
|
||||
addErrorToast({ error: intl.getMessage('dhcp_warning') });
|
||||
addWarningToast({ error: intl.getMessage('dhcp_warning') });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -40,3 +40,7 @@
|
|||
.sectionTitle {
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.queryLogSwitch {
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ export const Settings = () => {
|
|||
enabled: v,
|
||||
})
|
||||
}
|
||||
inputClassName={s.queryLogSwitch}
|
||||
/>
|
||||
|
||||
<SettingRow
|
||||
|
|
|
|||
|
|
@ -565,6 +565,7 @@ export const TOAST_TYPES = {
|
|||
SUCCESS: 'success',
|
||||
ERROR: 'error',
|
||||
NOTICE: 'notice',
|
||||
WARNING: 'warning',
|
||||
};
|
||||
|
||||
export const SUCCESS_TOAST_TIMEOUT = 5000;
|
||||
|
|
@ -576,6 +577,7 @@ export const TOAST_TIMEOUTS = {
|
|||
[TOAST_TYPES.SUCCESS]: SUCCESS_TOAST_TIMEOUT,
|
||||
[TOAST_TYPES.ERROR]: FAILURE_TOAST_TIMEOUT,
|
||||
[TOAST_TYPES.NOTICE]: FAILURE_TOAST_TIMEOUT,
|
||||
[TOAST_TYPES.WARNING]: FAILURE_TOAST_TIMEOUT,
|
||||
};
|
||||
|
||||
export const ADDRESS_TYPES = {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ type ToastAction = {
|
|||
type ToastNotice = {
|
||||
id: string;
|
||||
message: any;
|
||||
type: 'error' | 'success' | 'notice';
|
||||
type: 'error' | 'success' | 'notice' | 'warning';
|
||||
actionLabel?: string;
|
||||
undoId?: string;
|
||||
action?: ToastAction;
|
||||
|
|
@ -80,6 +80,21 @@ export const addSuccessToast = (message: any) => {
|
|||
setState('notices', (prev) => [...prev, notice]);
|
||||
};
|
||||
|
||||
export const addWarningToast = (payload: { error: any; options?: any; action?: ToastAction }) => {
|
||||
const { error, options, action } = payload;
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
const notice: ToastNotice = {
|
||||
id: nanoid(),
|
||||
message,
|
||||
options,
|
||||
type: 'warning' as const,
|
||||
};
|
||||
if (action) {
|
||||
notice.action = action;
|
||||
}
|
||||
setState('notices', (prev) => [...prev, notice]);
|
||||
};
|
||||
|
||||
export const addNoticeToast = (message: any) => {
|
||||
setState('notices', (prev) => [
|
||||
...prev,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue