import type { Meta, StoryObj } from '@storybook/vue3-vite' import AssetBrowserModal from '@/platform/assets/components/AssetBrowserModal.vue' import type { AssetDisplayItem } from '@/platform/assets/composables/useAssetBrowser' import { createMockAssets, mockAssets } from '@/platform/assets/fixtures/ui-mock-assets' // Story arguments interface interface StoryArgs { nodeType: string inputName: string currentValue: string showLeftPanel?: boolean } const meta: Meta = { title: 'Platform/Assets/AssetBrowserModal', component: AssetBrowserModal, parameters: { layout: 'fullscreen' }, argTypes: { nodeType: { control: 'select', options: ['CheckpointLoaderSimple', 'VAELoader', 'ControlNetLoader'], description: 'ComfyUI node type for context' }, inputName: { control: 'select', options: ['ckpt_name', 'vae_name', 'control_net_name'], description: 'Widget input name' }, currentValue: { control: 'text', description: 'Current selected asset value' }, showLeftPanel: { control: 'boolean', description: 'Whether to show the left panel with categories' } } } export default meta type Story = StoryObj // Modal Layout Stories export const Default: Story = { args: { nodeType: 'CheckpointLoaderSimple', inputName: 'ckpt_name', currentValue: '', showLeftPanel: true }, render: (args) => ({ components: { AssetBrowserModal }, setup() { const onAssetSelect = (_asset: AssetDisplayItem) => { // Asset selection handler for story } const onClose = () => {} return { ...args, onAssetSelect, onClose, assets: mockAssets } }, template: `
` }) } // Story demonstrating single asset type (auto-hides left panel) export const SingleAssetType: Story = { args: { nodeType: 'CheckpointLoaderSimple', inputName: 'ckpt_name', currentValue: '', showLeftPanel: false }, render: (args) => ({ components: { AssetBrowserModal }, setup() { const onAssetSelect = (_asset: AssetDisplayItem) => { // Asset selection handler for story } const onClose = () => { // Modal close handler for story } // Create assets with only one type (checkpoints) const singleTypeAssets = createMockAssets(15).map((asset) => ({ ...asset, type: 'checkpoint' })) return { ...args, onAssetSelect, onClose, assets: singleTypeAssets } }, template: `
` }), parameters: { docs: { description: { story: 'Modal with assets of only one type (checkpoint) - left panel auto-hidden.' } } } } // Story with left panel explicitly hidden export const NoLeftPanel: Story = { args: { nodeType: 'CheckpointLoaderSimple', inputName: 'ckpt_name', currentValue: '', showLeftPanel: false }, render: (args) => ({ components: { AssetBrowserModal }, setup() { const onAssetSelect = (_asset: AssetDisplayItem) => { // Asset selection handler for story } const onClose = () => { // Modal close handler for story } return { ...args, onAssetSelect, onClose, assets: mockAssets } }, template: `
` }), parameters: { docs: { description: { story: 'Modal with left panel explicitly disabled via showLeftPanel=false.' } } } }