feat(report): ConclusionPanel + NextAppointmentPicker (date | period | none)

This commit is contained in:
Bastien Chanot committed 2026-05-18 21:30:43 +02:00
1 parent 71ecebfa72
commit 6b115a558e
2 files changed
+72 -4

No files matched your search

+36 -2
View File
@@ -1,3 +1,37 @@
export default function ConclusionPanel() {
return <div>ConclusionPanel placeholder</div>
import type { Report } from '@/domain/schema/report'
import Label from '@/components/ui/Label'
import Textarea from '@/components/ui/Textarea'
import NextAppointmentPicker from './NextAppointmentPicker'
export interface ConclusionPanelProps {
conclusion: string
recommendations: string
nextAppointment: Report['nextAppointment']
onChangeConclusion: (s: string) => void
onChangeRecommendations: (s: string) => void
onChangeNextAppointment: (n: Report['nextAppointment']) => void
}
export default function ConclusionPanel({
conclusion,
recommendations,
nextAppointment,
onChangeConclusion,
onChangeRecommendations,
onChangeNextAppointment,
}: ConclusionPanelProps) {
return (
<section className="space-y-4">
<h2 className="font-serif text-xl text-[var(--color-ink)]">Conclusion & recommandations</h2>
<div>
<Label htmlFor="conclusion">Conclusion</Label>
<Textarea id="conclusion" value={conclusion} onChange={(e) => onChangeConclusion(e.target.value)} />
</div>
<div>
<Label htmlFor="recommendations">Recommandations</Label>
<Textarea id="recommendations" value={recommendations} onChange={(e) => onChangeRecommendations(e.target.value)} />
</div>
<NextAppointmentPicker value={nextAppointment} onChange={onChangeNextAppointment} />
</section>
)
}
@@ -1,3 +1,37 @@
export default function NextAppointmentPicker() {
return <div>NextAppointmentPicker placeholder</div>
import type { Report } from '@/domain/schema/report'
import Input from '@/components/ui/Input'
import Label from '@/components/ui/Label'
export interface NextAppointmentPickerProps {
value: Report['nextAppointment']
onChange: (next: Report['nextAppointment']) => void
}
export default function NextAppointmentPicker({ value, onChange }: NextAppointmentPickerProps) {
const kind = value?.kind ?? 'date'
return (
<div className="space-y-2">
<Label>Prochain rendez-vous</Label>
<div className="flex gap-2 mb-2">
<label className="text-sm flex items-center gap-1">
<input type="radio" checked={kind === 'date'} onChange={() => onChange({ kind: 'date', date: '' })} />
Date
</label>
<label className="text-sm flex items-center gap-1">
<input type="radio" checked={kind === 'period'} onChange={() => onChange({ kind: 'period', text: '' })} />
Période libre
</label>
<label className="text-sm flex items-center gap-1">
<input type="radio" checked={value === undefined} onChange={() => onChange(undefined)} />
Aucun
</label>
</div>
{value?.kind === 'date' && (
<Input type="date" value={value.date} onChange={(e) => onChange({ kind: 'date', date: e.target.value })} />
)}
{value?.kind === 'period' && (
<Input value={value.text} placeholder="ex. dans 3 semaines" onChange={(e) => onChange({ kind: 'period', text: e.target.value })} />
)}
</div>
)
}