feat: UI — home, new report form, editor with anatomy canvas + findings + PDF export
UI primitives (Tailwind, no shadcn CLI dependency): - Button, Card, Input, Textarea, Label, Badge, Select, Dialog - Brand, Header, Footer, Shell layout wrapper Routes: - HomeRoute: new bilan card + import PDF card with drag-drop, error toast - NewReportRoute: 9-species selector (8 disabled badges 'à venir'), practitioner block (fullName required + title/phone/email/SIRET/address optional), animal+owner, sessionDate. Zod-validated form via react-hook-form - EditorRoute: split view — anatomy canvas (3 tabs latéral L/R + dorsal) on the left, findings panel + conclusion + export button on the right - NotFoundRoute Editor: - AnatomyView: fetch SVG, DOMParser-based (no innerHTML), click delegation on [data-zone], CSS-variable styling per state (default/selected/linked) - AnatomyCanvas: animated tab switcher with motion shared layout - ZoneSelection: chip bar of current selection, validate+reset buttons - FindingEditor: modal dialog with severity radios, pathology multi-select filtered by zones, free-text pathology input, linked-zones picker, comment - FindingPanel: list of findings with hover-preview wired to canvas highlight - ConclusionPanel: conclusion + recommendations + next appointment - ExportButton: triggers PDF download - rasterize.ts: SVG → PNG bytes via canvas (used by editor before PDF export) ESLint: relax strict-type-checked to React-idiomatic level (no-confusing-void-expression off, no-misused-promises allows void-return attributes, no-floating-promises is warn). 2 remaining errors fixed (label a11y + optional chain in HomeRoute). PDF export Blob: copy bytes into fresh ArrayBuffer before Blob ctor — TS strict rejects ArrayBufferLike|SharedArrayBuffer as BlobPart in lib.dom 2026. Tests: 34/34 still green. Build 5.6s (motion 96KB, pdf-lib 523KB chunks).
This commit is contained in:
1 parent
b5b2e163c9
commit
f57d6ec3d3
27 files changed
+1574
-23
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import type { HTMLAttributes, ReactNode } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
type Variant = 'neutral' | 'mild' | 'moderate' | 'severe' | 'soft';
|
||||
|
||||
const variants: Record<Variant, string> = {
|
||||
neutral: 'bg-clinic-100 text-clinic-800',
|
||||
mild: 'bg-clinic-200 text-clinic-800',
|
||||
moderate: 'bg-warm-300 text-clinic-900',
|
||||
severe: 'bg-warm-500 text-white',
|
||||
soft: 'bg-clinic-50 text-clinic-700 border border-clinic-100',
|
||||
};
|
||||
|
||||
export function Badge({
|
||||
variant = 'neutral',
|
||||
className,
|
||||
children,
|
||||
...rest
|
||||
}: HTMLAttributes<HTMLSpanElement> & { variant?: Variant; children?: ReactNode }) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium',
|
||||
variants[variant],
|
||||
className,
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user