import type { ArgTypes } from '@storybook/react' export const storyUsers = { creator: { id: 'creator-user', name: 'Creator', image: 'https://i.pravatar.cc/150?img=1', }, visitor: { id: 'visitor-user', name: 'Visitor', image: 'https://i.pravatar.cc/150?img=5', }, } as const export type StoryRole = keyof typeof storyUsers export type StoryUser = (typeof storyUsers)[keyof typeof storyUsers] const DEFAULT_ROLE: StoryRole = 'creator' /** * Storybook control: pick viewer identity; `args.currentUser` is the full user object. * Use with `key={currentUser.id}` on the story root so Stream client remounts when it changes. */ export const currentUserArgType: ArgTypes<{ currentUser?: StoryUser }> = { currentUser: { name: 'participant', control: { type: 'inline-radio' as const }, options: ['creator', 'visitor'] as StoryRole[], mapping: { creator: storyUsers.creator, visitor: storyUsers.visitor, }, table: { defaultValue: { summary: DEFAULT_ROLE } }, }, } satisfies ArgTypes<{ currentUser?: StoryUser }>