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:
Hermann_Kitio 2026-04-21 02:48:48 +03:00
parent 43f3ce2c6c
commit 6bfdf15db9
4 changed files with 69 additions and 116 deletions

View file

@ -1,8 +1,8 @@
/**
* Page de simulation Expression Écrite.
*
* Orchestre les 3 étapes du flux : sélection de tâche saisie du texte rapport.
* Le choix du sujet est sormais légué à la page /sujets (refonte UX 2026-04-21).
* Orchestre les 3 étapes du flux : sélection de tâche saisie rapport.
* Le choix du sujet est légué à la page /sujets (refonte UX 2026-04-21).
*
* Règle D : quotas et permissions passent par canSimulate() jamais de plan === '...'
* Règle H : aucune logique métier tout est dans useSimulation() et les entités.
@ -17,7 +17,6 @@ import { useQuery } from '@tanstack/react-query'
import { getPlanStatus } from '@/entities/user/api'
import { Button } from '@/shared/ui/Button'
import { useSimulation } from '../hooks/useSimulation'
import { useSujets } from '../hooks/useSujets'
import { TaskSelector } from '../components/TaskSelector'
import { SimulationForm } from '../components/SimulationForm'
@ -57,16 +56,10 @@ export function SimulationPage() {
correctError,
selectTask,
submitText,
changeSubject,
goToSubjectPicker,
reset,
} = useSimulation()
// Catalogue passé à SimulationForm (dropdown hérité — refacto étape 3).
const { data: sujets, isLoading: isLoadingSujets } = useSujets(
production?.tache ?? 'EE_T1',
!!production,
)
// Redirige vers /sujets dès que la création aboutit pour une tâche avec catalogue.
useEffect(() => {
if (step === 'choosing-subject' && production) {
@ -97,6 +90,7 @@ export function SimulationPage() {
{planData && step === 'idle' && (
<TaskSelector
type="EE"
plan={planData.plan}
simulationsUsed={planData.simulations_used}
isLoading={isCreating}
@ -110,13 +104,11 @@ export function SimulationPage() {
<SimulationForm
tache={production.tache}
sujet={sujet}
sujets={sujets ?? []}
isLoadingSujets={isLoadingSujets}
isSubmitting={isCorrecting}
error={correctError}
onSubmit={submitText}
onBack={reset}
onChangeSujet={changeSubject}
onChangeSujet={goToSubjectPicker}
/>
)}
</main>