feat(frontend): full FR i18n via react-i18next + 2-tab engagement detail (sprint 12) #14

Merged
knacky merged 14 commits from sprint/12-i18n-fr into main 2026-06-22 08:25:51 +00:00
4 changed files with 15 additions and 20 deletions
Showing only changes of commit 6648d1cc2e - Show all commits

View File

@@ -1,11 +1,5 @@
import type { SimulationStatus } from '@/api/types'; import type { SimulationStatus } from '@/api/types';
import { simulationStatusLabel } from '@/i18n/status';
const LABELS: Record<SimulationStatus, string> = {
pending: 'Pending',
in_progress: 'In progress',
review_required: 'Review required',
done: 'Done',
};
const STYLES: Record<SimulationStatus, string> = { const STYLES: Record<SimulationStatus, string> = {
pending: 'bg-cloud text-graphite border border-hairline', pending: 'bg-cloud text-graphite border border-hairline',
@@ -21,7 +15,7 @@ export function SimulationStatusBadge({ status }: { status: SimulationStatus }):
data-testid="simulation-status-badge" data-testid="simulation-status-badge"
data-status={status} data-status={status}
> >
{LABELS[status]} {simulationStatusLabel(status)}
</span> </span>
); );
} }

View File

@@ -1,10 +1,5 @@
import type { EngagementStatus } from '@/api/types'; import type { EngagementStatus } from '@/api/types';
import { engagementStatusLabel } from '@/i18n/status';
const LABELS: Record<EngagementStatus, string> = {
planned: 'Planned',
active: 'Active',
closed: 'Closed',
};
const STYLES: Record<EngagementStatus, string> = { const STYLES: Record<EngagementStatus, string> = {
planned: 'bg-warn-soft text-warn border border-warn', planned: 'bg-warn-soft text-warn border border-warn',
@@ -19,7 +14,7 @@ export function StatusBadge({ status }: { status: EngagementStatus }): JSX.Eleme
data-testid="status-badge" data-testid="status-badge"
data-status={status} data-status={status}
> >
{LABELS[status]} {engagementStatusLabel(status)}
</span> </span>
); );
} }

View File

@@ -4,10 +4,10 @@ import { SimulationStatusBadge } from '@/components/SimulationStatusBadge';
import type { SimulationStatus } from '@/api/types'; import type { SimulationStatus } from '@/api/types';
const CASES: { status: SimulationStatus; label: string }[] = [ const CASES: { status: SimulationStatus; label: string }[] = [
{ status: 'pending', label: 'Pending' }, { status: 'pending', label: 'En attente' },
{ status: 'in_progress', label: 'In progress' }, { status: 'in_progress', label: 'En cours' },
{ status: 'review_required', label: 'Review required' }, { status: 'review_required', label: 'Révision requise' },
{ status: 'done', label: 'Done' }, { status: 'done', label: 'Terminé' },
]; ];
describe('SimulationStatusBadge', () => { describe('SimulationStatusBadge', () => {

View File

@@ -2,12 +2,18 @@ import { describe, expect, it } from 'vitest';
import { render, screen } from '@testing-library/react'; import { render, screen } from '@testing-library/react';
import { StatusBadge } from '@/components/StatusBadge'; import { StatusBadge } from '@/components/StatusBadge';
const LABELS: Record<string, string> = {
planned: 'Planifié',
active: 'Actif',
closed: 'Clôturé',
};
describe('StatusBadge', () => { describe('StatusBadge', () => {
it.each(['planned', 'active', 'closed'] as const)('renders %s label and data attr', (status) => { it.each(['planned', 'active', 'closed'] as const)('renders %s label and data attr', (status) => {
render(<StatusBadge status={status} />); render(<StatusBadge status={status} />);
const badge = screen.getByTestId('status-badge'); const badge = screen.getByTestId('status-badge');
expect(badge).toHaveAttribute('data-status', status); expect(badge).toHaveAttribute('data-status', status);
expect(badge.textContent?.toLowerCase()).toBe(status); expect(badge.textContent).toBe(LABELS[status]);
}); });
it('applies warn-soft surface for planned', () => { it('applies warn-soft surface for planned', () => {