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>
117 lines
2.8 KiB
TypeScript
117 lines
2.8 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
import { fn } from 'storybook/test';
|
|
import { UserTableRow } from './UserTableRow';
|
|
import { User } from '@/types';
|
|
|
|
// Mock user data
|
|
const createMockUser = (overrides: Partial<User> = {}): User => ({
|
|
id: 'usr_abc123def456',
|
|
username: 'demo_artist',
|
|
email: 'demo@veza.music',
|
|
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=demo',
|
|
status: 'online',
|
|
role: 'user',
|
|
roles: ['user', 'artist'],
|
|
tier: 'Pro',
|
|
created_at: '2025-01-15',
|
|
last_login_at: '2026-02-02',
|
|
...overrides,
|
|
} as User);
|
|
|
|
/**
|
|
* UserTableRow - Ligne de tableau utilisateur
|
|
*
|
|
* Composant de ligne affichant les informations d'un utilisateur
|
|
* avec menu d'actions contextuel.
|
|
*/
|
|
const meta: Meta = {
|
|
title: 'Components/Features/Admin/UserTableRow',
|
|
component: UserTableRow,
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
component: 'Ligne de tableau utilisateur avec avatar, statut, rôles et menu d\'actions.',
|
|
},
|
|
},
|
|
},
|
|
tags: ['autodocs'],
|
|
args: {
|
|
user: createMockUser(),
|
|
onBan: fn(),
|
|
onDelete: fn(),
|
|
onEditRole: fn(),
|
|
},
|
|
argTypes: {
|
|
user: {
|
|
description: 'Objet utilisateur à afficher',
|
|
},
|
|
onBan: {
|
|
action: 'onBan',
|
|
description: 'Callback pour suspendre l\'utilisateur',
|
|
},
|
|
onDelete: {
|
|
action: 'onDelete',
|
|
description: 'Callback pour supprimer l\'utilisateur',
|
|
},
|
|
onEditRole: {
|
|
action: 'onEditRole',
|
|
description: 'Callback pour modifier les rôles',
|
|
},
|
|
},
|
|
decorators: [
|
|
(Story) => (
|
|
<div className="bg-background p-4">
|
|
<table className="w-full">
|
|
<tbody>
|
|
<Story />
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
),
|
|
],
|
|
};
|
|
|
|
export default meta;
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
/**
|
|
* Utilisateur standard en ligne.
|
|
*/
|
|
export const Default: Story = {
|
|
name: 'Par défaut',
|
|
};
|
|
|
|
/**
|
|
* Ligne sélectionnée avec menu ouvert.
|
|
*/
|
|
export const Selected: Story = {
|
|
name: 'Sélectionné',
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
story: 'État de la ligne quand le menu d\'actions est ouvert.',
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Utilisateur banni/suspendu.
|
|
*/
|
|
export const Banned: Story = {
|
|
name: 'Suspendu',
|
|
args: {
|
|
user: createMockUser({
|
|
username: 'banned_user',
|
|
status: 'busy',
|
|
roles: ['banned'],
|
|
}),
|
|
},
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
story: 'Affichage d\'un utilisateur suspendu.',
|
|
},
|
|
},
|
|
},
|
|
};
|