veza/apps/web/src/components/data/Table.stories.tsx
senke 8e9ee2f3a5 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 16:48:07 +02:00

68 lines
1.6 KiB
TypeScript

import type { Meta, StoryObj } from '@storybook/react-vite';
import { Table, type TableColumn } from './Table';
type SampleRow = { id: string; name: string; age: number; email: string };
const sampleColumns: TableColumn<SampleRow>[] = [
{ key: 'name', header: 'Nom', sortable: true },
{ key: 'age', header: 'Âge', sortable: true },
{ key: 'email', header: 'Email', sortable: false },
];
const sampleData: SampleRow[] = [
{ id: '1', name: 'Alice', age: 28, email: 'alice@example.com' },
{ id: '2', name: 'Bob', age: 32, email: 'bob@example.com' },
{ id: '3', name: 'Charlie', age: 24, email: 'charlie@example.com' },
];
const meta: Meta = {
title: 'Data/Table',
component: Table,
tags: ['autodocs'],
parameters: {
layout: 'padded',
},
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
columns: sampleColumns,
data: sampleData,
emptyMessage: 'Aucune donnée disponible',
},
};
export const Empty: Story = {
args: {
columns: sampleColumns,
data: [],
emptyMessage: 'Aucune donnée disponible',
},
};
export const Paginated: Story = {
args: {
columns: sampleColumns,
data: Array.from({ length: 25 }, (_, i) => ({
id: String(i + 1),
name: `User ${i + 1}`,
age: 20 + i,
email: `user${i + 1}@example.com`,
})),
paginated: true,
itemsPerPage: 10,
emptyMessage: 'Aucune donnée disponible',
},
};
export const Selectable: Story = {
args: {
columns: sampleColumns,
data: sampleData,
selectable: true,
emptyMessage: 'Aucune donnée disponible',
},
};