feat(simulations): finaliser flux /sujets — SimulationForm + SujetDisplay + TaskSelector type prop
- SimulationForm : bouton "Changer de sujet" → /sujets (étape 3 refonte) - SujetDisplay : redevient présentationnel (plus de dropdown) - TaskSelector : prop type 'EE' | 'EO' (EO_CARDS réservé usage futur — non routé) - SimulationPage : type='EE' hardcodé (EO restera ComingSoon jusqu'au Sprint EO) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
43f3ce2c6c
commit
6bfdf15db9
4 changed files with 69 additions and 116 deletions
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
import { useEffect, useRef, useState, type FormEvent } from 'react'
|
||||
import { Clock, Loader2 } from 'lucide-react'
|
||||
import { Clock, Loader2, Shuffle } from 'lucide-react'
|
||||
import { z } from 'zod'
|
||||
import { Button } from '@/shared/components/ui/button'
|
||||
import { formatTache } from '@/entities/production/lib'
|
||||
|
|
@ -49,20 +49,16 @@ function mapCorrectError(err: ApiError | null): string | null {
|
|||
interface Props {
|
||||
tache: Tache
|
||||
sujet: SujetData | null
|
||||
sujets: SujetData[]
|
||||
isLoadingSujets: boolean
|
||||
isSubmitting: boolean
|
||||
error: ApiError | null
|
||||
onSubmit: (texte: string) => void
|
||||
onBack: () => void
|
||||
onChangeSujet: (sujet: SujetData) => void
|
||||
onChangeSujet: () => void
|
||||
}
|
||||
|
||||
export function SimulationForm({
|
||||
tache,
|
||||
sujet,
|
||||
sujets,
|
||||
isLoadingSujets,
|
||||
isSubmitting,
|
||||
error,
|
||||
onSubmit,
|
||||
|
|
@ -150,13 +146,22 @@ export function SimulationForm({
|
|||
<h2 className="flex-1 text-lg font-semibold text-ink-1">{formatTache(tache)}</h2>
|
||||
</div>
|
||||
|
||||
<SujetDisplay
|
||||
sujet={sujet}
|
||||
sujets={sujets}
|
||||
isLoadingSujets={isLoadingSujets}
|
||||
onChangeSujet={onChangeSujet}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<SujetDisplay sujet={sujet} />
|
||||
|
||||
{sujet && (
|
||||
<div className="flex justify-end">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onChangeSujet}
|
||||
disabled={isSubmitting}
|
||||
className="inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-sm text-ink-2 transition-colors hover:border-expria hover:text-expria focus:border-expria focus:outline-none focus:ring-2 focus:ring-expria/20 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
aria-label="Changer de sujet"
|
||||
>
|
||||
<Shuffle className="size-4" aria-hidden="true" />
|
||||
Changer de sujet
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{apiError && (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue