review fix

This commit is contained in:
Ildar Kamalov 2026-07-10 12:00:37 +03:00
parent 3e233c241f
commit 821f350ddc
6 changed files with 27 additions and 4 deletions

View file

@ -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()}>

View file

@ -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') });
}
});

View file

@ -40,3 +40,7 @@
.sectionTitle {
line-height: 32px;
}
.queryLogSwitch {
padding-top: 12px;
}

View file

@ -234,6 +234,7 @@ export const Settings = () => {
enabled: v,
})
}
inputClassName={s.queryLogSwitch}
/>
<SettingRow

View file

@ -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 = {

View file

@ -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,