import { useState } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { AllSetting } from '@/models/setting'; import { TelegramNotifications } from './TelegramNotifications'; const meta = { title: 'UI/Notifications/TelegramNotifications', component: TelegramNotifications, tags: ['autodocs'], parameters: { layout: 'padded', docs: { description: { component: 'Grid of event-group cards (outbound, Xray, node, system, security) that pick which panel events the Telegram bot reports, with per-group select-all and CPU/RAM threshold inputs. Used on the settings page Telegram tab to edit `tgEnabledEvents`.', }, }, }, argTypes: { allSetting: { description: 'Panel settings snapshot; reads `tgEnabledEvents` plus the `tgCpu`/`tgMemory` thresholds.' }, updateSetting: { description: 'Called with a partial settings patch when an event toggle or threshold changes.' }, }, } satisfies Meta; export default meta; type Story = StoryObj; function Demo({ initial }: { initial: AllSetting }) { const [settings, setSettings] = useState(initial); return ( setSettings((prev) => new AllSetting({ ...prev, ...patch }))} /> ); } const placeholderArgs = { allSetting: new AllSetting(), updateSetting: () => undefined, }; export const NothingSelected: Story = { args: placeholderArgs, render: () => , }; export const TypicalMonitoring: Story = { args: placeholderArgs, render: () => ( ), }; export const EverythingEnabled: Story = { args: placeholderArgs, render: () => ( ), };