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 { z } from 'zod'
|
||||||
import { Button } from '@/shared/components/ui/button'
|
import { Button } from '@/shared/components/ui/button'
|
||||||
import { formatTache } from '@/entities/production/lib'
|
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 type { ApiError } from '@/shared/types/api'
|
||||||
|
import { SujetDisplay } from './SujetDisplay'
|
||||||
|
|
||||||
const textSchema = z.object({
|
const textSchema = z.object({
|
||||||
texte: z
|
texte: z
|
||||||
|
|
@ -38,13 +39,14 @@ function mapCorrectError(err: ApiError | null): string | null {
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tache: Tache
|
tache: Tache
|
||||||
|
sujet: SujetData | null
|
||||||
isSubmitting: boolean
|
isSubmitting: boolean
|
||||||
error: ApiError | null
|
error: ApiError | null
|
||||||
onSubmit: (texte: string) => void
|
onSubmit: (texte: string) => void
|
||||||
onBack: () => 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 [texte, setTexte] = useState('')
|
||||||
const [fieldError, setFieldError] = useState<string | null>(null)
|
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>
|
<h2 className="text-lg font-semibold text-ink-1">{formatTache(tache)}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<SujetDisplay sujet={sujet} />
|
||||||
|
|
||||||
{apiError && (
|
{apiError && (
|
||||||
<div
|
<div
|
||||||
role="alert"
|
role="alert"
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ export function SimulationPage() {
|
||||||
const {
|
const {
|
||||||
step,
|
step,
|
||||||
production,
|
production,
|
||||||
|
sujet,
|
||||||
isCreating,
|
isCreating,
|
||||||
isCorrecting,
|
isCorrecting,
|
||||||
correctError,
|
correctError,
|
||||||
|
|
@ -90,6 +91,7 @@ export function SimulationPage() {
|
||||||
{planData && (step === 'task-selected' || step === 'correcting') && production && (
|
{planData && (step === 'task-selected' || step === 'correcting') && production && (
|
||||||
<SimulationForm
|
<SimulationForm
|
||||||
tache={production.tache}
|
tache={production.tache}
|
||||||
|
sujet={sujet}
|
||||||
isSubmitting={isCorrecting}
|
isSubmitting={isCorrecting}
|
||||||
error={correctError}
|
error={correctError}
|
||||||
onSubmit={submitText}
|
onSubmit={submitText}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue