2026-02-03 08:56:11 +00:00
|
|
|
import type { Meta, StoryObj } from '@storybook/react';
|
2026-02-25 19:00:43 +00:00
|
|
|
import { http, HttpResponse } from 'msw';
|
2026-02-03 08:56:11 +00:00
|
|
|
import { AdminModerationView } from './AdminModerationView';
|
2026-02-03 23:44:40 +00:00
|
|
|
import { ToastProvider } from '../../components/feedback/ToastProvider';
|
2026-02-03 08:56:11 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* AdminModerationView - Queue de modération
|
|
|
|
|
*
|
|
|
|
|
* Interface de traitement des signalements avec onglets
|
|
|
|
|
* pour pending/reviewed/resolved et actions de modération.
|
|
|
|
|
*/
|
|
|
|
|
const meta: Meta<typeof AdminModerationView> = {
|
2026-02-05 13:20:06 +00:00
|
|
|
title: 'Components/Features/Admin/AdminModerationView',
|
2026-02-03 08:56:11 +00:00
|
|
|
component: AdminModerationView,
|
|
|
|
|
parameters: {
|
|
|
|
|
layout: 'fullscreen',
|
|
|
|
|
docs: {
|
|
|
|
|
description: {
|
|
|
|
|
component: 'Queue de modération avec actions ban, resolve, dismiss et warning.',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
tags: ['autodocs'],
|
|
|
|
|
decorators: [
|
|
|
|
|
(Story) => (
|
2026-02-03 23:44:40 +00:00
|
|
|
<ToastProvider>
|
2026-02-07 14:10:32 +00:00
|
|
|
<div className="bg-background min-h-screen p-4">
|
2026-02-03 23:44:40 +00:00
|
|
|
<Story />
|
|
|
|
|
</div>
|
|
|
|
|
</ToastProvider>
|
2026-02-03 08:56:11 +00:00
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default meta;
|
|
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* État par défaut avec rapports en attente.
|
|
|
|
|
*/
|
|
|
|
|
export const Default: Story = {
|
|
|
|
|
name: 'Par défaut',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Vue de la queue avec rapports en attente.
|
|
|
|
|
*/
|
|
|
|
|
export const Queue: Story = {
|
|
|
|
|
name: 'Queue de modération',
|
|
|
|
|
parameters: {
|
|
|
|
|
docs: {
|
|
|
|
|
description: {
|
|
|
|
|
story: 'Liste des signalements en attente de traitement.',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-25 19:00:43 +00:00
|
|
|
/**
|
|
|
|
|
* État de chargement.
|
|
|
|
|
*/
|
|
|
|
|
export const Loading: Story = {
|
|
|
|
|
name: 'Chargement',
|
|
|
|
|
parameters: {
|
|
|
|
|
msw: {
|
|
|
|
|
handlers: [
|
|
|
|
|
http.get('*/api/v1/admin/reports', async () => {
|
|
|
|
|
await new Promise(() => {});
|
|
|
|
|
return HttpResponse.json({ reports: [], pagination: { total: 0, limit: 20, offset: 0 } });
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
docs: {
|
|
|
|
|
description: {
|
|
|
|
|
story: 'Skeleton pendant le chargement des rapports.',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-03 08:56:11 +00:00
|
|
|
/**
|
|
|
|
|
* État vide - tous les rapports traités.
|
|
|
|
|
*/
|
|
|
|
|
export const Empty: Story = {
|
|
|
|
|
name: 'Queue vide',
|
|
|
|
|
parameters: {
|
2026-02-25 19:00:43 +00:00
|
|
|
msw: {
|
|
|
|
|
handlers: [
|
|
|
|
|
http.get('*/api/v1/admin/reports', () =>
|
|
|
|
|
HttpResponse.json({ reports: [], pagination: { total: 0, limit: 20, offset: 0 } })),
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-02-03 08:56:11 +00:00
|
|
|
docs: {
|
|
|
|
|
description: {
|
|
|
|
|
story: 'Message affiché quand tous les signalements ont été traités.',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2026-02-25 19:00:43 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* État d'erreur.
|
|
|
|
|
*/
|
|
|
|
|
export const Error: Story = {
|
|
|
|
|
name: 'Erreur',
|
|
|
|
|
parameters: {
|
|
|
|
|
msw: {
|
|
|
|
|
handlers: [
|
|
|
|
|
http.get('*/api/v1/admin/reports', () =>
|
|
|
|
|
HttpResponse.json({ error: 'Failed to list reports' }, { status: 500 })),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
docs: {
|
|
|
|
|
description: {
|
|
|
|
|
story: 'Affichage en cas d\'échec du chargement.',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|