feat(frontend): convertit l'ensemble des pages et composants au DSFR

- composants UI (Input, Card, Badge, Modal, ConfirmDialog, Slider, Skeleton,
  ThemeToggle) + Sidebar
- pages auth (connexion, inscription)
- pages publiques (informations, détail, contacts urgence, mentions, RGPD)
- espace membre (dashboard, journal, wizard saisie via fr-stepper, rapports, profil)
  + composants tracker (EditSaisieModal, EmotionPicker, TrackerTimeline, EmotionChart)
- back-office admin (dashboard, utilisateurs, contenus, émotions)

Suppression de Tailwind candlelight/malachite + lucide-react. Build OK (20 routes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Azmog
2026-06-18 23:34:01 +02:00
parent 9b5be855fc
commit f6e150ddae
31 changed files with 2205 additions and 2069 deletions
@@ -2,12 +2,9 @@
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { ArrowLeft, ArrowRight, Check } from 'lucide-react';
import { useCreateSaisie } from '@/hooks/useTracker';
import EmotionPicker from '@/components/features/EmotionPicker';
import Slider from '@/components/ui/Slider';
import Button from '@/components/ui/Button';
import Card from '@/components/ui/Card';
import toast from 'react-hot-toast';
const STEPS = [
@@ -49,139 +46,144 @@ export default function NouvelleSaisiePage() {
}
};
const nextStep = STEPS[step]?.title;
return (
<div className="max-w-2xl mx-auto">
<button
onClick={() => router.back()}
className="inline-flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 mb-6 transition-colors"
>
<ArrowLeft size={16} />
Retour
</button>
<div className="fr-container fr-py-6w">
<div className="fr-grid-row fr-grid-row--center">
<div className="fr-col-12 fr-col-md-8">
<button
type="button"
onClick={() => router.back()}
className="fr-btn fr-btn--tertiary-no-outline fr-btn--sm fr-icon-arrow-left-line fr-btn--icon-left fr-mb-2w"
>
Retour
</button>
<h1 className="font-display text-3xl font-bold text-gray-900 dark:text-white mb-2">
Nouvelle saisie
</h1>
<p className="text-gray-500 dark:text-gray-400 mb-8">
Enregistrez votre émotion en quelques étapes simples.
</p>
<h1>Nouvelle saisie</h1>
<p className="fr-text--lead">
Enregistrez votre émotion en quelques étapes simples.
</p>
{/* Stepper */}
<div className="flex items-center gap-2 mb-8">
{STEPS.map((s) => (
<div key={s.id} className="flex items-center gap-2 flex-1">
{/* Stepper DSFR */}
<div className="fr-stepper">
<h2 className="fr-stepper__title">
{STEPS[step - 1].title}
<span className="fr-stepper__state">
Étape {step} sur {STEPS.length}
</span>
</h2>
<div
className={`
w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold shrink-0
${step > s.id
? 'bg-malachite-500 text-white'
: step === s.id
? 'bg-candlelight-500 text-black'
: 'bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400'
}
`}
>
{step > s.id ? <Check size={16} /> : s.id}
</div>
{s.id < STEPS.length && (
<div
className={`flex-1 h-0.5 ${
step > s.id ? 'bg-malachite-500' : 'bg-gray-200 dark:bg-gray-700'
}`}
/>
className="fr-stepper__steps"
data-fr-current-step={step}
data-fr-steps={STEPS.length}
/>
{nextStep && (
<p className="fr-stepper__details">
<span className="fr-text--bold">Étape suivante :</span> {nextStep}
</p>
)}
</div>
))}
</div>
{/* Étape actuelle */}
<Card className="mb-6">
<h2 className="font-display text-xl font-semibold text-gray-900 dark:text-white mb-1">
{STEPS[step - 1].title}
</h2>
<p className="text-sm text-gray-500 dark:text-gray-400 mb-6">
{STEPS[step - 1].description}
</p>
{/* Étape actuelle */}
<div className="fr-card fr-p-3w fr-mb-3w">
<p className="fr-text--sm fr-text-mention--grey fr-mb-3w">
{STEPS[step - 1].description}
</p>
{step === 1 && (
<EmotionPicker value={emotionId} onChange={setEmotionId} />
)}
{step === 1 && (
<EmotionPicker value={emotionId} onChange={setEmotionId} />
)}
{step === 2 && (
<div className="space-y-6">
<Slider
value={intensite}
onChange={setIntensite}
min={1}
max={10}
label="Intensité de l'émotion"
/>
<div className="flex justify-between text-xs text-gray-400">
<span>Faible</span>
<span>Modérée</span>
<span>Forte</span>
</div>
{step === 2 && (
<div>
<Slider
value={intensite}
onChange={setIntensite}
min={1}
max={10}
label="Intensité de l'émotion"
/>
<div className="fr-grid-row fr-grid-row--middle fr-mt-1w">
<span className="fr-col fr-text--sm">Faible</span>
<span className="fr-col fr-text--sm" style={{ textAlign: 'center' }}>
Modérée
</span>
<span className="fr-col fr-text--sm" style={{ textAlign: 'right' }}>
Forte
</span>
</div>
</div>
)}
{step === 3 && (
<div>
<div className="fr-input-group">
<label className="fr-label" htmlFor="saisie-date">
Date de la saisie
</label>
<input
id="saisie-date"
className="fr-input"
type="date"
value={dateSaisie}
onChange={(e) => setDateSaisie(e.target.value)}
/>
</div>
<div className="fr-input-group">
<label className="fr-label" htmlFor="saisie-note">
Note (optionnel)
</label>
<textarea
id="saisie-note"
className="fr-input"
value={note}
onChange={(e) => setNote(e.target.value)}
placeholder="Décrivez ce que vous ressentez, ce qui a déclenché cette émotion..."
rows={4}
/>
</div>
</div>
)}
</div>
)}
{step === 3 && (
<div className="space-y-4">
<div>
<label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5">
Date de la saisie
</label>
<input
type="date"
value={dateSaisie}
onChange={(e) => setDateSaisie(e.target.value)}
className="w-full rounded-xl border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 px-4 py-2.5 focus:outline-none focus:ring-2 focus:ring-candlelight-500"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5">
Note (optionnel)
</label>
<textarea
value={note}
onChange={(e) => setNote(e.target.value)}
placeholder="Décrivez ce que vous ressentez, ce qui a déclenché cette émotion..."
rows={4}
className="w-full rounded-xl border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 px-4 py-3 focus:outline-none focus:ring-2 focus:ring-candlelight-500 placeholder:text-gray-400 resize-none"
/>
</div>
</div>
)}
</Card>
{/* Navigation */}
<div className="flex justify-between">
<Button
variant="ghost"
onClick={() => setStep(step - 1)}
disabled={step === 1}
>
<ArrowLeft size={16} />
Précédent
</Button>
{step < 3 ? (
<Button
onClick={() => setStep(step + 1)}
disabled={!canNext()}
>
Suivant
<ArrowRight size={16} />
</Button>
) : (
<Button
onClick={handleSubmit}
loading={createSaisie.isPending}
disabled={!emotionId}
>
<Check size={16} />
Enregistrer
</Button>
)}
{/* Navigation */}
<ul className="fr-btns-group fr-btns-group--inline-md">
<li>
<button
type="button"
className="fr-btn fr-btn--secondary fr-icon-arrow-left-line fr-btn--icon-left"
onClick={() => setStep(step - 1)}
disabled={step === 1}
>
Précédent
</button>
</li>
{step < 3 ? (
<li>
<button
type="button"
className="fr-btn fr-icon-arrow-right-line fr-btn--icon-right"
onClick={() => setStep(step + 1)}
disabled={!canNext()}
>
Suivant
</button>
</li>
) : (
<li>
<button
type="button"
className="fr-btn fr-icon-check-line fr-btn--icon-left"
onClick={handleSubmit}
disabled={!emotionId || createSaisie.isPending}
>
Enregistrer
</button>
</li>
)}
</ul>
</div>
</div>
</div>
);