mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-03 13:52:12 +03:00
Replace EventBusCheckboxes with card-based notification settings: - Each event group gets its own card with responsive grid layout - Master checkbox per group with indeterminate state - Inline parameter inputs (CPU threshold) appear when enabled - Theme-adaptive via Ant Design Card component Components: - NotificationLayout, NotificationCard, NotificationHeader, NotificationEvent - TelegramNotifications, EmailNotifications with explicit event configs
28 lines
948 B
TypeScript
28 lines
948 B
TypeScript
import { useRef, useEffect } from 'react';
|
|
import { Tag } from 'antd';
|
|
|
|
interface Props {
|
|
count: number;
|
|
total: number;
|
|
allSelected: boolean;
|
|
indeterminate: boolean;
|
|
onToggleAll: () => void;
|
|
}
|
|
|
|
function MasterCheckbox({ checked, indeterminate, onChange }: { checked: boolean; indeterminate: boolean; onChange: () => void }) {
|
|
const ref = useRef<HTMLInputElement>(null);
|
|
useEffect(() => {
|
|
if (ref.current) ref.current.indeterminate = indeterminate;
|
|
}, [indeterminate]);
|
|
return <input ref={ref} type="checkbox" checked={checked} onChange={onChange} style={{ cursor: 'pointer' }} />;
|
|
}
|
|
|
|
export function NotificationHeader({ count, total, allSelected, indeterminate, onToggleAll }: Props) {
|
|
return (
|
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
|
|
<Tag>{count}/{total}</Tag>
|
|
<MasterCheckbox checked={allSelected} indeterminate={indeterminate} onChange={onToggleAll} />
|
|
</span>
|
|
);
|
|
}
|