2026-02-03 08:56:11 +00:00
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
feat(web): update all features, stories, e2e tests, and auth interceptor
Update auth, playlists, tracks, search, profile, dashboard, player,
settings, and social features. Add e2e audit specs for all major pages.
Update ESLint config, vitest config, and route configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:16:36 +00:00
|
|
|
import { fn } from 'storybook/test';
|
2026-02-03 08:56:11 +00:00
|
|
|
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,
|
2026-02-12 23:32:08 +00:00
|
|
|
} as User);
|
2026-02-03 08:56:11 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* UserTableRow - Ligne de tableau utilisateur
|
|
|
|
|
*
|
|
|
|
|
* Composant de ligne affichant les informations d'un utilisateur
|
|
|
|
|
* avec menu d'actions contextuel.
|
|
|
|
|
*/
|
2026-02-12 23:32:08 +00:00
|
|
|
const meta: Meta = {
|
2026-02-05 13:20:06 +00:00
|
|
|
title: 'Components/Features/Admin/UserTableRow',
|
2026-02-03 08:56:11 +00:00
|
|
|
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) => (
|
2026-02-07 14:10:32 +00:00
|
|
|
<div className="bg-background p-4">
|
2026-02-03 08:56:11 +00:00
|
|
|
<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.',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|