feat(simulations): choix du sujet — dropdown intégré + bouton aléatoire
This commit is contained in:
parent
477477b6a6
commit
7902eec042
5 changed files with 193 additions and 29 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue