2026-02-02 19:55:57 +00:00
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
2026-02-05 19:07:20 +00:00
|
|
|
import { http, HttpResponse } from 'msw';
|
2026-02-02 19:55:57 +00:00
|
|
|
import { ChatSidebar } from './ChatSidebar';
|
|
|
|
|
|
|
|
|
|
const meta = {
|
2026-02-05 13:20:06 +00:00
|
|
|
title: 'Components/Features/Chat/ChatSidebar',
|
2026-02-02 19:55:57 +00:00
|
|
|
component: ChatSidebar,
|
|
|
|
|
tags: ['autodocs'],
|
2026-02-05 19:07:20 +00:00
|
|
|
parameters: {
|
|
|
|
|
layout: 'centered',
|
|
|
|
|
},
|
2026-02-02 19:55:57 +00:00
|
|
|
decorators: [
|
|
|
|
|
(Story) => (
|
2026-02-07 14:18:31 +00:00
|
|
|
<div className="w-80 min-h-layout-page border rounded-lg overflow-hidden bg-card border-border">
|
refactor(storybook): remove duplicate providers from stories (Phase 2)
Stories no longer wrap with QueryClientProvider, ToastProvider,
ThemeProvider, or MemoryRouter; global StorybookDecorator provides them.
- Route-specific pages use parameters.router.initialEntries
(ResetPasswordPage, VerifyEmailPage) or minimal MemoryRouter+Route
where useParams is needed (TrackDetailPage, PlaylistDetailPage).
- Stories that seeded query cache use useQueryClient() from global
decorator (FollowButton, CollaboratorManagement, CommentSection).
- Navbar, AuthLayout, DashboardLayout, Header, and 25+ story files
simplified to layout divs only.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 12:08:17 +00:00
|
|
|
<Story />
|
|
|
|
|
</div>
|
2026-02-02 19:55:57 +00:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
} satisfies Meta<typeof ChatSidebar>;
|
|
|
|
|
|
|
|
|
|
export default meta;
|
|
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
|
|
|
|
|
|
export const Default: Story = {};
|
2026-02-05 19:07:20 +00:00
|
|
|
|
|
|
|
|
/** No conversations — empty state */
|
|
|
|
|
export const Empty: Story = {
|
|
|
|
|
parameters: {
|
|
|
|
|
msw: {
|
|
|
|
|
handlers: [
|
|
|
|
|
http.get('*/api/v1/conversations', () =>
|
|
|
|
|
HttpResponse.json({ success: true, data: [] }),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** API error — error state with retry */
|
|
|
|
|
export const Error: Story = {
|
|
|
|
|
parameters: {
|
|
|
|
|
msw: {
|
|
|
|
|
handlers: [
|
|
|
|
|
http.get('*/api/v1/conversations', () =>
|
|
|
|
|
HttpResponse.json(
|
|
|
|
|
{ success: false, error: { message: 'Signal lost' } },
|
|
|
|
|
{ status: 500 },
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|