import type { Meta, StoryFn } from '@storybook/react' import type { EventComponentProps } from 'stream-chat-react' import { CustomSystemMessage } from '.' const meta: Meta = { title: 'CustomSystemMessage', component: CustomSystemMessage, parameters: { layout: 'centered', }, } export default meta const createStoryProps = ( messageOverrides: Partial ): EventComponentProps => ({ message: { id: 'system-message-1', type: 'system', text: 'System message', created_at: new Date('2025-01-01T00:00:00.000Z'), ...messageOverrides, }, }) as EventComponentProps const Template: StoryFn = (args) => (
) // Per-variant stories stay in Storybook for browsing/design review but are // individually covered by rows in AllVariants — skip in Chromatic. const skipInChromatic = { chromatic: { disableSnapshot: true } } export const DmAgentPaused: StoryFn = Template.bind({}) DmAgentPaused.args = createStoryProps({ text: 'DM Agent paused for this conversation', metadata: { custom_type: 'SYSTEM_DM_AGENT_PAUSED', }, }) DmAgentPaused.parameters = skipInChromatic export const DmAgentResumed: StoryFn = Template.bind({}) DmAgentResumed.args = createStoryProps({ text: 'DM Agent resumed for this conversation', metadata: { custom_type: 'SYSTEM_DM_AGENT_RESUMED', }, }) DmAgentResumed.parameters = skipInChromatic export const AgeSafetyBlocked: StoryFn = Template.bind({}) AgeSafetyBlocked.args = createStoryProps({ text: ' ', metadata: { custom_type: 'SYSTEM_AGE_SAFETY_BLOCKED', }, }) AgeSafetyBlocked.parameters = skipInChromatic export const GenericFallback: StoryFn = Template.bind({}) GenericFallback.args = createStoryProps({ text: 'Message activity event', metadata: { custom_type: 'MESSAGE_CHATBOT', }, }) GenericFallback.parameters = skipInChromatic export const AllVariants: StoryFn = () => { const variants: { label: string; props: EventComponentProps }[] = [ { label: 'DM Agent paused', props: createStoryProps({ text: 'DM Agent paused for this conversation', metadata: { custom_type: 'SYSTEM_DM_AGENT_PAUSED' }, }), }, { label: 'DM Agent resumed', props: createStoryProps({ text: 'DM Agent resumed for this conversation', metadata: { custom_type: 'SYSTEM_DM_AGENT_RESUMED' }, }), }, { label: 'Age safety blocked', props: createStoryProps({ text: ' ', metadata: { custom_type: 'SYSTEM_AGE_SAFETY_BLOCKED' }, }), }, { label: 'Generic fallback', props: createStoryProps({ text: 'Message activity event', metadata: { custom_type: 'MESSAGE_CHATBOT' }, }), }, ] return (
{variants.map(({ label, props }) => (
{label}
))}
) }