veza/apps/web/src/components/layout/DashboardLayout.stories.tsx

121 lines
3.5 KiB
TypeScript
Raw Normal View History

fix: stabilize builds, tests, and lint across all stacks Complete stabilization pass bringing all 3 stacks to green: Frontend (apps/web/): - Fix TypeScript nullability in useSeason.ts, useTimeOfDay.ts hooks - Disable no-undef in ESLint config (TypeScript handles it; JSX misidentified) - Rename 306 story imports from @storybook/react to @storybook/react-vite - Fix conditional hook call in useMediaQuery.ts useIsTablet - Move useQuery to top of LoginPage.tsx component - Remove useless try/catch in GearFormModal.tsx - Fix stale closure in ResetPasswordPage.tsx handleChange - Make Storybook decorators (withRouter, withQueryClient, withToast, withAudio) no-ops since global StorybookDecorator already provides these — prevents nested Router / duplicate provider crashes in vitest-browser - Fix nested MemoryRouter in 3 page stories (TrackDetail, PlaylistDetail, UserProfile) - Update i18n initialization in test setup (await init before changeLanguage) - Update ~30 test assertions from English to French to match i18n translations - Update test assertions to match SUMI V3 design changes (shadow vs border) - Fix remaining story type errors (PlayerError, PlaylistBatchActions, TrackFilters, VirtualizedChatMessages) Backend (veza-backend-api/): - Fix response_test.go RespondWithAppError signature (2 args, not 3) - Fix TestErrorContractAuthEndpoints expected error codes (ErrCodeUnauthorized vs ErrCodeInvalidCredentials) - Fix TestTrackHandler_GetTrackLikes_Success missing auth middleware setup - Fix TestPlaybackAnalyticsService_GetTrackStats k-anonymity threshold (needs 5 unique users, not 1) - Replace NOW() PostgreSQL function with time.Now() parameter in marketplace service for SQLite test compatibility - Add missing AutoMigrate entries in marketplace_test.go (ProductImage, ProductPreview, ProductLicense, ProductReview) Results: - Frontend TypeCheck: 617 errors -> 0 errors - Frontend ESLint: 349 errors -> 0 errors - Frontend Vitest: 196 failing tests -> 1 skipped (3396/3397 passing) - Backend go vet: 1 error -> 0 errors - Backend tests: 5 failing -> all 13 packages passing - Rust: 150/150 tests passing (unchanged) - Storybook audit: 0 errors across 1244 stories Triage report: docs/TRIAGE_REPORT.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 14:48:07 +00:00
import type { Meta, StoryObj } from '@storybook/react-vite';
import { DashboardLayout } from './DashboardLayout';
import DashboardPage from '@/features/dashboard/pages/DashboardPage';
import { PlaylistListPage } from '@/features/playlists/pages/PlaylistListPage';
import { LibraryPage } from '@/features/library/pages/LibraryPage';
import { SettingsPage } from '@/features/settings/pages/SettingsPage';
import { UserProfilePage } from '@/features/profile/pages/UserProfilePage';
const placeholderContent = (
<div className="space-y-4">
<h1 className="text-3xl font-bold text-foreground">Dashboard Content</h1>
<p className="text-muted-foreground">This is the main content area rendered within the layout.</p>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="h-32 bg-white/5 rounded-xl border border-white/10 p-4">Card 1</div>
<div className="h-32 bg-white/5 rounded-xl border border-white/10 p-4">Card 2</div>
<div className="h-32 bg-white/5 rounded-xl border border-white/10 p-4">Card 3</div>
</div>
{Array.from({ length: 20 }).map((_, i) => (
<div key={i} className="h-16 bg-white/5 rounded-lg border border-white/5 flex items-center px-4">
Item {i + 1}
</div>
))}
</div>
);
const meta = {
title: 'App/Layouts/DashboardLayout',
component: DashboardLayout,
tags: ['autodocs'],
parameters: {
layout: 'fullscreen',
viewport: { defaultViewport: 'desktop' },
},
} satisfies Meta<typeof DashboardLayout>;
export default meta;
type Story = StoryObj<typeof meta>;
/** Shell with placeholder content. Use to validate scroll and proportions. */
export const Default: Story = {
name: 'App shell (placeholder)',
args: {
children: placeholderContent,
},
};
/** Full app view: shell + real Dashboard page (MSW mocks user + library). */
export const DashboardFullLayout: Story = {
name: 'Dashboard full layout',
args: { children: null },
render: () => (
<DashboardLayout>
<DashboardPage />
</DashboardLayout>
),
parameters: {
layout: 'fullscreen',
router: { initialEntries: ['/dashboard'] },
},
};
/** Full app view: shell + Playlist list page (MSW mocks playlists). */
export const PlaylistsFullLayout: Story = {
name: 'Playlists full layout',
args: { children: null },
render: () => (
<DashboardLayout>
<PlaylistListPage />
</DashboardLayout>
),
parameters: {
layout: 'fullscreen',
router: { initialEntries: ['/playlists'] },
},
};
/** Full app view: shell + Library page (MSW mocks tracks). */
export const LibraryFullLayout: Story = {
name: 'Library full layout',
args: { children: null },
render: () => (
<DashboardLayout>
<LibraryPage />
</DashboardLayout>
),
parameters: {
layout: 'fullscreen',
router: { initialEntries: ['/library'] },
},
};
/** Full app view: shell + Settings page (MSW mocks user + users/settings). */
export const SettingsFullLayout: Story = {
name: 'Settings full layout',
args: { children: null },
render: () => (
<DashboardLayout>
<SettingsPage />
</DashboardLayout>
),
parameters: {
layout: 'fullscreen',
router: { initialEntries: ['/settings'] },
},
};
/** Full app view: shell + Profile page (MSW mocks user profile). */
export const ProfileFullLayout: Story = {
name: 'Profile full layout',
args: { children: null },
render: () => (
<DashboardLayout>
<UserProfilePage />
</DashboardLayout>
),
parameters: {
layout: 'fullscreen',
router: { initialEntries: ['/profile'] },
},
};