import type { Meta, StoryFn } from '@storybook/react' import React from 'react' import { MockChatProviderWithChannels } from '../../stories/mocks' import type { ChannelPreviewProps } from '../../types' import { ChannelList } from '.' type ComponentProps = React.ComponentProps // ChannelList renders a list of mocked channels driven by MockChatProvider — // useful as a browsable Storybook fixture but the snapshot reflects the mock // fixture rather than any reusable component contract. Skip the whole story // file in Chromatic; per-channel-row visuals are covered by CustomChannelPreview. const meta: Meta = { title: 'ChannelList', component: ChannelList, parameters: { layout: 'fullscreen', chromatic: { disableSnapshot: true }, }, decorators: [ (Story) => ( ), ], } export default meta const Template: StoryFn = (args) => { return (
) } const HostChannelPreview: React.FC = ({ channel, onChannelSelect, selectedChannel, unread, }) => { const participant = Object.values(channel?.state?.members || {}).find( (member) => member.user?.id !== channel?._client?.userID ) const isSelected = selectedChannel?.id === channel?.id return ( ) } export const Default: StoryFn = Template.bind({}) Default.args = { filters: { type: 'messaging' }, onChannelSelect: (channel) => console.log('Channel selected:', channel.id), } export const WithSelection: StoryFn = Template.bind({}) WithSelection.args = { filters: { type: 'messaging' }, onChannelSelect: (channel) => console.log('Channel selected:', channel.id), } export const CustomChannelPreview: StoryFn = Template.bind({}) CustomChannelPreview.args = { filters: { type: 'messaging' }, onChannelSelect: (channel) => console.log('Channel selected:', channel.id), channelPreview: HostChannelPreview, }