feat(simulations): choix du sujet — dropdown intégré + bouton aléatoire

This commit is contained in:
Hermann_Kitio 2026-04-21 02:06:08 +03:00
parent 477477b6a6
commit 7902eec042
5 changed files with 193 additions and 29 deletions

View file

@ -49,13 +49,26 @@ 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
}
export function SimulationForm({ tache, sujet, isSubmitting, error, onSubmit, onBack }: Props) {
export function SimulationForm({
tache,
sujet,
sujets,
isLoadingSujets,
isSubmitting,
error,
onSubmit,
onBack,
onChangeSujet,
}: Props) {
const textareaRef = useRef<HTMLTextAreaElement>(null)
const hasAutoSubmittedRef = useRef(false)
const [texte, setTexte] = useState('')
@ -137,7 +150,13 @@ export function SimulationForm({ tache, sujet, isSubmitting, error, onSubmit, on
<h2 className="flex-1 text-lg font-semibold text-ink-1">{formatTache(tache)}</h2>
</div>
<SujetDisplay sujet={sujet} />
<SujetDisplay
sujet={sujet}
sujets={sujets}
isLoadingSujets={isLoadingSujets}
onChangeSujet={onChangeSujet}
disabled={isSubmitting}
/>
{apiError && (
<div