feat(simulations): afficher la consigne du sujet au-dessus de la textarea
This commit is contained in:
parent
b356bc7109
commit
e449661ee0
2 changed files with 8 additions and 2 deletions
|
|
@ -11,8 +11,9 @@ import { Loader2 } from 'lucide-react'
|
|||
import { z } from 'zod'
|
||||
import { Button } from '@/shared/components/ui/button'
|
||||
import { formatTache } from '@/entities/production/lib'
|
||||
import type { Tache } from '@/entities/production/types'
|
||||
import type { SujetData, Tache } from '@/entities/production/types'
|
||||
import type { ApiError } from '@/shared/types/api'
|
||||
import { SujetDisplay } from './SujetDisplay'
|
||||
|
||||
const textSchema = z.object({
|
||||
texte: z
|
||||
|
|
@ -38,13 +39,14 @@ function mapCorrectError(err: ApiError | null): string | null {
|
|||
|
||||
interface Props {
|
||||
tache: Tache
|
||||
sujet: SujetData | null
|
||||
isSubmitting: boolean
|
||||
error: ApiError | null
|
||||
onSubmit: (texte: string) => void
|
||||
onBack: () => void
|
||||
}
|
||||
|
||||
export function SimulationForm({ tache, isSubmitting, error, onSubmit, onBack }: Props) {
|
||||
export function SimulationForm({ tache, sujet, isSubmitting, error, onSubmit, onBack }: Props) {
|
||||
const [texte, setTexte] = useState('')
|
||||
const [fieldError, setFieldError] = useState<string | null>(null)
|
||||
|
||||
|
|
@ -78,6 +80,8 @@ export function SimulationForm({ tache, isSubmitting, error, onSubmit, onBack }:
|
|||
<h2 className="text-lg font-semibold text-ink-1">{formatTache(tache)}</h2>
|
||||
</div>
|
||||
|
||||
<SujetDisplay sujet={sujet} />
|
||||
|
||||
{apiError && (
|
||||
<div
|
||||
role="alert"
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ export function SimulationPage() {
|
|||
const {
|
||||
step,
|
||||
production,
|
||||
sujet,
|
||||
isCreating,
|
||||
isCorrecting,
|
||||
correctError,
|
||||
|
|
@ -90,6 +91,7 @@ export function SimulationPage() {
|
|||
{planData && (step === 'task-selected' || step === 'correcting') && production && (
|
||||
<SimulationForm
|
||||
tache={production.tache}
|
||||
sujet={sujet}
|
||||
isSubmitting={isCorrecting}
|
||||
error={correctError}
|
||||
onSubmit={submitText}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue