clean all
This commit is contained in:
1 parent
f57d6ec3d3
commit
27afb719f5
101 files changed
+45
-14426
No files matched your search
@@ -17,4 +17,7 @@ rules:
|
||||
- Architecture validée (BDR-001..008). Stack React 19 + TS strict + Vite 6 + Tailwind 4 + pdf-lib + Zod + Zustand persist.
|
||||
- Scaffold skeleton créé : 21 fichiers config via scaffolder (blocked content filter), reste inline.
|
||||
- Toutes 9 espèces visibles dans selector, MVP equine seule fonctionnelle.
|
||||
- Build passes empty. Implementation plan à écrire (STEP 6).
|
||||
- Plan implémentation écrit (IMPLEMENTATION-PLAN.md, phases A-L).
|
||||
- V1 livré: domain core (commit b5b2e16), UI complet (commit f57d6ec). 34/34 tests verts, roundtrip PDF OK.
|
||||
- Wrap-up: 12 warnings ESLint corrigés (5 `void navigate`, `getAttribute` au lieu de `target.dataset`, 6 import-order auto-fix). Pipeline clean: typecheck + lint 0 + 34 tests + build OK.
|
||||
- Reste backlog post-MVP: ZoomOverlay (E5), e2e Playwright (K1), Docker verify (L2/L3), a11y full pass, SVGs réels, chunking PDF.
|
||||
+41
-6
@@ -2,17 +2,50 @@
|
||||
|
||||
## Status
|
||||
|
||||
Scaffold complete (skeleton + tooling + Docker + nginx). Build passes empty.
|
||||
Implementation plan to be written next (STEP 6 of /init-project).
|
||||
V1 MVP shipped. Domain + UI + PDF roundtrip green. Pipeline clean:
|
||||
typecheck pass, lint 0 issues, 34/34 unit tests pass, build OK (~1.1 MB
|
||||
gzipped JS, pdf chunk dominant). Detailed plan archived in
|
||||
`IMPLEMENTATION-PLAN.md`.
|
||||
|
||||
## Open milestones
|
||||
## Done (V1)
|
||||
|
||||
- [ ] V1 feature implementation (STEP 8) — see plan in this file once STEP 6 produces it.
|
||||
- Phase A — schemas (report, finding, practitioner) + Zod-derived types.
|
||||
- Phase B — equine pack: 26 macro zones, vertebral subzones (C7/T18/L6/S5),
|
||||
32 pathologies with sourced citations, placeholder SVGs in `public/`.
|
||||
- Phase C — Zustand store with persist (`osteo-report-draft`).
|
||||
- Phase D — 3 routes (Home, NewReport, Editor) + species selector showing
|
||||
all 9 species (8 disabled per BDR-007).
|
||||
- Phase E — AnatomyView (DOMParser injection + click handlers), AnatomyCanvas
|
||||
(3-view tabs + motion).
|
||||
- Phase F — FindingEditor (multi-select + free-text pathology), FindingPanel.
|
||||
- Phase G — ConclusionPanel.
|
||||
- Phase H — PDF export (header, anatomy raster pages, findings table,
|
||||
conclusion, footer) with `report.json` attached.
|
||||
- Phase I — PDF import (Zod-validated, `NO_ATTACHMENT` error path).
|
||||
- Phase J (partial) — Brand, Header, Footer, motion presets, basic a11y
|
||||
labels on SVG.
|
||||
- Phase L1 — typecheck/lint/test/build all green.
|
||||
|
||||
## Open backlog (post-MVP)
|
||||
|
||||
- [ ] **E5** ZoomOverlay — currently `return null`. Wire
|
||||
`react-zoom-pan-pinch` inside Dialog when a macro zone has subzones.
|
||||
- [ ] **K1** e2e test `tests/e2e/roundtrip.spec.ts` — full Playwright flow:
|
||||
new bilan → select zones → create finding → export → import → assert
|
||||
hydrated state.
|
||||
- [ ] **L2/L3** Docker verify — `docker compose build` + run + smoke-test
|
||||
CSP doesn't break the SPA in nginx preview.
|
||||
- [ ] **J5** Full a11y pass — keyboard focus rings, color contrast AA,
|
||||
SVG zone aria-labels per `data-zone`.
|
||||
- [ ] Real anatomy SVGs (artist deliverable) — replace placeholders in
|
||||
`public/species/equine/`.
|
||||
- [ ] Build chunking — pdf chunk is 523 kB. Lazy-load PDF stack only on
|
||||
export to drop initial bundle.
|
||||
|
||||
## Conventions
|
||||
|
||||
- Decompose every feature touching logic into subtasks of 2-5 min each.
|
||||
- Mark each subtask done with `[x]` as you finish; never batch.
|
||||
- Decompose every logic-touching task into 2-5 min subtasks.
|
||||
- Mark each subtask `[x]` as finished; never batch.
|
||||
- One subtask = one file or one coherent change. Bigger = split.
|
||||
|
||||
## Roadmap Phase 2 (out of MVP)
|
||||
@@ -20,3 +53,5 @@ Implementation plan to be written next (STEP 6 of /init-project).
|
||||
- Backend (PostgreSQL) + practitioner accounts
|
||||
- Per-animal history
|
||||
- Multi-tenant
|
||||
- Additional species packs (chien, chat, lapin, bovin, chevre, ane,
|
||||
mouton, porc) — anatomy + pathologies + SVGs.
|
||||
@@ -1,143 +0,0 @@
|
||||
# Osteo Report — CLAUDE.md
|
||||
|
||||
Generated by /init-project. Single source of truth for Claude in this repo.
|
||||
Global rules : `~/.claude/CLAUDE.md` — this file extends or overrides them.
|
||||
|
||||
---
|
||||
|
||||
## Project overview
|
||||
|
||||
Web app (SPA) for a veterinary osteopath. Captures the session report on an animal:
|
||||
fills practitioner/animal metadata, clicks anatomy zones on three schematic views
|
||||
(lateral left, lateral right, dorsal), creates clinical findings, exports to A4 PDF
|
||||
with the full report JSON embedded as a native PDF attachment so the PDF can be
|
||||
re-imported later to resume editing. Open-source planned (AGPL-3.0). Client-side only.
|
||||
|
||||
---
|
||||
|
||||
## Stack
|
||||
|
||||
- Node ≥ 20.18 / npm 10
|
||||
- React 19 + TypeScript 5.6 strict
|
||||
- Vite 6
|
||||
- Tailwind 4 + shadcn/ui (Tailwind 4 canary mode)
|
||||
- motion 12 (framer-motion)
|
||||
- pdf-lib 1.17 (PDF generation + attachments)
|
||||
- Zod 3, Zustand 5 (persist), react-hook-form 7, react-router 7
|
||||
- react-zoom-pan-pinch (gated to a modal overlay only)
|
||||
- Vitest + @testing-library/react + Playwright (e2e roundtrip)
|
||||
- ESLint 9 flat + Prettier 3 + Husky 9 + lint-staged 15
|
||||
- Docker (multi-stage node → nginx:alpine) + Traefik labels commented
|
||||
|
||||
---
|
||||
|
||||
## Build commands
|
||||
|
||||
```
|
||||
npm install
|
||||
npm run dev # vite dev server on :5173
|
||||
npm run build # tsc -b && vite build
|
||||
npm run preview # vite preview on :4173
|
||||
npm run test # vitest
|
||||
npm run test:e2e # playwright (needs `npx playwright install chromium` once)
|
||||
npm run lint
|
||||
npm run typecheck
|
||||
npm run format
|
||||
|
||||
# Docker
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Folder structure
|
||||
|
||||
```
|
||||
src/
|
||||
main.tsx, App.tsx, vite-env.d.ts
|
||||
routes/ — HomeRoute, NewReportRoute, EditorRoute, NotFoundRoute
|
||||
editor/ — AnatomyCanvas, AnatomyView, ZoneSelection, FindingPanel, FindingEditor, ZoomOverlay, ConclusionPanel, ExportButton
|
||||
species/
|
||||
types.ts, registry.ts
|
||||
equine/ — anatomy.ts, pathologies.ts, *.svg (full clinical data)
|
||||
chien,chat,lapin,bovin,chevre,ane,mouton,porc/ — stubs for later
|
||||
pdf/ — export.ts, import.ts, version.ts, render/*
|
||||
schema/ — report.ts, finding.ts, practitioner.ts (Zod)
|
||||
state/ — reportStore.ts (Zustand persist), selectors.ts
|
||||
components/ — Header, Footer, Brand, ui/ (shadcn)
|
||||
lib/ — cn, id, date, motion
|
||||
styles/ — globals.css, tokens.css
|
||||
i18n/ — fr.ts
|
||||
tests/
|
||||
unit/ — vitest *.test.ts
|
||||
e2e/ — playwright roundtrip
|
||||
docs/
|
||||
ARCHITECTURE.md, ADDING-A-SPECIES.md, ANATOMY-SVG-CONVENTION.md
|
||||
public/
|
||||
favicon.svg
|
||||
Dockerfile, docker-compose.yml, nginx.conf
|
||||
.claude/ — tasks/, memory/, audits/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
- Single Zustand store = source of truth (`useReportStore`). `persist` middleware autosaves to localStorage under key `osteo-report-draft`.
|
||||
- Zod schemas in `src/schema/` define the wire format. TS types derived via `z.infer`. No manual duplication.
|
||||
- Each species ships its own pack `{ anatomy, pathologies }`, registered in `src/species/registry.ts`. The form lists ALL species; only those registered are usable (others are disabled with a "à venir" badge). MVP = equine only.
|
||||
- PDF export builds A4 portrait with `pdf-lib`, then `PDFDocument.attach(JSON, 'report.json')`. On import, the file is parsed, the `report.json` attachment is read, validated through `ReportSchema.safeParse`. If absent → `NO_ATTACHMENT` error shown to user.
|
||||
- The `react-zoom-pan-pinch` library is used ONLY inside `ZoomOverlay` (modal) to avoid click+pan event conflicts on the main SVG.
|
||||
- nginx serves the static SPA with strict CSP (`unsafe-inline` allowed for `style-src` only — needed by motion).
|
||||
|
||||
---
|
||||
|
||||
## Project conventions
|
||||
|
||||
- Files: kebab-case folders, PascalCase components, camelCase utils.
|
||||
- Types from Zod: `type Foo = z.infer<typeof FooSchema>`. Never write a parallel interface.
|
||||
- Imports: absolute via `@/` (resolves to `src/`).
|
||||
- French strings: in `src/i18n/fr.ts` only. No hardcoded user-facing text in components.
|
||||
- One responsibility per component. Editor panels do NOT mutate store from JSX inline handlers — go through a store action.
|
||||
- Anatomy SVG layers: `#illustration` (non-interactive) + `#zones` (`data-zone="..."` clickable paths). See `docs/ANATOMY-SVG-CONVENTION.md`.
|
||||
|
||||
---
|
||||
|
||||
## Exceptions to global rules
|
||||
|
||||
- None. Global rules in `~/.claude/CLAUDE.md` apply.
|
||||
- `noUncheckedIndexedAccess` is on — be explicit about possible `undefined` from array indexing.
|
||||
|
||||
---
|
||||
|
||||
## Key dependencies
|
||||
|
||||
```
|
||||
react 19 — UI framework
|
||||
react-router 7 — client-side routing (3 routes)
|
||||
zustand 5 — state, with persist middleware
|
||||
zod 3 — runtime validation, source of types
|
||||
pdf-lib 1.17 — PDF build with file attachments
|
||||
react-hook-form 7 — form state
|
||||
react-zoom-pan-pinch — modal zoom for sub-zones
|
||||
motion 12 — animations (framer-motion lineage)
|
||||
date-fns — French date formatting
|
||||
nanoid — ID generation
|
||||
tailwindcss 4 — styling (CSS-config mode)
|
||||
shadcn/ui — base components (canary supports v4)
|
||||
lucide-react — icons
|
||||
vitest, @testing-library/react, playwright — tests
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow expectations
|
||||
|
||||
- Read `.claude/memory/` registries at session start.
|
||||
- Plan in `.claude/tasks/TODO.md` before touching logic.
|
||||
- TDD for any non-trivial behavior: write test first, then make it pass.
|
||||
- Roundtrip test (`tests/unit/pdf.roundtrip.test.ts`) must stay green on every PR — it's the canary for breaking changes in the PDF format.
|
||||
- Never `npm install` a dep without naming it in this file's "Key dependencies" section.
|
||||
- No backend in MVP. If a task seems to need one, push it to Phase 2.
|
||||
- The pathology DB must cite sources. Adding entries without a source = blocker.
|
||||
- Anatomy illustrations and zone polygons are out of scope for code. Placeholders are acceptable until the artwork lands.
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
# Stage 1: Build
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --ignore-scripts
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production (nginx)
|
||||
FROM nginx:alpine AS production
|
||||
|
||||
# Remove default nginx config
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy custom nginx config
|
||||
COPY nginx.conf /etc/nginx/conf.d/osteo.conf
|
||||
|
||||
# Copy built assets
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Run as non-root
|
||||
RUN chown -R nginx:nginx /usr/share/nginx/html && \
|
||||
chown -R nginx:nginx /var/cache/nginx && \
|
||||
chown -R nginx:nginx /var/log/nginx && \
|
||||
touch /var/run/nginx.pid && \
|
||||
chown nginx:nginx /var/run/nginx.pid
|
||||
|
||||
USER nginx
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,661 +0,0 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
@@ -1,121 +0,0 @@
|
||||
# Osteo Report
|
||||
|
||||
> Bilans de séance d'ostéopathie animalière — application web client-side, export PDF auto-portant.
|
||||
|
||||
Application web pour vétérinaire ostéopathe : saisie du compte rendu de séance,
|
||||
annotation de zones anatomiques sur des schémas, export en PDF propre. Le PDF
|
||||
généré embarque le JSON complet du bilan en pièce jointe native — il peut être
|
||||
ré-importé plus tard pour reprendre l'édition.
|
||||
|
||||
100 % côté client. Aucun serveur, aucune base de données, aucune donnée stockée
|
||||
en dehors du PDF que le praticien télécharge.
|
||||
|
||||
---
|
||||
|
||||
## Tech
|
||||
|
||||
- React 19 / TypeScript 5 strict / Vite 6
|
||||
- Tailwind 4 + shadcn/ui (canary) + `motion` (framer-motion)
|
||||
- Zod (validation runtime des PDFs importés)
|
||||
- Zustand 5 (état + autosave localStorage)
|
||||
- pdf-lib (génération PDF + pièces jointes natives)
|
||||
- react-hook-form, react-router 7, react-zoom-pan-pinch
|
||||
- Vitest + @testing-library/react + Playwright
|
||||
- Docker multi-stage → nginx alpine + Traefik (labels commentés)
|
||||
|
||||
---
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Node ≥ 20.18 (`nvm use` lit `.nvmrc`)
|
||||
- npm 10
|
||||
- Docker (déploiement uniquement)
|
||||
- `npx playwright install chromium` (avant les tests e2e, une seule fois)
|
||||
|
||||
---
|
||||
|
||||
## Démarrage
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev # http://localhost:5173
|
||||
```
|
||||
|
||||
## Commandes
|
||||
|
||||
```bash
|
||||
npm run dev # dev server (Vite)
|
||||
npm run build # production build (tsc -b && vite build)
|
||||
npm run preview # preview build sur :4173
|
||||
npm run test # vitest run
|
||||
npm run test:watch # vitest watch
|
||||
npm run test:e2e # playwright
|
||||
npm run lint # eslint
|
||||
npm run lint:fix # eslint --fix
|
||||
npm run typecheck # tsc -b --noEmit
|
||||
npm run format # prettier --write .
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
Le `docker-compose.yml` contient des labels Traefik commentés à activer pour la
|
||||
mise en production sur sous-domaine.
|
||||
|
||||
---
|
||||
|
||||
## Espèces couvertes
|
||||
|
||||
Le formulaire de nouveau bilan propose 9 espèces :
|
||||
|
||||
| Espèce | MVP | Anatomie complète | Base pathologies |
|
||||
|---------|-------|-------------------|------------------|
|
||||
| Cheval | ✅ | en cours | seed initial |
|
||||
| Chien | bientôt | — | — |
|
||||
| Chat | bientôt | — | — |
|
||||
| Lapin | bientôt | — | — |
|
||||
| Bovin | bientôt | — | — |
|
||||
| Chèvre | bientôt | — | — |
|
||||
| Âne | bientôt | — | — |
|
||||
| Mouton | bientôt | — | — |
|
||||
| Porc | bientôt | — | — |
|
||||
|
||||
Le code est conçu pour qu'ajouter une espèce = ajouter un dossier
|
||||
`src/species/<id>/`. Voir [docs/ADDING-A-SPECIES.md](docs/ADDING-A-SPECIES.md).
|
||||
|
||||
---
|
||||
|
||||
## Format PDF
|
||||
|
||||
Chaque PDF exporté contient :
|
||||
|
||||
- Header avec coordonnées du praticien, animal, propriétaire, date.
|
||||
- Pour chaque vue où des zones ont été cliquées : un schéma annoté.
|
||||
- Tableau des findings (zone, pathologie, sévérité, commentaire).
|
||||
- Conclusion + recommandations.
|
||||
- Date de prochain rendez-vous (optionnel).
|
||||
- Footer avec date d'export.
|
||||
- **Pièce jointe `report.json`** : le bilan complet, lisible par cette
|
||||
application pour reprendre l'édition.
|
||||
|
||||
À l'import, l'app vérifie la présence de la pièce jointe, valide le JSON via
|
||||
Zod et restitue l'état. Un PDF externe (pas généré par l'app) est rejeté avec
|
||||
un message clair.
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — modules, flux, décisions.
|
||||
- [`docs/ADDING-A-SPECIES.md`](docs/ADDING-A-SPECIES.md) — guide d'ajout d'une espèce.
|
||||
- [`docs/ANATOMY-SVG-CONVENTION.md`](docs/ANATOMY-SVG-CONVENTION.md) — règles SVG anatomique.
|
||||
- [`CLAUDE.md`](CLAUDE.md) — instructions pour Claude Code dans ce repo.
|
||||
|
||||
---
|
||||
|
||||
## Licence
|
||||
|
||||
[AGPL-3.0-or-later](LICENSE) © ZenQuality
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "new-york",
|
||||
"rsc": false,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/styles/globals.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/cn",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"iconLibrary": "lucide"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
env_file:
|
||||
- .env
|
||||
restart: unless-stopped
|
||||
# Uncomment and configure Traefik labels for production deploy:
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
# - "traefik.http.routers.osteo.rule=Host(`osteo.zenquality.fr`)"
|
||||
# - "traefik.http.routers.osteo.entrypoints=websecure"
|
||||
# - "traefik.http.routers.osteo.tls.certresolver=letsencrypt"
|
||||
# - "traefik.http.services.osteo.loadbalancer.server.port=80"
|
||||
|
||||
volumes: {}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Ajouter une espèce
|
||||
|
||||
Le code est conçu pour rendre triviale l'ajout d'une nouvelle espèce. Trois fichiers + trois SVG.
|
||||
|
||||
## Étapes
|
||||
|
||||
1. **Créer le dossier** `src/species/<id>/` où `<id>` ∈ { chien, chat, equine, lapin, bovin, chevre, ane, mouton, porc, … }.
|
||||
2. **Anatomie** — `src/species/<id>/anatomy.ts` exporte un `SpeciesAnatomy` (voir `src/species/types.ts`) :
|
||||
- `id`, `label`, `vertebralFormula`
|
||||
- `zones[]` (id, label, catégorie, vues où visible, sous-zones éventuelles)
|
||||
- `svg` : chemins relatifs vers les 3 SVG (`lateral_left`, `lateral_right`, `dorsal`)
|
||||
3. **Pathologies** — `src/species/<id>/pathologies.ts` exporte `PathologyEntry[]`.
|
||||
Chaque entrée DOIT citer au moins une source clinique (Merck Veterinary Manual, IMAIOS,
|
||||
PubMed, etc.). Voir `src/species/equine/README.md` pour la liste des sources de référence.
|
||||
4. **Illustrations** — 3 SVG conformes à la convention (voir `ANATOMY-SVG-CONVENTION.md`) :
|
||||
- `lateral_left.svg`, `lateral_right.svg`, `dorsal.svg`
|
||||
- viewBox normalisé (1000×600 latéral, 1000×800 dorsal)
|
||||
- Couche `#illustration` + couche `#zones` avec `data-zone="<zoneId>"` sur chaque path.
|
||||
5. **Enregistrement** — dans `src/species/registry.ts`, importer puis `registerSpecies('<id>', { anatomy, pathologies })`.
|
||||
Ou : laisser le chargement paresseux via `import('./<id>/index.ts')` (préféré pour le code-splitting).
|
||||
6. **Test** — `tests/unit/species.<id>.test.ts` doit vérifier que le pack se charge et que la liste de zones est non vide.
|
||||
@@ -1,42 +0,0 @@
|
||||
# Convention SVG anatomique
|
||||
|
||||
Chaque vue (latéral gauche, latéral droit, dorsal) est un fichier SVG avec **au moins deux couches** :
|
||||
|
||||
```xml
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600">
|
||||
<g id="illustration">
|
||||
<!-- tout le dessin : silhouettes, ombres, traits -->
|
||||
<!-- AUCUN evènement, pointer-events: none côté CSS -->
|
||||
</g>
|
||||
|
||||
<g id="zones">
|
||||
<!-- une <path>/<polygon> par zone cliquable -->
|
||||
<path id="zone-shoulder-l"
|
||||
data-zone="zone-shoulder-l"
|
||||
fill="transparent" />
|
||||
<path id="zone-thoracic-back"
|
||||
data-zone="zone-thoracic-back"
|
||||
fill="transparent" />
|
||||
<!-- ... -->
|
||||
</g>
|
||||
</svg>
|
||||
```
|
||||
|
||||
## Règles
|
||||
|
||||
- **viewBox normalisé** :
|
||||
- Vues latérales : `0 0 1000 600`
|
||||
- Vue dorsale : `0 0 1000 800`
|
||||
- **IDs de zones** : `zone-<region>-<side?>`, en minuscules, kebab-case.
|
||||
- Exemples : `zone-neck`, `zone-shoulder-l`, `zone-shoulder-r`, `zone-thoracic-back`, `zone-lumbar`, `zone-hip-l`, `zone-tail`.
|
||||
- **Attribut clef** : `data-zone="<id>"` doit matcher l'id de zone dans `anatomy.ts`.
|
||||
- **Couleur des zones cliquables** : `fill="transparent"` par défaut. Le CSS applique le style selon `data-selected`, `data-linked`, `data-hovered`.
|
||||
- **Pas d'interactivité** sur la couche `#illustration` (CSS : `pointer-events: none`).
|
||||
- **Sous-zones** (vertèbres T1-T18, etc.) : dans un SVG séparé, ouvert dans `ZoomOverlay`.
|
||||
Convention identique avec `data-subzone="T7"` etc.
|
||||
|
||||
## Outils suggérés
|
||||
|
||||
- Inkscape ou Figma pour le tracé des polygones par-dessus l'illustration.
|
||||
- Une fois tracés, exporter en SVG plain (Inkscape : "Sauvegarder une copie → SVG simple").
|
||||
- Nettoyer avec [SVGO](https://github.com/svg/svgo) en préservant les IDs et attributs `data-*`.
|
||||
@@ -1,42 +0,0 @@
|
||||
# Architecture — Osteo Report
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
SPA React 100 % cliente. Aucun backend pour le MVP. Tout l'état vit dans le navigateur ; la persistance canonique est le PDF exporté (le JSON du bilan est embarqué en pièce jointe PDF native).
|
||||
|
||||
## Flux
|
||||
|
||||
```
|
||||
Choix : Nouveau bilan ─┐
|
||||
├─► Éditeur (3 vues anatomiques)
|
||||
Importer PDF ──────────┘ │
|
||||
├─► Sélection zones ─► Findings
|
||||
├─► Conclusion / Recommandations / RDV
|
||||
└─► Export PDF (joint report.json)
|
||||
```
|
||||
|
||||
## Modules
|
||||
|
||||
| Module | Rôle |
|
||||
|-----------------------|------|
|
||||
| `state/reportStore` | Source de vérité unique. Persist localStorage (autosave). |
|
||||
| `schema/*` | Schémas Zod = source de types (`z.infer`). Version 1. |
|
||||
| `species/registry` | Map `SpeciesId` → `SpeciesPack { anatomy, pathologies }`. |
|
||||
| `species/equine/*` | Données cliniques cheval (anatomie + pathologies sourcées). |
|
||||
| `editor/*` | UI d'édition : vue anatomique, sélection, panneau findings, zoom. |
|
||||
| `pdf/export` | Construit le PDF A4 + attache `report.json`. |
|
||||
| `pdf/import` | Lit la pièce jointe, valide Zod, restitue l'état. |
|
||||
| `routes/*` | 3 routes : `/`, `/new`, `/editor`, 404. |
|
||||
|
||||
## Décisions structurantes
|
||||
|
||||
- **Pas de backend MVP.** RGPD trivial, scalabilité gratuite, surface d'attaque minimale.
|
||||
- **Tailwind 4** via `@tailwindcss/vite` (config CSS dans `globals.css`).
|
||||
- **React 19** + TS strict + `noUncheckedIndexedAccess` + `exactOptionalPropertyTypes`.
|
||||
- **Anatomie SVG** : convention à 2 couches (`#illustration` non interactive + `#zones` avec `data-zone="..."` cliquables). Voir `ANATOMY-SVG-CONVENTION.md`.
|
||||
- **Zoom sous-zones** : modal dédié avec `react-zoom-pan-pinch`. Le SVG principal reste pure click.
|
||||
- **Versioning PDF** : champ `version` dans le JSON. Migrations explicites à l'import.
|
||||
|
||||
## Phase 2 (hors MVP)
|
||||
|
||||
Ajout backend (PostgreSQL) + comptes praticiens + historique par animal. La couche métier (`schema/`, `state/`, `pdf/`) reste intacte ; seul un adapter de persistance s'ajoute.
|
||||
@@ -1,73 +0,0 @@
|
||||
import js from '@eslint/js';
|
||||
import importX from 'eslint-plugin-import-x';
|
||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import prettierConfig from 'eslint-config-prettier';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: [
|
||||
'dist/',
|
||||
'node_modules/',
|
||||
'coverage/',
|
||||
'playwright-report/',
|
||||
'test-results/',
|
||||
'eslint.config.js',
|
||||
'vite.config.ts',
|
||||
'vitest.config.ts',
|
||||
'playwright.config.ts',
|
||||
'tailwind.config.ts',
|
||||
],
|
||||
},
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.strictTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
{
|
||||
files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
'react-hooks': reactHooks,
|
||||
'jsx-a11y': jsxA11y,
|
||||
'import-x': importX,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
...jsxA11y.configs.recommended.rules,
|
||||
'import-x/order': [
|
||||
'warn',
|
||||
{
|
||||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
||||
'newlines-between': 'always',
|
||||
alphabetize: { order: 'asc' },
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
// React-idiomatic relaxations (strict-type-checked is too aggressive
|
||||
// against common JSX patterns):
|
||||
'@typescript-eslint/no-confusing-void-expression': 'off',
|
||||
'@typescript-eslint/no-misused-promises': [
|
||||
'error',
|
||||
{ checksVoidReturn: { attributes: false } },
|
||||
],
|
||||
'@typescript-eslint/no-floating-promises': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||
'@typescript-eslint/restrict-template-expressions': [
|
||||
'error',
|
||||
{ allowNumber: true, allowBoolean: true },
|
||||
],
|
||||
'@typescript-eslint/dot-notation': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
||||
},
|
||||
},
|
||||
prettierConfig,
|
||||
);
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="description" content="Osteo Report — outil de compte-rendu ostéopathique vétérinaire" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<title>Osteo Report</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/xml
|
||||
text/javascript
|
||||
application/json
|
||||
application/javascript
|
||||
application/xml
|
||||
application/xml+rss
|
||||
image/svg+xml;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
||||
add_header Content-Security-Policy
|
||||
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self'; connect-src 'self'; worker-src blob:; object-src 'none'; base-uri 'self'; form-action 'self';"
|
||||
always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# SPA fallback
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
|
||||
# Cache static assets 1 year
|
||||
location ~* \.(js|css|woff2|woff|ttf|otf|ico|svg|png|jpg|jpeg|gif|webp)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# No cache for index
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
expires 0;
|
||||
}
|
||||
}
|
||||
Generated
-9661
File diff suppressed because it is too large.
Load diff
@@ -1,78 +0,0 @@
|
||||
{
|
||||
"name": "osteo-report",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"license": "AGPL-3.0-only",
|
||||
"author": "ZenQuality / Bastien Chanot <chanot.bastien@gmail.com>",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test:e2e": "playwright test",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"format": "prettier --write .",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.9.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"date-fns": "^4.1.0",
|
||||
"framer-motion": "^12.38.0",
|
||||
"lucide-react": "^0.468.0",
|
||||
"motion": "^12.38.0",
|
||||
"nanoid": "^5.0.9",
|
||||
"pako": "^2.1.0",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-hook-form": "^7.54.0",
|
||||
"react-router-dom": "^7.0.2",
|
||||
"react-zoom-pan-pinch": "^3.7.0",
|
||||
"tailwind-merge": "^2.6.0",
|
||||
"zod": "^3.23.8",
|
||||
"zustand": "^5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.49.1",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.1.0",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/node": "^22.19.19",
|
||||
"@types/pako": "^2.0.4",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import-x": "^4.5.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-react-hooks": "^5.1.0",
|
||||
"husky": "^9.1.7",
|
||||
"jsdom": "^25.0.1",
|
||||
"lint-staged": "^15.3.0",
|
||||
"prettier": "^3.4.2",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.18.2",
|
||||
"vite": "^6.0.5",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": [
|
||||
"eslint --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"*.{json,css,md}": [
|
||||
"prettier --write"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './tests/e2e',
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env['CI'],
|
||||
retries: process.env['CI'] ? 2 : 0,
|
||||
workers: process.env['CI'] ? 1 : undefined,
|
||||
reporter: 'html',
|
||||
use: {
|
||||
baseURL: 'http://localhost:4173',
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
command: 'npm run preview',
|
||||
url: 'http://localhost:4173',
|
||||
reuseExistingServer: !process.env['CI'],
|
||||
},
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
||||
<circle cx="32" cy="32" r="30" fill="#4a7c59"/>
|
||||
<path d="M22 28 Q32 18 42 28 Q42 38 32 46 Q22 38 22 28 Z" fill="#fffdf8" opacity="0.9"/>
|
||||
<circle cx="32" cy="34" r="3" fill="#2d4a35"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 281 B |
@@ -1,22 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 800" role="img" aria-label="Cheval vu de dessus">
|
||||
<g id="illustration" pointer-events="none">
|
||||
<ellipse cx="500" cy="160" rx="55" ry="80" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
|
||||
<path d="M460 230 Q500 240 540 230 L555 290 L555 720 Q500 740 445 720 L445 290 Z" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
|
||||
<line x1="500" y1="240" x2="500" y2="720" stroke="#4a7c59" stroke-width="1" stroke-dasharray="4 4"/>
|
||||
</g>
|
||||
<g id="zones">
|
||||
<path id="zone-head" data-zone="head" d="M455 90 L545 90 L555 230 L445 230 Z" fill="transparent"/>
|
||||
<path id="zone-neck" data-zone="neck" d="M450 235 L550 235 L555 305 L445 305 Z" fill="transparent"/>
|
||||
<path id="zone-withers" data-zone="withers" d="M455 305 L545 305 L545 360 L455 360 Z" fill="transparent"/>
|
||||
<path id="zone-shoulder-l" data-zone="shoulder-l" d="M395 305 L445 305 L445 380 L395 375 Z" fill="transparent"/>
|
||||
<path id="zone-shoulder-r" data-zone="shoulder-r" d="M555 305 L605 305 L605 375 L555 380 Z" fill="transparent"/>
|
||||
<path id="zone-thoracic-back" data-zone="thoracic-back" d="M455 360 L545 360 L545 540 L455 540 Z" fill="transparent"/>
|
||||
<path id="zone-lumbar" data-zone="lumbar" d="M455 540 L545 540 L545 620 L455 620 Z" fill="transparent"/>
|
||||
<path id="zone-sacro-iliac-l" data-zone="sacro-iliac-l" d="M420 620 L495 620 L495 670 L420 670 Z" fill="transparent"/>
|
||||
<path id="zone-sacro-iliac-r" data-zone="sacro-iliac-r" d="M505 620 L580 620 L580 670 L505 670 Z" fill="transparent"/>
|
||||
<path id="zone-sacrum" data-zone="sacrum" d="M455 660 L545 660 L545 720 L455 720 Z" fill="transparent"/>
|
||||
<path id="zone-hip-l" data-zone="hip-l" d="M395 620 L450 620 L450 720 L395 720 Z" fill="transparent"/>
|
||||
<path id="zone-hip-r" data-zone="hip-r" d="M550 620 L605 620 L605 720 L550 720 Z" fill="transparent"/>
|
||||
<path id="zone-tail" data-zone="tail" d="M470 720 L530 720 L530 770 L470 770 Z" fill="transparent"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,24 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600" role="img" aria-label="Cheval vu de la gauche">
|
||||
<g id="illustration" pointer-events="none">
|
||||
<path d="M120 320 Q180 280 260 290 L320 200 Q360 170 400 195 L430 240 Q480 245 550 250 L620 260 Q700 260 760 285 L820 320 L860 350 L860 410 L830 420 L810 470 L780 475 L765 530 L740 540 L720 470 L700 470 L685 530 L660 540 L640 470 L470 470 L450 530 L425 540 L405 470 L385 470 L365 530 L340 540 L320 470 L300 470 L285 530 L260 540 L240 470 L220 460 L180 400 L140 380 Z" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
|
||||
<circle cx="345" cy="220" r="6" fill="#2d4a35"/>
|
||||
</g>
|
||||
<g id="zones">
|
||||
<path id="zone-head" data-zone="head" d="M310 175 L380 175 L390 235 L320 240 Z" fill="transparent"/>
|
||||
<path id="zone-neck" data-zone="neck" d="M390 235 L470 245 L460 290 L380 295 Z" fill="transparent"/>
|
||||
<path id="zone-withers" data-zone="withers" d="M460 245 L530 245 L530 280 L455 280 Z" fill="transparent"/>
|
||||
<path id="zone-thoracic-back" data-zone="thoracic-back" d="M530 250 L680 260 L680 295 L530 290 Z" fill="transparent"/>
|
||||
<path id="zone-lumbar" data-zone="lumbar" d="M680 260 L760 280 L760 315 L680 300 Z" fill="transparent"/>
|
||||
<path id="zone-sacrum" data-zone="sacrum" d="M760 285 L820 320 L815 355 L755 325 Z" fill="transparent"/>
|
||||
<path id="zone-tail" data-zone="tail" d="M820 320 L870 320 L880 360 L825 360 Z" fill="transparent"/>
|
||||
<path id="zone-shoulder-l" data-zone="shoulder-l" d="M460 280 L520 290 L505 360 L455 350 Z" fill="transparent"/>
|
||||
<path id="zone-elbow-l" data-zone="elbow-l" d="M460 360 L505 360 L500 400 L460 400 Z" fill="transparent"/>
|
||||
<path id="zone-knee-l" data-zone="knee-l" d="M450 400 L500 400 L495 445 L450 445 Z" fill="transparent"/>
|
||||
<path id="zone-fetlock-front-l" data-zone="fetlock-front-l" d="M445 445 L495 445 L490 480 L445 480 Z" fill="transparent"/>
|
||||
<path id="zone-hip-l" data-zone="hip-l" d="M710 285 L770 290 L760 360 L705 355 Z" fill="transparent"/>
|
||||
<path id="zone-stifle-l" data-zone="stifle-l" d="M700 360 L760 360 L755 405 L700 405 Z" fill="transparent"/>
|
||||
<path id="zone-hock-l" data-zone="hock-l" d="M700 405 L755 405 L750 450 L700 450 Z" fill="transparent"/>
|
||||
<path id="zone-fetlock-rear-l" data-zone="fetlock-rear-l" d="M700 450 L750 450 L745 485 L700 485 Z" fill="transparent"/>
|
||||
<path id="zone-sacro-iliac-l" data-zone="sacro-iliac-l" d="M740 285 L795 290 L790 320 L735 315 Z" fill="transparent"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -1,24 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 600" role="img" aria-label="Cheval vu de la droite">
|
||||
<g id="illustration" pointer-events="none" transform="translate(1000,0) scale(-1,1)">
|
||||
<path d="M120 320 Q180 280 260 290 L320 200 Q360 170 400 195 L430 240 Q480 245 550 250 L620 260 Q700 260 760 285 L820 320 L860 350 L860 410 L830 420 L810 470 L780 475 L765 530 L740 540 L720 470 L700 470 L685 530 L660 540 L640 470 L470 470 L450 530 L425 540 L405 470 L385 470 L365 530 L340 540 L320 470 L300 470 L285 530 L260 540 L240 470 L220 460 L180 400 L140 380 Z" fill="#e6ede0" stroke="#4a7c59" stroke-width="2"/>
|
||||
<circle cx="345" cy="220" r="6" fill="#2d4a35"/>
|
||||
</g>
|
||||
<g id="zones" transform="translate(1000,0) scale(-1,1)">
|
||||
<path id="zone-head" data-zone="head" d="M310 175 L380 175 L390 235 L320 240 Z" fill="transparent"/>
|
||||
<path id="zone-neck" data-zone="neck" d="M390 235 L470 245 L460 290 L380 295 Z" fill="transparent"/>
|
||||
<path id="zone-withers" data-zone="withers" d="M460 245 L530 245 L530 280 L455 280 Z" fill="transparent"/>
|
||||
<path id="zone-thoracic-back" data-zone="thoracic-back" d="M530 250 L680 260 L680 295 L530 290 Z" fill="transparent"/>
|
||||
<path id="zone-lumbar" data-zone="lumbar" d="M680 260 L760 280 L760 315 L680 300 Z" fill="transparent"/>
|
||||
<path id="zone-sacrum" data-zone="sacrum" d="M760 285 L820 320 L815 355 L755 325 Z" fill="transparent"/>
|
||||
<path id="zone-tail" data-zone="tail" d="M820 320 L870 320 L880 360 L825 360 Z" fill="transparent"/>
|
||||
<path id="zone-shoulder-r" data-zone="shoulder-r" d="M460 280 L520 290 L505 360 L455 350 Z" fill="transparent"/>
|
||||
<path id="zone-elbow-r" data-zone="elbow-r" d="M460 360 L505 360 L500 400 L460 400 Z" fill="transparent"/>
|
||||
<path id="zone-knee-r" data-zone="knee-r" d="M450 400 L500 400 L495 445 L450 445 Z" fill="transparent"/>
|
||||
<path id="zone-fetlock-front-r" data-zone="fetlock-front-r" d="M445 445 L495 445 L490 480 L445 480 Z" fill="transparent"/>
|
||||
<path id="zone-hip-r" data-zone="hip-r" d="M710 285 L770 290 L760 360 L705 355 Z" fill="transparent"/>
|
||||
<path id="zone-stifle-r" data-zone="stifle-r" d="M700 360 L760 360 L755 405 L700 405 Z" fill="transparent"/>
|
||||
<path id="zone-hock-r" data-zone="hock-r" d="M700 405 L755 405 L750 450 L700 450 Z" fill="transparent"/>
|
||||
<path id="zone-fetlock-rear-r" data-zone="fetlock-rear-r" d="M700 450 L750 450 L745 485 L700 485 Z" fill="transparent"/>
|
||||
<path id="zone-sacro-iliac-r" data-zone="sacro-iliac-r" d="M740 285 L795 290 L790 320 L735 315 Z" fill="transparent"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.5 KiB |
-19
@@ -1,19 +0,0 @@
|
||||
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
||||
|
||||
import { EditorRoute } from './routes/EditorRoute';
|
||||
import { HomeRoute } from './routes/HomeRoute';
|
||||
import { NewReportRoute } from './routes/NewReportRoute';
|
||||
import { NotFoundRoute } from './routes/NotFoundRoute';
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/" element={<HomeRoute />} />
|
||||
<Route path="/new" element={<NewReportRoute />} />
|
||||
<Route path="/editor" element={<EditorRoute />} />
|
||||
<Route path="*" element={<NotFoundRoute />} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import { FR } from '@/i18n/fr';
|
||||
|
||||
export function Brand({ compact = false }: { compact?: boolean }) {
|
||||
return (
|
||||
<a href="/" className="inline-flex items-center gap-2 text-clinic-800 hover:text-clinic-900">
|
||||
<svg
|
||||
width={compact ? 24 : 32}
|
||||
height={compact ? 24 : 32}
|
||||
viewBox="0 0 64 64"
|
||||
aria-hidden
|
||||
>
|
||||
<circle cx="32" cy="32" r="30" fill="currentColor" opacity="0.12" />
|
||||
<circle cx="32" cy="32" r="22" fill="currentColor" opacity="0.18" />
|
||||
<path
|
||||
d="M22 28 Q32 18 42 28 Q42 38 32 46 Q22 38 22 28 Z"
|
||||
fill="currentColor"
|
||||
opacity="0.85"
|
||||
/>
|
||||
<circle cx="32" cy="34" r="3" fill="white" />
|
||||
</svg>
|
||||
<span className={compact ? 'font-display text-base' : 'font-display text-lg'}>
|
||||
{FR.app.name}
|
||||
</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { FR } from '@/i18n/fr';
|
||||
|
||||
export function Footer() {
|
||||
const year = new Date().getFullYear();
|
||||
return (
|
||||
<footer className="border-t border-clinic-100 bg-white/60 px-6 py-4 text-xs text-clinic-700">
|
||||
<div className="mx-auto flex max-w-7xl items-center justify-between">
|
||||
<span>
|
||||
{FR.app.name} · {year} ·{' '}
|
||||
<a
|
||||
href="https://www.gnu.org/licenses/agpl-3.0.html"
|
||||
className="underline hover:text-clinic-900"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
AGPL-3.0
|
||||
</a>
|
||||
</span>
|
||||
<span>{FR.app.tagline}</span>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Brand } from './Brand';
|
||||
|
||||
export function Header() {
|
||||
return (
|
||||
<header className="border-b border-clinic-100 bg-white/80 px-6 py-4 backdrop-blur">
|
||||
<div className="mx-auto flex max-w-7xl items-center justify-between">
|
||||
<Brand />
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import { Footer } from './Footer';
|
||||
import { Header } from './Header';
|
||||
|
||||
export function Shell({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col bg-surface text-ink">
|
||||
<Header />
|
||||
<main className="flex-1">{children}</main>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,33 +0,0 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
type Variant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
||||
type Size = 'sm' | 'md' | 'lg';
|
||||
|
||||
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: Variant;
|
||||
size?: Size;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
const base =
|
||||
'inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors ' +
|
||||
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-clinic-500 focus-visible:ring-offset-2 ' +
|
||||
'disabled:pointer-events-none disabled:opacity-50';
|
||||
|
||||
const variants: Record<Variant, string> = {
|
||||
primary: 'bg-clinic-600 text-white hover:bg-clinic-700',
|
||||
secondary: 'bg-clinic-100 text-clinic-800 hover:bg-clinic-200',
|
||||
ghost: 'text-clinic-700 hover:bg-clinic-100',
|
||||
danger: 'bg-warm-500 text-white hover:bg-warm-400',
|
||||
};
|
||||
|
||||
const sizes: Record<Size, string> = {
|
||||
sm: 'h-8 px-3 text-sm',
|
||||
md: 'h-10 px-4 text-sm',
|
||||
lg: 'h-12 px-6 text-base',
|
||||
};
|
||||
|
||||
export function Button({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
className,
|
||||
children,
|
||||
type = 'button',
|
||||
...rest
|
||||
}: ButtonProps) {
|
||||
return (
|
||||
<button type={type} className={cn(base, variants[variant], sizes[size], className)} {...rest}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import type { HTMLAttributes, ReactNode } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
export function Card({
|
||||
className,
|
||||
children,
|
||||
...rest
|
||||
}: HTMLAttributes<HTMLDivElement> & { children?: ReactNode }) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'rounded-lg border border-clinic-100 bg-white shadow-sm',
|
||||
className,
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CardHeader({
|
||||
className,
|
||||
children,
|
||||
}: HTMLAttributes<HTMLDivElement> & { children?: ReactNode }) {
|
||||
return (
|
||||
<div className={cn('border-b border-clinic-100 p-5', className)}>{children}</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CardBody({
|
||||
className,
|
||||
children,
|
||||
}: HTMLAttributes<HTMLDivElement> & { children?: ReactNode }) {
|
||||
return <div className={cn('p-5', className)}>{children}</div>;
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import { AnimatePresence, motion } from 'motion/react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { SPRING } from '@/lib/motion';
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
interface DialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
title?: string;
|
||||
children?: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function Dialog({ open, onClose, title, children, className }: DialogProps) {
|
||||
useEffect(() => {
|
||||
if (!open) return undefined;
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') onClose();
|
||||
};
|
||||
document.addEventListener('keydown', onKey);
|
||||
return () => document.removeEventListener('keydown', onKey);
|
||||
}, [open, onClose]);
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{open && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
||||
<motion.div
|
||||
className="absolute inset-0 bg-clinic-900/40"
|
||||
onClick={onClose}
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.15 }}
|
||||
/>
|
||||
<motion.div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={title}
|
||||
className={cn(
|
||||
'relative z-10 max-h-[85vh] w-full max-w-3xl overflow-auto rounded-lg bg-white p-6 shadow-xl',
|
||||
className,
|
||||
)}
|
||||
initial={{ opacity: 0, y: 12, scale: 0.98 }}
|
||||
animate={{ opacity: 1, y: 0, scale: 1 }}
|
||||
exit={{ opacity: 0, y: 6, scale: 0.98 }}
|
||||
transition={SPRING}
|
||||
>
|
||||
{title && <h2 className="mb-4 font-display text-xl text-clinic-900">{title}</h2>}
|
||||
{children}
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import type { InputHTMLAttributes } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
export const Input = forwardRef<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>>(
|
||||
function Input({ className, ...rest }, ref) {
|
||||
return (
|
||||
<input
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'h-10 w-full rounded-md border border-clinic-200 bg-white px-3 text-sm',
|
||||
'placeholder:text-clinic-400 focus:border-clinic-500 focus:outline-none focus:ring-1 focus:ring-clinic-500',
|
||||
'disabled:bg-clinic-50 disabled:text-clinic-400',
|
||||
className,
|
||||
)}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -1,15 +0,0 @@
|
||||
import type { LabelHTMLAttributes, ReactNode } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
export function Label({
|
||||
className,
|
||||
children,
|
||||
...rest
|
||||
}: LabelHTMLAttributes<HTMLLabelElement> & { children?: ReactNode }) {
|
||||
return (
|
||||
<label className={cn('mb-1.5 block text-sm font-medium text-clinic-800', className)} {...rest}>
|
||||
{children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { SelectHTMLAttributes } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
export const Select = forwardRef<HTMLSelectElement, SelectHTMLAttributes<HTMLSelectElement>>(
|
||||
function Select({ className, children, ...rest }, ref) {
|
||||
return (
|
||||
<select
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'h-10 w-full rounded-md border border-clinic-200 bg-white px-3 text-sm',
|
||||
'focus:border-clinic-500 focus:outline-none focus:ring-1 focus:ring-clinic-500',
|
||||
'disabled:bg-clinic-50 disabled:text-clinic-400',
|
||||
className,
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</select>
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -1,21 +0,0 @@
|
||||
import type { TextareaHTMLAttributes } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
|
||||
export const Textarea = forwardRef<
|
||||
HTMLTextAreaElement,
|
||||
TextareaHTMLAttributes<HTMLTextAreaElement>
|
||||
>(function Textarea({ className, ...rest }, ref) {
|
||||
return (
|
||||
<textarea
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'min-h-[88px] w-full rounded-md border border-clinic-200 bg-white p-3 text-sm leading-relaxed',
|
||||
'placeholder:text-clinic-400 focus:border-clinic-500 focus:outline-none focus:ring-1 focus:ring-clinic-500',
|
||||
className,
|
||||
)}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -1,61 +0,0 @@
|
||||
import { motion } from 'motion/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
import { FADE_IN_UP } from '@/lib/motion';
|
||||
import type { SpeciesAnatomy, View } from '@/species/types';
|
||||
|
||||
import { AnatomyView } from './AnatomyView';
|
||||
|
||||
const TABS: { id: View; label: string }[] = [
|
||||
{ id: 'lateral_left', label: 'Latéral gauche' },
|
||||
{ id: 'lateral_right', label: 'Latéral droit' },
|
||||
{ id: 'dorsal', label: 'Vue dorsale' },
|
||||
];
|
||||
|
||||
interface Props {
|
||||
anatomy: SpeciesAnatomy;
|
||||
highlightFinding?: string[];
|
||||
}
|
||||
|
||||
export function AnatomyCanvas({ anatomy, highlightFinding }: Props) {
|
||||
const [view, setView] = useState<View>('lateral_left');
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<div className="flex gap-1 border-b border-clinic-100 px-2">
|
||||
{TABS.map((t) => (
|
||||
<button
|
||||
key={t.id}
|
||||
type="button"
|
||||
onClick={() => setView(t.id)}
|
||||
className={cn(
|
||||
'relative px-3 py-2 text-sm font-medium transition-colors',
|
||||
view === t.id ? 'text-clinic-900' : 'text-clinic-600 hover:text-clinic-800',
|
||||
)}
|
||||
>
|
||||
{t.label}
|
||||
{view === t.id && (
|
||||
<motion.span
|
||||
layoutId="anatomy-tab"
|
||||
className="absolute inset-x-0 bottom-0 h-0.5 bg-clinic-600"
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<motion.div
|
||||
key={view}
|
||||
initial={{ opacity: 0, y: 6 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={FADE_IN_UP}
|
||||
className="p-4"
|
||||
>
|
||||
<AnatomyView
|
||||
src={anatomy.svg[view]}
|
||||
highlightFinding={highlightFinding ?? []}
|
||||
/>
|
||||
</motion.div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
import { cn } from '@/lib/cn';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
|
||||
interface Props {
|
||||
src: string;
|
||||
className?: string;
|
||||
highlightFinding?: string[];
|
||||
}
|
||||
|
||||
// SVG sources come from our own /public/species/ directory — fully static,
|
||||
// same-origin, controlled assets. We parse them with DOMParser (not innerHTML)
|
||||
// then adopt the root SVG node into the live DOM so we can wire click handlers
|
||||
// and style zones via CSS variables.
|
||||
export function AnatomyView({ src, className, highlightFinding = [] }: Props) {
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const selection = useReportStore((s) => s.selection);
|
||||
const toggleZone = useReportStore((s) => s.toggleZone);
|
||||
|
||||
useEffect(() => {
|
||||
const el = containerRef.current;
|
||||
if (!el) return undefined;
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
try {
|
||||
const res = await fetch(src);
|
||||
const text = await res.text();
|
||||
if (cancelled || !el) return;
|
||||
const doc = new DOMParser().parseFromString(text, 'image/svg+xml');
|
||||
const svg = doc.documentElement;
|
||||
// Clear and adopt
|
||||
while (el.firstChild) el.removeChild(el.firstChild);
|
||||
const imported = document.importNode(svg, true);
|
||||
el.appendChild(imported);
|
||||
} catch {
|
||||
if (el) {
|
||||
while (el.firstChild) el.removeChild(el.firstChild);
|
||||
const err = document.createElement('div');
|
||||
err.className = 'p-4 text-warm-500';
|
||||
err.textContent = 'Erreur de chargement du schéma.';
|
||||
el.appendChild(err);
|
||||
}
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [src]);
|
||||
|
||||
useEffect(() => {
|
||||
const el = containerRef.current;
|
||||
if (!el) return undefined;
|
||||
const onClick = (e: Event) => {
|
||||
const target = (e.target as Element).closest('[data-zone]') as HTMLElement | null;
|
||||
if (!target) return;
|
||||
const zoneId = target.dataset['zone'];
|
||||
if (zoneId) toggleZone(zoneId);
|
||||
};
|
||||
el.addEventListener('click', onClick);
|
||||
return () => el.removeEventListener('click', onClick);
|
||||
}, [toggleZone]);
|
||||
|
||||
useEffect(() => {
|
||||
const el = containerRef.current;
|
||||
if (!el) return;
|
||||
const zones = el.querySelectorAll<HTMLElement>('[data-zone]');
|
||||
zones.forEach((z) => {
|
||||
const id = z.dataset['zone'] ?? '';
|
||||
const sel = selection.includes(id);
|
||||
const linked = highlightFinding.includes(id);
|
||||
z.style.cursor = 'pointer';
|
||||
z.style.transition = 'fill 0.15s ease';
|
||||
if (sel) z.style.fill = 'var(--zone-selected)';
|
||||
else if (linked) z.style.fill = 'var(--zone-linked)';
|
||||
else z.style.fill = 'transparent';
|
||||
z.setAttribute('data-selected', sel ? 'true' : 'false');
|
||||
z.setAttribute('data-linked', linked ? 'true' : 'false');
|
||||
});
|
||||
}, [selection, highlightFinding]);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={cn('w-full [&_svg]:h-auto [&_svg]:w-full', className)}
|
||||
aria-label="Schéma anatomique"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Card, CardBody } from '@/components/ui/Card';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
import { Label } from '@/components/ui/Label';
|
||||
import { Textarea } from '@/components/ui/Textarea';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
|
||||
export function ConclusionPanel() {
|
||||
const report = useReportStore((s) => s.report);
|
||||
const setConclusion = useReportStore((s) => s.setConclusion);
|
||||
const setRecommendations = useReportStore((s) => s.setRecommendations);
|
||||
const setNextAppointment = useReportStore((s) => s.setNextAppointment);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardBody className="space-y-4">
|
||||
<h2 className="font-display text-lg text-clinic-900">Conclusion</h2>
|
||||
<div>
|
||||
<Label htmlFor="conclusion">Synthèse</Label>
|
||||
<Textarea
|
||||
id="conclusion"
|
||||
value={report?.conclusion ?? ''}
|
||||
onChange={(e) => setConclusion(e.target.value)}
|
||||
placeholder="Tableau global, hypothèses cliniques…"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="recommendations">Recommandations</Label>
|
||||
<Textarea
|
||||
id="recommendations"
|
||||
value={report?.recommendations ?? ''}
|
||||
onChange={(e) => setRecommendations(e.target.value)}
|
||||
placeholder="Repos, suivi, examens complémentaires…"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="nextAppointment">Prochain rendez-vous (optionnel)</Label>
|
||||
<Input
|
||||
id="nextAppointment"
|
||||
type="date"
|
||||
value={report?.nextAppointment ?? ''}
|
||||
onChange={(e) => setNextAppointment(e.target.value || undefined)}
|
||||
/>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { exportReport, type AnatomyAssets } from '@/pdf/export';
|
||||
import type { Report } from '@/schema/report';
|
||||
|
||||
interface Props {
|
||||
report: Report;
|
||||
assets: AnatomyAssets;
|
||||
}
|
||||
|
||||
export function ExportButton({ report, assets }: Props) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleClick = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const blob = await exportReport(report, assets);
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
const safe = report.animal.name.replace(/[^\p{L}\p{N}_-]+/gu, '_');
|
||||
a.download = `bilan-${safe}-${report.sessionDate}.pdf`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Button size="lg" onClick={handleClick} disabled={loading}>
|
||||
{loading ? 'Génération…' : 'Exporter en PDF'}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -1,229 +0,0 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Dialog } from '@/components/ui/Dialog';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
import { Label } from '@/components/ui/Label';
|
||||
import { Textarea } from '@/components/ui/Textarea';
|
||||
import { FR } from '@/i18n/fr';
|
||||
import { newId } from '@/lib/id';
|
||||
import { cn } from '@/lib/cn';
|
||||
import type { Finding, PathologyRef, Severity } from '@/schema/finding';
|
||||
import type { PathologyEntry } from '@/species/types';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
zones: string[];
|
||||
zoneLabel: (id: string) => string;
|
||||
allZones: { id: string; label: string }[];
|
||||
catalog: PathologyEntry[];
|
||||
initial?: Finding | null;
|
||||
onSubmit: (input: Omit<Finding, 'id'> & { id?: string }) => void;
|
||||
}
|
||||
|
||||
export function FindingEditor({
|
||||
open,
|
||||
onClose,
|
||||
zones,
|
||||
zoneLabel,
|
||||
allZones,
|
||||
catalog,
|
||||
initial,
|
||||
onSubmit,
|
||||
}: Props) {
|
||||
const [severity, setSeverity] = useState<Severity>(initial?.severity ?? 'mild');
|
||||
const [pathologies, setPathologies] = useState<PathologyRef[]>(initial?.pathologies ?? []);
|
||||
const [comment, setComment] = useState(initial?.comment ?? '');
|
||||
const [linkedZones, setLinkedZones] = useState<string[]>(initial?.linkedZones ?? []);
|
||||
const [freeText, setFreeText] = useState('');
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
const zoneSet = new Set([...zones, ...linkedZones]);
|
||||
return catalog.filter((p) => {
|
||||
if (p.applicableZones.length === 0) return true;
|
||||
return p.applicableZones.some((z) => zoneSet.has(z));
|
||||
});
|
||||
}, [catalog, zones, linkedZones]);
|
||||
|
||||
const togglePathology = (entry: PathologyEntry) => {
|
||||
setPathologies((prev) => {
|
||||
const exists = prev.find((p) => p.id === entry.id);
|
||||
if (exists) return prev.filter((p) => p.id !== entry.id);
|
||||
return [...prev, { id: entry.id, label: entry.label, free: false }];
|
||||
});
|
||||
};
|
||||
|
||||
const addFreeText = () => {
|
||||
const label = freeText.trim();
|
||||
if (!label) return;
|
||||
setPathologies((prev) => [...prev, { id: newId('free'), label, free: true }]);
|
||||
setFreeText('');
|
||||
};
|
||||
|
||||
const toggleLinkedZone = (id: string) => {
|
||||
setLinkedZones((prev) => (prev.includes(id) ? prev.filter((z) => z !== id) : [...prev, id]));
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
const payload = {
|
||||
...(initial?.id ? { id: initial.id } : {}),
|
||||
zones,
|
||||
linkedZones,
|
||||
pathologies,
|
||||
severity,
|
||||
comment,
|
||||
};
|
||||
onSubmit(payload);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onClose={onClose} title={initial ? 'Modifier observation' : 'Nouvelle observation'}>
|
||||
<div className="space-y-5">
|
||||
<div>
|
||||
<Label>Zones concernées</Label>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{zones.map((id) => (
|
||||
<Badge key={id} variant="mild">
|
||||
{zoneLabel(id)}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>Sévérité</Label>
|
||||
<div className="flex gap-2">
|
||||
{(['mild', 'moderate', 'severe'] as const).map((s) => (
|
||||
<button
|
||||
key={s}
|
||||
type="button"
|
||||
onClick={() => setSeverity(s)}
|
||||
className={cn(
|
||||
'rounded-md border px-3 py-1.5 text-sm transition-colors',
|
||||
severity === s
|
||||
? s === 'severe'
|
||||
? 'border-warm-500 bg-warm-500 text-white'
|
||||
: s === 'moderate'
|
||||
? 'border-warm-300 bg-warm-300 text-clinic-900'
|
||||
: 'border-clinic-500 bg-clinic-500 text-white'
|
||||
: 'border-clinic-200 bg-white text-clinic-700 hover:bg-clinic-50',
|
||||
)}
|
||||
>
|
||||
{FR.severity[s]}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>Pathologies</Label>
|
||||
<div className="grid max-h-44 grid-cols-1 gap-1 overflow-auto rounded-md border border-clinic-100 p-2 md:grid-cols-2">
|
||||
{filtered.length === 0 && (
|
||||
<p className="col-span-full p-2 text-sm text-clinic-500">
|
||||
Aucune pathologie référencée pour cette sélection.
|
||||
</p>
|
||||
)}
|
||||
{filtered.map((p) => {
|
||||
const checked = pathologies.some((x) => x.id === p.id);
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- label nests input + content; the rule misses cases where text is in a nested span.
|
||||
<label
|
||||
key={p.id}
|
||||
className={cn(
|
||||
'flex cursor-pointer items-start gap-2 rounded-md p-2 text-sm transition-colors',
|
||||
checked ? 'bg-clinic-100' : 'hover:bg-clinic-50',
|
||||
)}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
className="mt-0.5"
|
||||
checked={checked}
|
||||
aria-label={p.label}
|
||||
onChange={() => togglePathology(p)}
|
||||
/>
|
||||
<span>
|
||||
<span className="font-medium text-clinic-900">{p.label}</span>
|
||||
<span className="block text-xs text-clinic-600">{p.description}</span>
|
||||
</span>
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="mt-2 flex gap-2">
|
||||
<Input
|
||||
value={freeText}
|
||||
onChange={(e) => setFreeText(e.target.value)}
|
||||
placeholder="Ajouter une pathologie en texte libre"
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
addFreeText();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button size="md" variant="secondary" onClick={addFreeText}>
|
||||
Ajouter
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{pathologies.length > 0 && (
|
||||
<div className="mt-2 flex flex-wrap gap-1.5">
|
||||
{pathologies.map((p) => (
|
||||
<Badge key={p.id} variant={p.free ? 'soft' : 'neutral'}>
|
||||
{p.label}{' '}
|
||||
<button
|
||||
type="button"
|
||||
className="ml-1 text-clinic-700"
|
||||
onClick={() =>
|
||||
setPathologies((prev) => prev.filter((x) => x.id !== p.id))
|
||||
}
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>Zones liées (mêmes problématiques)</Label>
|
||||
<div className="max-h-32 overflow-auto rounded-md border border-clinic-100 p-2">
|
||||
{allZones
|
||||
.filter((z) => !zones.includes(z.id))
|
||||
.map((z) => (
|
||||
<label key={z.id} className="flex cursor-pointer items-center gap-2 py-1 text-sm">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={linkedZones.includes(z.id)}
|
||||
onChange={() => toggleLinkedZone(z.id)}
|
||||
/>
|
||||
<span>{z.label}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="comment">Commentaire</Label>
|
||||
<Textarea
|
||||
id="comment"
|
||||
value={comment}
|
||||
onChange={(e) => setComment(e.target.value)}
|
||||
placeholder="Détaillez l’observation clinique…"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="ghost" onClick={onClose}>
|
||||
Annuler
|
||||
</Button>
|
||||
<Button onClick={handleSubmit}>{initial ? 'Mettre à jour' : 'Enregistrer'}</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
import { AnimatePresence, motion } from 'motion/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Card, CardBody } from '@/components/ui/Card';
|
||||
import { FR } from '@/i18n/fr';
|
||||
import type { Finding, Severity } from '@/schema/finding';
|
||||
import type { PathologyEntry, SpeciesAnatomy } from '@/species/types';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
|
||||
import { FindingEditor } from './FindingEditor';
|
||||
|
||||
interface Props {
|
||||
anatomy: SpeciesAnatomy;
|
||||
catalog: PathologyEntry[];
|
||||
onPreviewFinding: (id: string | null) => void;
|
||||
}
|
||||
|
||||
const severityVariant: Record<Severity, 'mild' | 'moderate' | 'severe'> = {
|
||||
mild: 'mild',
|
||||
moderate: 'moderate',
|
||||
severe: 'severe',
|
||||
};
|
||||
|
||||
export function FindingPanel({ anatomy, catalog, onPreviewFinding }: Props) {
|
||||
const report = useReportStore((s) => s.report);
|
||||
const selection = useReportStore((s) => s.selection);
|
||||
const addFinding = useReportStore((s) => s.addFinding);
|
||||
const updateFinding = useReportStore((s) => s.updateFinding);
|
||||
const removeFinding = useReportStore((s) => s.removeFinding);
|
||||
|
||||
const [editorOpen, setEditorOpen] = useState(false);
|
||||
const [editing, setEditing] = useState<Finding | null>(null);
|
||||
|
||||
const zoneLabel = (id: string) => anatomy.zones.find((z) => z.id === id)?.label ?? id;
|
||||
const allZones = anatomy.zones.map((z) => ({ id: z.id, label: z.label }));
|
||||
|
||||
const openNew = () => {
|
||||
if (selection.length === 0) return;
|
||||
setEditing(null);
|
||||
setEditorOpen(true);
|
||||
};
|
||||
const openEdit = (f: Finding) => {
|
||||
setEditing(f);
|
||||
setEditorOpen(true);
|
||||
};
|
||||
const handleSubmit = (payload: Omit<Finding, 'id'> & { id?: string }) => {
|
||||
if (payload.id) {
|
||||
const { id, ...rest } = payload;
|
||||
updateFinding(id, rest);
|
||||
} else {
|
||||
addFinding(payload);
|
||||
}
|
||||
setEditorOpen(false);
|
||||
onPreviewFinding(null);
|
||||
};
|
||||
|
||||
const editorZones = editing ? editing.zones : selection;
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="font-display text-lg text-clinic-900">Observations</h2>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={openNew}
|
||||
disabled={selection.length === 0}
|
||||
title={selection.length === 0 ? 'Sélectionnez au moins une zone' : 'Créer'}
|
||||
>
|
||||
+ Nouvelle
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<AnimatePresence initial={false}>
|
||||
{(report?.findings ?? []).map((f) => (
|
||||
<motion.div
|
||||
key={f.id}
|
||||
layout
|
||||
initial={{ opacity: 0, y: 6 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, x: -8 }}
|
||||
onMouseEnter={() => onPreviewFinding(f.id)}
|
||||
onMouseLeave={() => onPreviewFinding(null)}
|
||||
>
|
||||
<Card>
|
||||
<CardBody className="space-y-2 p-4">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{f.zones.map((z) => (
|
||||
<Badge key={z} variant="neutral">
|
||||
{zoneLabel(z)}
|
||||
</Badge>
|
||||
))}
|
||||
{f.linkedZones.map((z) => (
|
||||
<Badge key={`l-${z}`} variant="soft">
|
||||
↳ {zoneLabel(z)}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
<Badge variant={severityVariant[f.severity]}>{FR.severity[f.severity]}</Badge>
|
||||
</div>
|
||||
{f.pathologies.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{f.pathologies.map((p) => (
|
||||
<span key={p.id} className="text-sm text-clinic-700">
|
||||
• {p.label}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{f.comment && <p className="text-sm text-clinic-700">{f.comment}</p>}
|
||||
<div className="flex justify-end gap-2 pt-1">
|
||||
<Button size="sm" variant="ghost" onClick={() => openEdit(f)}>
|
||||
Modifier
|
||||
</Button>
|
||||
<Button size="sm" variant="danger" onClick={() => removeFinding(f.id)}>
|
||||
Supprimer
|
||||
</Button>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</motion.div>
|
||||
))}
|
||||
</AnimatePresence>
|
||||
|
||||
{(report?.findings ?? []).length === 0 && (
|
||||
<p className="text-sm text-clinic-500">
|
||||
Aucune observation. Cliquez sur des zones puis validez pour en créer.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<FindingEditor
|
||||
open={editorOpen}
|
||||
onClose={() => setEditorOpen(false)}
|
||||
zones={editorZones}
|
||||
zoneLabel={zoneLabel}
|
||||
allZones={allZones}
|
||||
catalog={catalog}
|
||||
initial={editing}
|
||||
onSubmit={handleSubmit}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
import { AnimatePresence, motion } from 'motion/react';
|
||||
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
|
||||
interface Props {
|
||||
zoneLabel: (id: string) => string;
|
||||
onValidate: () => void;
|
||||
}
|
||||
|
||||
export function ZoneSelection({ zoneLabel, onValidate }: Props) {
|
||||
const selection = useReportStore((s) => s.selection);
|
||||
const toggleZone = useReportStore((s) => s.toggleZone);
|
||||
const clearSelection = useReportStore((s) => s.clearSelection);
|
||||
|
||||
if (selection.length === 0) {
|
||||
return (
|
||||
<p className="text-sm text-clinic-600">
|
||||
Cliquez sur les zones du schéma pour créer une observation.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<AnimatePresence initial={false}>
|
||||
{selection.map((id) => (
|
||||
<motion.span
|
||||
key={id}
|
||||
layout
|
||||
initial={{ scale: 0.92, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
exit={{ scale: 0.9, opacity: 0 }}
|
||||
transition={{ type: 'spring', stiffness: 320, damping: 26 }}
|
||||
>
|
||||
<Badge variant="mild" className="cursor-pointer" onClick={() => toggleZone(id)}>
|
||||
{zoneLabel(id)} ×
|
||||
</Badge>
|
||||
</motion.span>
|
||||
))}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button size="sm" onClick={onValidate}>
|
||||
Créer une observation
|
||||
</Button>
|
||||
<Button size="sm" variant="ghost" onClick={clearSelection}>
|
||||
Réinitialiser
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export function ZoomOverlay() {
|
||||
return null;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
// Rasterizes an SVG URL into a PNG Uint8Array using <canvas>. Used for PDF
|
||||
// export — pdf-lib has no native SVG support so we embed PNG snapshots.
|
||||
// Highlights selected/linked zones inline by injecting fill attributes
|
||||
// before rasterization.
|
||||
|
||||
export interface RasterOptions {
|
||||
width?: number;
|
||||
selectedZones?: string[];
|
||||
linkedZones?: string[];
|
||||
}
|
||||
|
||||
export async function rasterizeSvg(src: string, opts: RasterOptions = {}): Promise<Uint8Array> {
|
||||
const res = await fetch(src);
|
||||
const text = await res.text();
|
||||
const doc = new DOMParser().parseFromString(text, 'image/svg+xml');
|
||||
const svg = doc.documentElement;
|
||||
|
||||
// Inline fill colors on zone paths so the rasterized image reflects state
|
||||
const selected = new Set(opts.selectedZones ?? []);
|
||||
const linked = new Set(opts.linkedZones ?? []);
|
||||
svg.querySelectorAll<SVGElement>('[data-zone]').forEach((z) => {
|
||||
const id = z.getAttribute('data-zone') ?? '';
|
||||
if (selected.has(id)) z.setAttribute('fill', 'rgba(74,124,89,0.45)');
|
||||
else if (linked.has(id)) z.setAttribute('fill', 'rgba(184,133,74,0.45)');
|
||||
else z.setAttribute('fill', 'transparent');
|
||||
z.setAttribute('stroke', 'rgba(45,74,53,0.6)');
|
||||
z.setAttribute('stroke-width', '1');
|
||||
});
|
||||
|
||||
const serialized = new XMLSerializer().serializeToString(svg);
|
||||
const svgBlob = new Blob([serialized], { type: 'image/svg+xml;charset=utf-8' });
|
||||
const url = URL.createObjectURL(svgBlob);
|
||||
|
||||
try {
|
||||
const img = new Image();
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
img.onload = () => resolve();
|
||||
img.onerror = () => reject(new Error('SVG load failed'));
|
||||
img.src = url;
|
||||
});
|
||||
const ratio = window.devicePixelRatio || 1;
|
||||
const targetW = opts.width ?? 1200;
|
||||
const targetH = (targetW * img.height) / img.width;
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = targetW * ratio;
|
||||
canvas.height = targetH * ratio;
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) throw new Error('No 2D context');
|
||||
ctx.scale(ratio, ratio);
|
||||
ctx.drawImage(img, 0, 0, targetW, targetH);
|
||||
const pngBlob = await new Promise<Blob | null>((resolve) =>
|
||||
canvas.toBlob(resolve, 'image/png'),
|
||||
);
|
||||
if (!pngBlob) throw new Error('Canvas toBlob returned null');
|
||||
return new Uint8Array(await pngBlob.arrayBuffer());
|
||||
} finally {
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,32 +0,0 @@
|
||||
export const FR = {
|
||||
app: {
|
||||
name: 'Osteo Report',
|
||||
tagline: 'Bilans ostéopathiques vétérinaires',
|
||||
},
|
||||
home: {
|
||||
new: 'Nouveau bilan',
|
||||
import: 'Importer un PDF existant',
|
||||
importHint: 'Glissez un PDF généré par cette application',
|
||||
},
|
||||
species: {
|
||||
chien: 'Chien',
|
||||
chat: 'Chat',
|
||||
equine: 'Cheval',
|
||||
lapin: 'Lapin',
|
||||
bovin: 'Bovin',
|
||||
chevre: 'Chèvre',
|
||||
ane: 'Âne',
|
||||
mouton: 'Mouton',
|
||||
porc: 'Porc',
|
||||
} as Record<string, string>,
|
||||
severity: {
|
||||
mild: 'Légère',
|
||||
moderate: 'Modérée',
|
||||
severe: 'Sévère',
|
||||
} as Record<string, string>,
|
||||
errors: {
|
||||
importNotFromApp:
|
||||
"Ce PDF n'a pas été généré par cette application. L'import est impossible.",
|
||||
importInvalid: "Le contenu du PDF n'a pas pu être lu.",
|
||||
},
|
||||
} as const;
|
||||
@@ -1,6 +0,0 @@
|
||||
import { clsx, type ClassValue } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]): string {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
import { format, parseISO } from 'date-fns';
|
||||
import { fr } from 'date-fns/locale';
|
||||
|
||||
export function formatDateFr(iso: string): string {
|
||||
return format(parseISO(iso), 'd MMMM yyyy', { locale: fr });
|
||||
}
|
||||
|
||||
export function todayIso(): string {
|
||||
return new Date().toISOString().slice(0, 10);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
export function newId(prefix?: string): string {
|
||||
return prefix ? `${prefix}_${nanoid(10)}` : nanoid(12);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import type { Transition } from 'motion/react';
|
||||
|
||||
export const SPRING: Transition = {
|
||||
type: 'spring',
|
||||
stiffness: 260,
|
||||
damping: 22,
|
||||
};
|
||||
|
||||
export const FADE_IN_UP: Transition = {
|
||||
duration: 0.2,
|
||||
ease: [0.22, 1, 0.36, 1],
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
import { StrictMode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
|
||||
import { App } from './App';
|
||||
import './species'; // register species packs
|
||||
|
||||
import './styles/globals.css';
|
||||
|
||||
const container = document.getElementById('root');
|
||||
if (!container) throw new Error('Root container #root not found');
|
||||
|
||||
createRoot(container).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
);
|
||||
@@ -1,250 +0,0 @@
|
||||
import { PDFDocument, StandardFonts, rgb } from 'pdf-lib';
|
||||
|
||||
import { FR } from '../i18n/fr';
|
||||
import { formatDateFr } from '../lib/date';
|
||||
import type { Report } from '../schema/report';
|
||||
import type { SpeciesAnatomy } from '../species/types';
|
||||
|
||||
import { PDF_ATTACHMENT_NAME } from './version';
|
||||
|
||||
const A4 = { width: 595.28, height: 841.89 } as const;
|
||||
const MARGIN = 48;
|
||||
const FOOT = 32;
|
||||
|
||||
export interface AnatomyAssets {
|
||||
anatomy: SpeciesAnatomy;
|
||||
rasters: Partial<Record<'lateral_left' | 'lateral_right' | 'dorsal', Uint8Array | ArrayBuffer>>;
|
||||
}
|
||||
|
||||
function zoneLabel(anatomy: SpeciesAnatomy, id: string): string {
|
||||
return anatomy.zones.find((z) => z.id === id)?.label ?? id;
|
||||
}
|
||||
|
||||
export async function exportReportBytes(report: Report, assets: AnatomyAssets): Promise<Uint8Array> {
|
||||
const pdf = await PDFDocument.create();
|
||||
pdf.setTitle(`Bilan ostéopathique — ${report.animal.name}`);
|
||||
pdf.setAuthor(report.practitioner.fullName);
|
||||
pdf.setSubject(FR.app.tagline);
|
||||
pdf.setCreator(FR.app.name);
|
||||
pdf.setProducer('pdf-lib');
|
||||
pdf.setCreationDate(new Date(report.createdAt));
|
||||
|
||||
const font = await pdf.embedFont(StandardFonts.Helvetica);
|
||||
const fontBold = await pdf.embedFont(StandardFonts.HelveticaBold);
|
||||
|
||||
let page = pdf.addPage([A4.width, A4.height]);
|
||||
let y = A4.height - MARGIN;
|
||||
|
||||
// ───────── Header
|
||||
page.drawText(FR.app.name, {
|
||||
x: MARGIN,
|
||||
y,
|
||||
size: 18,
|
||||
font: fontBold,
|
||||
color: rgb(0.29, 0.49, 0.35),
|
||||
});
|
||||
page.drawText(FR.app.tagline, { x: MARGIN, y: y - 16, size: 9, font, color: rgb(0.4, 0.4, 0.4) });
|
||||
y -= 36;
|
||||
|
||||
page.drawText(`Animal : ${report.animal.name}`, { x: MARGIN, y, size: 11, font: fontBold });
|
||||
page.drawText(`Propriétaire : ${report.animal.owner}`, { x: MARGIN, y: y - 14, size: 11, font });
|
||||
page.drawText(`Séance : ${formatDateFr(report.sessionDate)}`, { x: MARGIN, y: y - 28, size: 11, font });
|
||||
|
||||
const practX = A4.width / 2 + 20;
|
||||
page.drawText(report.practitioner.fullName, { x: practX, y, size: 11, font: fontBold });
|
||||
let practY = y - 14;
|
||||
for (const line of [
|
||||
report.practitioner.title,
|
||||
report.practitioner.phone,
|
||||
report.practitioner.email,
|
||||
report.practitioner.address,
|
||||
report.practitioner.siret ? `SIRET ${report.practitioner.siret}` : undefined,
|
||||
]) {
|
||||
if (!line) continue;
|
||||
page.drawText(line, { x: practX, y: practY, size: 10, font });
|
||||
practY -= 12;
|
||||
}
|
||||
y = Math.min(y - 60, practY - 24);
|
||||
page.drawLine({
|
||||
start: { x: MARGIN, y },
|
||||
end: { x: A4.width - MARGIN, y },
|
||||
thickness: 0.6,
|
||||
color: rgb(0.29, 0.49, 0.35),
|
||||
});
|
||||
y -= 20;
|
||||
|
||||
// ───────── Anatomy pages (one per view with selected zones)
|
||||
const viewLabels: Record<keyof AnatomyAssets['rasters'], string> = {
|
||||
lateral_left: 'Vue latérale gauche',
|
||||
lateral_right: 'Vue latérale droite',
|
||||
dorsal: 'Vue dorsale',
|
||||
};
|
||||
const viewsInUse = new Set<keyof AnatomyAssets['rasters']>();
|
||||
for (const f of report.findings) {
|
||||
for (const zId of [...f.zones, ...f.linkedZones]) {
|
||||
const z = assets.anatomy.zones.find((zz) => zz.id === zId);
|
||||
if (!z) continue;
|
||||
for (const v of z.views) viewsInUse.add(v);
|
||||
}
|
||||
}
|
||||
|
||||
for (const view of viewsInUse) {
|
||||
const raster = assets.rasters[view];
|
||||
if (!raster) continue;
|
||||
page = pdf.addPage([A4.width, A4.height]);
|
||||
page.drawText(viewLabels[view], {
|
||||
x: MARGIN,
|
||||
y: A4.height - MARGIN,
|
||||
size: 14,
|
||||
font: fontBold,
|
||||
});
|
||||
const png = await pdf.embedPng(raster);
|
||||
const maxW = A4.width - MARGIN * 2;
|
||||
const maxH = A4.height - MARGIN * 2 - 50;
|
||||
const ratio = Math.min(maxW / png.width, maxH / png.height);
|
||||
const w = png.width * ratio;
|
||||
const h = png.height * ratio;
|
||||
page.drawImage(png, { x: MARGIN, y: A4.height - MARGIN - 30 - h, width: w, height: h });
|
||||
}
|
||||
|
||||
// ───────── Findings table
|
||||
page = pdf.addPage([A4.width, A4.height]);
|
||||
y = A4.height - MARGIN;
|
||||
page.drawText('Observations cliniques', { x: MARGIN, y, size: 14, font: fontBold });
|
||||
y -= 22;
|
||||
|
||||
if (report.findings.length === 0) {
|
||||
page.drawText('Aucune observation enregistrée.', { x: MARGIN, y, size: 10, font });
|
||||
}
|
||||
|
||||
for (let i = 0; i < report.findings.length; i++) {
|
||||
const f = report.findings[i];
|
||||
if (!f) continue;
|
||||
if (y < MARGIN + 120) {
|
||||
page = pdf.addPage([A4.width, A4.height]);
|
||||
y = A4.height - MARGIN;
|
||||
}
|
||||
const zones = f.zones.map((id) => zoneLabel(assets.anatomy, id)).join(', ');
|
||||
const linked = f.linkedZones.length
|
||||
? ` (liées : ${f.linkedZones.map((id) => zoneLabel(assets.anatomy, id)).join(', ')})`
|
||||
: '';
|
||||
const pathos = f.pathologies.map((p) => p.label).join(', ') || '—';
|
||||
const sev = FR.severity[f.severity] ?? f.severity;
|
||||
|
||||
page.drawText(`#${(i + 1).toString()} ${zones}${linked}`, {
|
||||
x: MARGIN,
|
||||
y,
|
||||
size: 11,
|
||||
font: fontBold,
|
||||
});
|
||||
page.drawText(`Pathologies : ${pathos}`, { x: MARGIN, y: y - 14, size: 10, font });
|
||||
page.drawText(`Sévérité : ${sev}`, { x: MARGIN, y: y - 28, size: 10, font });
|
||||
if (f.comment) {
|
||||
const wrapped = wrap(f.comment, 90);
|
||||
let yy = y - 44;
|
||||
page.drawText('Commentaire :', { x: MARGIN, y: yy, size: 10, font: fontBold });
|
||||
yy -= 14;
|
||||
for (const line of wrapped) {
|
||||
page.drawText(line, { x: MARGIN + 8, y: yy, size: 10, font });
|
||||
yy -= 12;
|
||||
}
|
||||
y = yy - 8;
|
||||
} else {
|
||||
y -= 50;
|
||||
}
|
||||
}
|
||||
|
||||
// ───────── Conclusion + recommandations + RDV
|
||||
if (report.conclusion || report.recommendations || report.nextAppointment) {
|
||||
page = pdf.addPage([A4.width, A4.height]);
|
||||
y = A4.height - MARGIN;
|
||||
if (report.conclusion) {
|
||||
page.drawText('Conclusion', { x: MARGIN, y, size: 14, font: fontBold });
|
||||
y -= 20;
|
||||
for (const line of wrap(report.conclusion, 90)) {
|
||||
page.drawText(line, { x: MARGIN, y, size: 11, font });
|
||||
y -= 14;
|
||||
}
|
||||
y -= 12;
|
||||
}
|
||||
if (report.recommendations) {
|
||||
page.drawText('Recommandations', { x: MARGIN, y, size: 14, font: fontBold });
|
||||
y -= 20;
|
||||
for (const line of wrap(report.recommendations, 90)) {
|
||||
page.drawText(line, { x: MARGIN, y, size: 11, font });
|
||||
y -= 14;
|
||||
}
|
||||
y -= 12;
|
||||
}
|
||||
if (report.nextAppointment) {
|
||||
page.drawText(`Prochain rendez-vous : ${formatDateFr(report.nextAppointment)}`, {
|
||||
x: MARGIN,
|
||||
y,
|
||||
size: 12,
|
||||
font: fontBold,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ───────── Footer on each page
|
||||
const pages = pdf.getPages();
|
||||
const exported = new Date().toISOString().slice(0, 10);
|
||||
for (let i = 0; i < pages.length; i++) {
|
||||
const p = pages[i];
|
||||
if (!p) continue;
|
||||
p.drawText(`${FR.app.name} · exporté le ${formatDateFr(exported)} · page ${(i + 1).toString()}/${pages.length.toString()}`, {
|
||||
x: MARGIN,
|
||||
y: FOOT,
|
||||
size: 8,
|
||||
font,
|
||||
color: rgb(0.45, 0.45, 0.45),
|
||||
});
|
||||
}
|
||||
|
||||
// ───────── Attach report.json
|
||||
// pdf-lib's `attach` treats a raw string as base64-data-URI input (not as
|
||||
// UTF-8 text), and rejects cross-realm Uint8Array/ArrayBuffer in tests.
|
||||
// Wrap the JSON in a base64 data-URI string so it's portable everywhere.
|
||||
const json = JSON.stringify(report);
|
||||
const jsonBytes = new TextEncoder().encode(json);
|
||||
let base64 = '';
|
||||
const chunk = 8192;
|
||||
for (let i = 0; i < jsonBytes.length; i += chunk) {
|
||||
base64 += String.fromCharCode(
|
||||
...jsonBytes.subarray(i, Math.min(i + chunk, jsonBytes.length)),
|
||||
);
|
||||
}
|
||||
const dataUri = `data:application/json;base64,${btoa(base64)}`;
|
||||
await pdf.attach(dataUri, PDF_ATTACHMENT_NAME, {
|
||||
mimeType: 'application/json',
|
||||
description: 'Données sources du bilan (réimport possible).',
|
||||
creationDate: new Date(report.createdAt),
|
||||
modificationDate: new Date(),
|
||||
});
|
||||
|
||||
return pdf.save();
|
||||
}
|
||||
|
||||
export async function exportReport(report: Report, assets: AnatomyAssets): Promise<Blob> {
|
||||
const bytes = await exportReportBytes(report, assets);
|
||||
// BlobPart requires ArrayBuffer (not ArrayBufferLike). Copy into a fresh buffer.
|
||||
const ab = new ArrayBuffer(bytes.byteLength);
|
||||
new Uint8Array(ab).set(bytes);
|
||||
return new Blob([ab], { type: 'application/pdf' });
|
||||
}
|
||||
|
||||
function wrap(text: string, max: number): string[] {
|
||||
const words = text.split(/\s+/);
|
||||
const lines: string[] = [];
|
||||
let buf = '';
|
||||
for (const w of words) {
|
||||
if ((buf + ' ' + w).trim().length > max) {
|
||||
lines.push(buf);
|
||||
buf = w;
|
||||
} else {
|
||||
buf = (buf + ' ' + w).trim();
|
||||
}
|
||||
}
|
||||
if (buf) lines.push(buf);
|
||||
return lines;
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
import * as pako from 'pako';
|
||||
import { PDFDocument, PDFName, type PDFRawStream } from 'pdf-lib';
|
||||
|
||||
import { ReportSchema } from '../schema/report';
|
||||
import type { Report } from '../schema/report';
|
||||
|
||||
import { PDF_ATTACHMENT_NAME } from './version';
|
||||
|
||||
export type ImportFailure =
|
||||
| { ok: false; reason: 'NO_ATTACHMENT' }
|
||||
| { ok: false; reason: 'INVALID_JSON'; details?: string }
|
||||
| { ok: false; reason: 'SCHEMA_MISMATCH'; details?: string }
|
||||
| { ok: false; reason: 'UNREADABLE_PDF'; details?: string };
|
||||
|
||||
export type ImportResult = { ok: true; report: Report } | ImportFailure;
|
||||
|
||||
export async function importReport(file: File | Blob | ArrayBuffer | Uint8Array): Promise<ImportResult> {
|
||||
let pdf: PDFDocument;
|
||||
try {
|
||||
const buf = await toBytes(file);
|
||||
pdf = await PDFDocument.load(buf, { ignoreEncryption: true });
|
||||
} catch (e) {
|
||||
return { ok: false, reason: 'UNREADABLE_PDF', details: (e as Error).message };
|
||||
}
|
||||
|
||||
const json = extractAttachment(pdf, PDF_ATTACHMENT_NAME);
|
||||
if (!json) return { ok: false, reason: 'NO_ATTACHMENT' };
|
||||
|
||||
let parsed: unknown;
|
||||
try {
|
||||
const decoded = new TextDecoder().decode(json);
|
||||
parsed = JSON.parse(decoded);
|
||||
} catch (e) {
|
||||
return {
|
||||
ok: false,
|
||||
reason: 'INVALID_JSON',
|
||||
details: `${(e as Error).message} | first 80 bytes: ${Array.from(json.slice(0, 80))
|
||||
.map((b) => b.toString(16).padStart(2, '0'))
|
||||
.join(' ')}`,
|
||||
};
|
||||
}
|
||||
|
||||
const result = ReportSchema.safeParse(parsed);
|
||||
if (!result.success) {
|
||||
return { ok: false, reason: 'SCHEMA_MISMATCH', details: result.error.message };
|
||||
}
|
||||
return { ok: true, report: result.data };
|
||||
}
|
||||
|
||||
async function toBytes(input: File | Blob | ArrayBuffer | Uint8Array): Promise<Uint8Array> {
|
||||
if (input instanceof Uint8Array) return input;
|
||||
if (input instanceof ArrayBuffer) return new Uint8Array(input);
|
||||
return new Uint8Array(await input.arrayBuffer());
|
||||
}
|
||||
|
||||
function extractAttachment(pdf: PDFDocument, name: string): Uint8Array | null {
|
||||
// Walk catalog → Names → EmbeddedFiles → Names array → filespec → EF → F
|
||||
// pdf-lib has no public attachment-extract API, so we navigate the tree.
|
||||
const catalog = pdf.catalog;
|
||||
const names = catalog.lookup(PDFName.of('Names')) as
|
||||
| { lookup?: (n: PDFName) => unknown }
|
||||
| undefined;
|
||||
if (!names?.lookup) return null;
|
||||
const embeddedFiles = names.lookup(PDFName.of('EmbeddedFiles')) as
|
||||
| { lookup?: (n: PDFName) => unknown }
|
||||
| undefined;
|
||||
if (!embeddedFiles?.lookup) return null;
|
||||
const namesArr = embeddedFiles.lookup(PDFName.of('Names')) as
|
||||
| { size?: () => number; lookup?: (i: number) => unknown }
|
||||
| undefined;
|
||||
if (!namesArr?.lookup || typeof namesArr.size !== 'function') return null;
|
||||
const size = namesArr.size();
|
||||
for (let i = 0; i < size; i += 2) {
|
||||
const k = namesArr.lookup(i) as { decodeText?: () => string } | undefined;
|
||||
const fname = k?.decodeText?.();
|
||||
if (fname !== name) continue;
|
||||
const fileSpec = namesArr.lookup(i + 1) as
|
||||
| { lookup?: (n: PDFName) => unknown }
|
||||
| undefined;
|
||||
if (!fileSpec?.lookup) continue;
|
||||
const ef = fileSpec.lookup(PDFName.of('EF')) as
|
||||
| { lookup?: (n: PDFName) => unknown }
|
||||
| undefined;
|
||||
if (!ef?.lookup) continue;
|
||||
const stream = (ef.lookup(PDFName.of('F')) ?? ef.lookup(PDFName.of('UF'))) as
|
||||
| { dict?: unknown; contents?: Uint8Array }
|
||||
| undefined;
|
||||
if (!stream) continue;
|
||||
// Duck-type instead of `instanceof PDFRawStream` (instanceof fails when
|
||||
// multiple pdf-lib realms coexist, e.g. during tests).
|
||||
if (stream.dict !== undefined && stream.contents !== undefined) {
|
||||
const s = stream as PDFRawStream;
|
||||
const filter = (s.dict as { lookup?: (n: PDFName) => unknown }).lookup?.(
|
||||
PDFName.of('Filter'),
|
||||
);
|
||||
const filterName = (filter as { encodedName?: string } | undefined)?.encodedName;
|
||||
// We bypass pdf-lib's `decodePDFRawStream` because its reference-equality
|
||||
// check on `PDFName.of('FlateDecode')` is unreliable across module realms
|
||||
// (e.g. when vitest dual-loads pdf-lib). Use pako directly on raw bytes.
|
||||
if (filterName === '/FlateDecode') {
|
||||
return pako.inflate(s.contents);
|
||||
}
|
||||
if (filterName === undefined || filter === null) {
|
||||
return s.contents;
|
||||
}
|
||||
// Other filters (ASCII85, LZW, etc.) not expected for embedded files we wrote.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export {};
|
||||
@@ -1 +0,0 @@
|
||||
export {};
|
||||
@@ -1 +0,0 @@
|
||||
export {};
|
||||
@@ -1 +0,0 @@
|
||||
export {};
|
||||
@@ -1,2 +0,0 @@
|
||||
export const PDF_SCHEMA_VERSION = 1 as const;
|
||||
export const PDF_ATTACHMENT_NAME = 'report.json' as const;
|
||||
@@ -1,179 +0,0 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Shell } from '@/components/Shell';
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Card, CardBody } from '@/components/ui/Card';
|
||||
import { AnatomyCanvas } from '@/editor/AnatomyCanvas';
|
||||
import { ConclusionPanel } from '@/editor/ConclusionPanel';
|
||||
import { ExportButton } from '@/editor/ExportButton';
|
||||
import { FindingPanel } from '@/editor/FindingPanel';
|
||||
import { rasterizeSvg } from '@/editor/rasterize';
|
||||
import { ZoneSelection } from '@/editor/ZoneSelection';
|
||||
import { FR } from '@/i18n/fr';
|
||||
import { formatDateFr } from '@/lib/date';
|
||||
import type { AnatomyAssets } from '@/pdf/export';
|
||||
import { getSpecies } from '@/species';
|
||||
import type { View } from '@/species/types';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
import { zonesInUse } from '@/state/selectors';
|
||||
|
||||
export function EditorRoute() {
|
||||
const navigate = useNavigate();
|
||||
const report = useReportStore((s) => s.report);
|
||||
const selection = useReportStore((s) => s.selection);
|
||||
const addFinding = useReportStore((s) => s.addFinding);
|
||||
const reset = useReportStore((s) => s.reset);
|
||||
|
||||
const [previewFinding, setPreviewFinding] = useState<string | null>(null);
|
||||
const [assets, setAssets] = useState<AnatomyAssets | null>(null);
|
||||
const [rasterizing, setRasterizing] = useState(false);
|
||||
|
||||
// Redirect to /new if no report in store
|
||||
useEffect(() => {
|
||||
if (!report) navigate('/');
|
||||
}, [report, navigate]);
|
||||
|
||||
if (!report) return null;
|
||||
const pack = getSpecies(report.species);
|
||||
if (!pack) {
|
||||
return (
|
||||
<Shell>
|
||||
<div className="mx-auto max-w-2xl px-6 py-16 text-center">
|
||||
<p className="text-clinic-700">Cette espèce n’est pas encore disponible.</p>
|
||||
<Button className="mt-4" onClick={() => navigate('/')}>
|
||||
Retour
|
||||
</Button>
|
||||
</div>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
|
||||
const zoneLabel = (id: string) => pack.anatomy.zones.find((z) => z.id === id)?.label ?? id;
|
||||
|
||||
const highlight = previewFinding
|
||||
? (report.findings.find((f) => f.id === previewFinding)?.zones ?? []).concat(
|
||||
report.findings.find((f) => f.id === previewFinding)?.linkedZones ?? [],
|
||||
)
|
||||
: zonesInUse(report);
|
||||
|
||||
const handleValidateSelection = () => {
|
||||
if (selection.length === 0) return;
|
||||
addFinding({
|
||||
zones: [...selection],
|
||||
linkedZones: [],
|
||||
pathologies: [],
|
||||
severity: 'mild',
|
||||
comment: '',
|
||||
});
|
||||
};
|
||||
|
||||
const prepareAssets = async (): Promise<AnatomyAssets> => {
|
||||
setRasterizing(true);
|
||||
try {
|
||||
const usedZones = new Set(zonesInUse(report));
|
||||
const viewsInUse = new Set<View>();
|
||||
for (const z of pack.anatomy.zones) {
|
||||
if (usedZones.has(z.id)) z.views.forEach((v) => viewsInUse.add(v));
|
||||
}
|
||||
const rasters: AnatomyAssets['rasters'] = {};
|
||||
for (const v of viewsInUse) {
|
||||
const src = pack.anatomy.svg[v];
|
||||
const selectedZones = pack.anatomy.zones
|
||||
.filter((zz) => zz.views.includes(v) && usedZones.has(zz.id))
|
||||
.map((zz) => zz.id);
|
||||
rasters[v] = await rasterizeSvg(src, { selectedZones, width: 1400 });
|
||||
}
|
||||
const next: AnatomyAssets = { anatomy: pack.anatomy, rasters };
|
||||
setAssets(next);
|
||||
return next;
|
||||
} finally {
|
||||
setRasterizing(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Shell>
|
||||
<div className="mx-auto max-w-7xl px-6 py-6">
|
||||
<div className="mb-4 flex flex-wrap items-end justify-between gap-3">
|
||||
<div>
|
||||
<h1 className="font-display text-2xl text-clinic-900">
|
||||
{report.animal.name}
|
||||
<span className="ml-2 text-base text-clinic-600">— {report.animal.owner}</span>
|
||||
</h1>
|
||||
<p className="text-sm text-clinic-600">
|
||||
{FR.species[report.species]} · Séance du {formatDateFr(report.sessionDate)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="ghost" onClick={() => { reset(); navigate('/'); }}>
|
||||
Quitter
|
||||
</Button>
|
||||
<Button variant="secondary" onClick={prepareAssets} disabled={rasterizing}>
|
||||
{rasterizing ? 'Préparation…' : 'Prévisualiser anatomie'}
|
||||
</Button>
|
||||
{assets ? (
|
||||
<ExportButton report={report} assets={assets} />
|
||||
) : (
|
||||
<Button
|
||||
size="lg"
|
||||
onClick={async () => {
|
||||
const a = await prepareAssets();
|
||||
// Trigger download directly after
|
||||
const { exportReport } = await import('@/pdf/export');
|
||||
const blob = await exportReport(report, a);
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
const safe = report.animal.name.replace(/[^\p{L}\p{N}_-]+/gu, '_');
|
||||
link.download = `bilan-${safe}-${report.sessionDate}.pdf`;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}}
|
||||
disabled={rasterizing}
|
||||
>
|
||||
Exporter en PDF
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-[1.4fr_1fr]">
|
||||
<Card>
|
||||
<CardBody className="p-0">
|
||||
<AnatomyCanvas anatomy={pack.anatomy} highlightFinding={highlight} />
|
||||
<div className="border-t border-clinic-100 p-4">
|
||||
<ZoneSelection zoneLabel={zoneLabel} onValidate={handleValidateSelection} />
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
|
||||
<div className="space-y-4">
|
||||
<Card>
|
||||
<CardBody>
|
||||
<FindingPanel
|
||||
anatomy={pack.anatomy}
|
||||
catalog={pack.pathologies}
|
||||
onPreviewFinding={setPreviewFinding}
|
||||
/>
|
||||
</CardBody>
|
||||
</Card>
|
||||
<ConclusionPanel />
|
||||
<Card>
|
||||
<CardBody className="text-xs text-clinic-600">
|
||||
<p>
|
||||
Brouillon sauvegardé en local (navigateur). Le PDF exporté embarque le bilan complet
|
||||
et peut être ré-importé pour reprendre l’édition.
|
||||
</p>
|
||||
<p className="mt-1">
|
||||
<Badge variant="soft">{report.findings.length} observation(s)</Badge>
|
||||
</p>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
import { motion } from 'motion/react';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Shell } from '@/components/Shell';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Card, CardBody } from '@/components/ui/Card';
|
||||
import { FR } from '@/i18n/fr';
|
||||
import { FADE_IN_UP } from '@/lib/motion';
|
||||
import { importReport } from '@/pdf/import';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
|
||||
export function HomeRoute() {
|
||||
const navigate = useNavigate();
|
||||
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const hydrate = useReportStore((s) => s.hydrate);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [dragOver, setDragOver] = useState(false);
|
||||
|
||||
const handleFile = async (file: File) => {
|
||||
setError(null);
|
||||
const result = await importReport(file);
|
||||
if (!result.ok) {
|
||||
setError(
|
||||
result.reason === 'NO_ATTACHMENT' ? FR.errors.importNotFromApp : FR.errors.importInvalid,
|
||||
);
|
||||
return;
|
||||
}
|
||||
hydrate(result.report);
|
||||
navigate('/editor');
|
||||
};
|
||||
|
||||
return (
|
||||
<Shell>
|
||||
<div className="mx-auto max-w-4xl px-6 py-16">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={FADE_IN_UP}
|
||||
className="mb-12 text-center"
|
||||
>
|
||||
<h1 className="font-display text-4xl text-clinic-900">{FR.app.name}</h1>
|
||||
<p className="mt-2 text-clinic-700">{FR.app.tagline}</p>
|
||||
</motion.div>
|
||||
|
||||
<div
|
||||
className="grid gap-6 md:grid-cols-2"
|
||||
onDragOver={(e) => {
|
||||
e.preventDefault();
|
||||
setDragOver(true);
|
||||
}}
|
||||
onDragLeave={() => setDragOver(false)}
|
||||
onDrop={(e) => {
|
||||
e.preventDefault();
|
||||
setDragOver(false);
|
||||
const f = e.dataTransfer.files[0];
|
||||
if (f?.type === 'application/pdf') void handleFile(f);
|
||||
}}
|
||||
>
|
||||
<Card>
|
||||
<CardBody className="flex h-full flex-col">
|
||||
<h2 className="mb-1 font-display text-xl text-clinic-900">{FR.home.new}</h2>
|
||||
<p className="mb-6 text-sm text-clinic-700">
|
||||
Commencer un bilan vierge : choisir l’espèce et renseigner l’animal et le praticien.
|
||||
</p>
|
||||
<div className="mt-auto">
|
||||
<Button size="lg" onClick={() => navigate('/new')}>
|
||||
{FR.home.new}
|
||||
</Button>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
|
||||
<Card className={dragOver ? 'border-clinic-500 ring-2 ring-clinic-500' : ''}>
|
||||
<CardBody className="flex h-full flex-col">
|
||||
<h2 className="mb-1 font-display text-xl text-clinic-900">{FR.home.import}</h2>
|
||||
<p className="mb-6 text-sm text-clinic-700">{FR.home.importHint}</p>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept="application/pdf"
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
const f = e.target.files?.[0];
|
||||
if (f) void handleFile(f);
|
||||
}}
|
||||
/>
|
||||
<div className="mt-auto">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="lg"
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
>
|
||||
Sélectionner un PDF
|
||||
</Button>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
role="alert"
|
||||
className="mt-6 rounded-md border border-warm-300 bg-warm-300/20 p-4 text-sm text-clinic-900"
|
||||
>
|
||||
{error}
|
||||
</motion.div>
|
||||
)}
|
||||
</div>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { motion } from 'motion/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { Shell } from '@/components/Shell';
|
||||
import { Badge } from '@/components/ui/Badge';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Card, CardBody } from '@/components/ui/Card';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
import { Label } from '@/components/ui/Label';
|
||||
import { Select } from '@/components/ui/Select';
|
||||
import { FR } from '@/i18n/fr';
|
||||
import { newId } from '@/lib/id';
|
||||
import { FADE_IN_UP } from '@/lib/motion';
|
||||
import { ReportSchema, SCHEMA_VERSION, SpeciesIdSchema } from '@/schema/report';
|
||||
import type { Report } from '@/schema/report';
|
||||
import { isSpeciesAvailable } from '@/species';
|
||||
import { useReportStore } from '@/state/reportStore';
|
||||
|
||||
const FormSchema = z.object({
|
||||
species: SpeciesIdSchema,
|
||||
practitioner: z.object({
|
||||
fullName: z.string().min(1, 'Nom requis'),
|
||||
title: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
email: z.string().email('Email invalide').optional().or(z.literal('')),
|
||||
address: z.string().optional(),
|
||||
siret: z.string().optional(),
|
||||
}),
|
||||
animal: z.object({
|
||||
name: z.string().min(1, "Nom de l'animal requis"),
|
||||
owner: z.string().min(1, 'Nom du propriétaire requis'),
|
||||
}),
|
||||
sessionDate: z.string().min(1, 'Date requise'),
|
||||
});
|
||||
type FormValues = z.infer<typeof FormSchema>;
|
||||
|
||||
const ALL_SPECIES = [
|
||||
'equine',
|
||||
'chien',
|
||||
'chat',
|
||||
'lapin',
|
||||
'bovin',
|
||||
'chevre',
|
||||
'ane',
|
||||
'mouton',
|
||||
'porc',
|
||||
] as const;
|
||||
|
||||
export function NewReportRoute() {
|
||||
const navigate = useNavigate();
|
||||
const hydrate = useReportStore((s) => s.hydrate);
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
watch,
|
||||
formState: { errors },
|
||||
} = useForm<FormValues>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
species: 'equine',
|
||||
sessionDate: new Date().toISOString().slice(0, 10),
|
||||
},
|
||||
});
|
||||
|
||||
const currentSpecies = watch('species');
|
||||
|
||||
const onSubmit = (v: FormValues) => {
|
||||
const report: Report = {
|
||||
version: SCHEMA_VERSION,
|
||||
id: newId('report'),
|
||||
createdAt: new Date().toISOString(),
|
||||
species: v.species,
|
||||
practitioner: {
|
||||
fullName: v.practitioner.fullName,
|
||||
...(v.practitioner.title ? { title: v.practitioner.title } : {}),
|
||||
...(v.practitioner.phone ? { phone: v.practitioner.phone } : {}),
|
||||
...(v.practitioner.email ? { email: v.practitioner.email } : {}),
|
||||
...(v.practitioner.address ? { address: v.practitioner.address } : {}),
|
||||
...(v.practitioner.siret ? { siret: v.practitioner.siret } : {}),
|
||||
},
|
||||
animal: v.animal,
|
||||
sessionDate: v.sessionDate,
|
||||
findings: [],
|
||||
conclusion: '',
|
||||
recommendations: '',
|
||||
};
|
||||
const validated = ReportSchema.parse(report);
|
||||
hydrate(validated);
|
||||
navigate('/editor');
|
||||
};
|
||||
|
||||
return (
|
||||
<Shell>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 8 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={FADE_IN_UP}
|
||||
className="mx-auto max-w-3xl px-6 py-10"
|
||||
>
|
||||
<h1 className="mb-6 font-display text-3xl text-clinic-900">Nouveau bilan</h1>
|
||||
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
|
||||
<Card>
|
||||
<CardBody>
|
||||
<h2 className="mb-4 font-display text-lg text-clinic-900">Espèce</h2>
|
||||
<Select {...register('species')}>
|
||||
{ALL_SPECIES.map((id) => {
|
||||
const ok = isSpeciesAvailable(id);
|
||||
return (
|
||||
<option key={id} value={id} disabled={!ok}>
|
||||
{FR.species[id]}
|
||||
{!ok ? ' — bientôt disponible' : ''}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</Select>
|
||||
{!isSpeciesAvailable(currentSpecies) && (
|
||||
<Badge variant="soft" className="mt-3">
|
||||
Cette espèce sera disponible prochainement.
|
||||
</Badge>
|
||||
)}
|
||||
{errors.species && (
|
||||
<p className="mt-2 text-xs text-warm-500">{errors.species.message}</p>
|
||||
)}
|
||||
</CardBody>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardBody>
|
||||
<h2 className="mb-4 font-display text-lg text-clinic-900">Praticien</h2>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<div className="md:col-span-2">
|
||||
<Label htmlFor="fullName">Nom complet *</Label>
|
||||
<Input id="fullName" {...register('practitioner.fullName')} />
|
||||
{errors.practitioner?.fullName && (
|
||||
<p className="mt-1 text-xs text-warm-500">
|
||||
{errors.practitioner.fullName.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="title">Titre / mention légale</Label>
|
||||
<Input id="title" {...register('practitioner.title')} />
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="phone">Téléphone</Label>
|
||||
<Input id="phone" {...register('practitioner.phone')} />
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input id="email" type="email" {...register('practitioner.email')} />
|
||||
{errors.practitioner?.email && (
|
||||
<p className="mt-1 text-xs text-warm-500">
|
||||
{errors.practitioner.email.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="siret">SIRET</Label>
|
||||
<Input id="siret" {...register('practitioner.siret')} />
|
||||
</div>
|
||||
<div className="md:col-span-2">
|
||||
<Label htmlFor="address">Adresse</Label>
|
||||
<Input id="address" {...register('practitioner.address')} />
|
||||
</div>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardBody>
|
||||
<h2 className="mb-4 font-display text-lg text-clinic-900">Animal et séance</h2>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<div>
|
||||
<Label htmlFor="animalName">Nom de l’animal *</Label>
|
||||
<Input id="animalName" {...register('animal.name')} />
|
||||
{errors.animal?.name && (
|
||||
<p className="mt-1 text-xs text-warm-500">{errors.animal.name.message}</p>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="owner">Propriétaire *</Label>
|
||||
<Input id="owner" {...register('animal.owner')} />
|
||||
{errors.animal?.owner && (
|
||||
<p className="mt-1 text-xs text-warm-500">{errors.animal.owner.message}</p>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="sessionDate">Date de séance</Label>
|
||||
<Input id="sessionDate" type="date" {...register('sessionDate')} />
|
||||
</div>
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<Button type="button" variant="ghost" onClick={() => navigate('/')}>
|
||||
Annuler
|
||||
</Button>
|
||||
<Button type="submit" size="lg" disabled={!isSpeciesAvailable(currentSpecies)}>
|
||||
Commencer le bilan
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</motion.div>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Shell } from '@/components/Shell';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
|
||||
export function NotFoundRoute() {
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<Shell>
|
||||
<div className="mx-auto max-w-md px-6 py-24 text-center">
|
||||
<h1 className="mb-2 font-display text-3xl text-clinic-900">Page introuvable</h1>
|
||||
<p className="mb-6 text-clinic-700">Cette adresse n’existe pas.</p>
|
||||
<Button onClick={() => navigate('/')}>Retour à l’accueil</Button>
|
||||
</div>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const SeveritySchema = z.enum(['mild', 'moderate', 'severe']);
|
||||
export type Severity = z.infer<typeof SeveritySchema>;
|
||||
|
||||
export const PathologyRefSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
label: z.string().min(1),
|
||||
free: z.boolean().default(false),
|
||||
});
|
||||
export type PathologyRef = z.infer<typeof PathologyRefSchema>;
|
||||
|
||||
export const FindingSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
zones: z.array(z.string()).min(1),
|
||||
linkedZones: z.array(z.string()).default([]),
|
||||
pathologies: z.array(PathologyRefSchema).default([]),
|
||||
severity: SeveritySchema,
|
||||
comment: z.string().default(''),
|
||||
});
|
||||
export type Finding = z.infer<typeof FindingSchema>;
|
||||
@@ -1,12 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const PractitionerSchema = z.object({
|
||||
fullName: z.string().min(1),
|
||||
title: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
email: z.string().email().optional(),
|
||||
address: z.string().optional(),
|
||||
siret: z.string().optional(),
|
||||
});
|
||||
|
||||
export type Practitioner = z.infer<typeof PractitionerSchema>;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { FindingSchema } from './finding';
|
||||
import { PractitionerSchema } from './practitioner';
|
||||
|
||||
export const SCHEMA_VERSION = 1 as const;
|
||||
|
||||
export const SpeciesIdSchema = z.enum([
|
||||
'chien',
|
||||
'chat',
|
||||
'equine',
|
||||
'lapin',
|
||||
'bovin',
|
||||
'chevre',
|
||||
'ane',
|
||||
'mouton',
|
||||
'porc',
|
||||
]);
|
||||
|
||||
export const ReportSchema = z.object({
|
||||
version: z.literal(SCHEMA_VERSION),
|
||||
id: z.string().min(1),
|
||||
createdAt: z.string().datetime(),
|
||||
species: SpeciesIdSchema,
|
||||
practitioner: PractitionerSchema,
|
||||
animal: z.object({
|
||||
name: z.string().min(1),
|
||||
owner: z.string().min(1),
|
||||
}),
|
||||
sessionDate: z.string(),
|
||||
findings: z.array(FindingSchema).default([]),
|
||||
conclusion: z.string().default(''),
|
||||
recommendations: z.string().default(''),
|
||||
nextAppointment: z.string().optional(),
|
||||
});
|
||||
|
||||
export type Report = z.infer<typeof ReportSchema>;
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -1,17 +0,0 @@
|
||||
# Cheval — anatomie et pathologies
|
||||
|
||||
Sources clinique-vétérinaires devant figurer en référence pour chaque entrée de
|
||||
`pathologies.ts` :
|
||||
|
||||
- Merck Veterinary Manual — https://www.merckvetmanual.com
|
||||
- IMAIOS vet-Anatomy — https://www.imaios.com/en/vet-anatomy
|
||||
- PubMed Central — https://www.ncbi.nlm.nih.gov/pmc/
|
||||
- Veterinary Clinics of North America: Equine Practice (Elsevier)
|
||||
- Equine Veterinary Journal (Wiley/BEVA)
|
||||
- London College of Animal Osteopathy — https://lcao.com
|
||||
- WikiVet — https://en.wikivet.net
|
||||
|
||||
Formule vertébrale du cheval : C7 / T18 / L6 / S5.
|
||||
|
||||
Toute pathologie ajoutée doit citer au moins une source. Pas d'entrée
|
||||
inventée — la base est ensuite relue et validée par le praticien client.
|
||||
@@ -1,54 +0,0 @@
|
||||
import type { SpeciesAnatomy, Subzone, Zone } from '../types';
|
||||
|
||||
const range = (prefix: string, count: number): Subzone[] =>
|
||||
Array.from({ length: count }, (_, i) => ({
|
||||
id: `${prefix}${i + 1}`,
|
||||
label: `${prefix}${i + 1}`,
|
||||
}));
|
||||
|
||||
const CERVICAL: Subzone[] = range('C', 7);
|
||||
const THORACIC: Subzone[] = range('T', 18);
|
||||
const LUMBAR: Subzone[] = range('L', 6);
|
||||
const SACRAL: Subzone[] = range('S', 5);
|
||||
|
||||
const ZONES: Zone[] = [
|
||||
{ id: 'head', label: 'Tête', category: 'head', views: ['lateral_left', 'lateral_right', 'dorsal'] },
|
||||
{ id: 'neck', label: 'Encolure', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: CERVICAL },
|
||||
{ id: 'withers', label: 'Garrot', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'] },
|
||||
{ id: 'thoracic-back', label: 'Dos thoracique', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: THORACIC },
|
||||
{ id: 'lumbar', label: 'Lombaire', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: LUMBAR },
|
||||
{ id: 'sacrum', label: 'Sacrum', category: 'axial', views: ['lateral_left', 'lateral_right', 'dorsal'], subzones: SACRAL },
|
||||
{ id: 'sacro-iliac-l', label: 'Sacro-iliaque gauche', category: 'axial', views: ['lateral_left', 'dorsal'] },
|
||||
{ id: 'sacro-iliac-r', label: 'Sacro-iliaque droite', category: 'axial', views: ['lateral_right', 'dorsal'] },
|
||||
{ id: 'tail', label: 'Queue', category: 'tail', views: ['lateral_left', 'lateral_right', 'dorsal'] },
|
||||
|
||||
{ id: 'shoulder-l', label: 'Épaule gauche', category: 'limb', views: ['lateral_left', 'dorsal'] },
|
||||
{ id: 'shoulder-r', label: 'Épaule droite', category: 'limb', views: ['lateral_right', 'dorsal'] },
|
||||
{ id: 'elbow-l', label: 'Coude gauche', category: 'limb', views: ['lateral_left'] },
|
||||
{ id: 'elbow-r', label: 'Coude droit', category: 'limb', views: ['lateral_right'] },
|
||||
{ id: 'knee-l', label: 'Genou antérieur gauche', category: 'limb', views: ['lateral_left'] },
|
||||
{ id: 'knee-r', label: 'Genou antérieur droit', category: 'limb', views: ['lateral_right'] },
|
||||
{ id: 'fetlock-front-l', label: 'Boulet antérieur gauche', category: 'limb', views: ['lateral_left'] },
|
||||
{ id: 'fetlock-front-r', label: 'Boulet antérieur droit', category: 'limb', views: ['lateral_right'] },
|
||||
|
||||
{ id: 'hip-l', label: 'Hanche gauche', category: 'limb', views: ['lateral_left', 'dorsal'] },
|
||||
{ id: 'hip-r', label: 'Hanche droite', category: 'limb', views: ['lateral_right', 'dorsal'] },
|
||||
{ id: 'stifle-l', label: 'Grasset gauche', category: 'limb', views: ['lateral_left'] },
|
||||
{ id: 'stifle-r', label: 'Grasset droit', category: 'limb', views: ['lateral_right'] },
|
||||
{ id: 'hock-l', label: 'Jarret gauche', category: 'limb', views: ['lateral_left'] },
|
||||
{ id: 'hock-r', label: 'Jarret droit', category: 'limb', views: ['lateral_right'] },
|
||||
{ id: 'fetlock-rear-l', label: 'Boulet postérieur gauche', category: 'limb', views: ['lateral_left'] },
|
||||
{ id: 'fetlock-rear-r', label: 'Boulet postérieur droit', category: 'limb', views: ['lateral_right'] },
|
||||
];
|
||||
|
||||
export const EQUINE_ANATOMY: SpeciesAnatomy = {
|
||||
id: 'equine',
|
||||
label: 'Cheval',
|
||||
vertebralFormula: { cervical: 7, thoracic: 18, lumbar: 6, sacral: 5 },
|
||||
zones: ZONES,
|
||||
svg: {
|
||||
lateral_left: '/species/equine/lateral-left.svg',
|
||||
lateral_right: '/species/equine/lateral-right.svg',
|
||||
dorsal: '/species/equine/dorsal.svg',
|
||||
},
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
import { registerSpecies } from '../registry';
|
||||
|
||||
import { EQUINE_ANATOMY } from './anatomy';
|
||||
import { EQUINE_PATHOLOGIES } from './pathologies';
|
||||
|
||||
registerSpecies('equine', {
|
||||
anatomy: EQUINE_ANATOMY,
|
||||
pathologies: EQUINE_PATHOLOGIES,
|
||||
});
|
||||
|
||||
export { EQUINE_ANATOMY, EQUINE_PATHOLOGIES };
|
||||
@@ -1,295 +0,0 @@
|
||||
import type { PathologyEntry } from '../types';
|
||||
|
||||
const MVM = (slug: string): string => `https://www.merckvetmanual.com/horse-owners/${slug}`;
|
||||
const IMAIOS = 'https://www.imaios.com/en/vet-anatomy/horse';
|
||||
const PUBMED = (id: string): string => `https://pubmed.ncbi.nlm.nih.gov/${id}/`;
|
||||
|
||||
export const EQUINE_PATHOLOGIES: PathologyEntry[] = [
|
||||
// ─── Axial : encolure / dos / lombaire / sacrum ───────────────────────────
|
||||
{
|
||||
id: 'eq_kissing_spines',
|
||||
label: 'Syndrome des processus épineux chevauchants (kissing spines)',
|
||||
description:
|
||||
'Contact ou chevauchement des processus épineux thoraciques, principalement entre T13 et T18. Source fréquente de douleur dorsale.',
|
||||
category: 'osseux',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['thoracic-back', 'withers', 'lumbar'],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/disorders-of-the-back-and-pelvis-of-horses'), PUBMED('29071751')],
|
||||
},
|
||||
{
|
||||
id: 'eq_cervical_facet_arthropathy',
|
||||
label: 'Arthropathie des facettes articulaires cervicales',
|
||||
description: 'Remaniements arthrosiques des articulations zygapophysaires cervicales, souvent C5-C7.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['neck'],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/cervical-vertebral-malformation-in-horses'), PUBMED('22416782')],
|
||||
},
|
||||
{
|
||||
id: 'eq_cervical_stenotic_myelopathy',
|
||||
label: 'Myélopathie cervicale sténosante (wobbler)',
|
||||
description: 'Compression médullaire cervicale par malformation vertébrale ou sténose dynamique.',
|
||||
category: 'nerveux',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['neck'],
|
||||
sources: [MVM('horse-owners/brain-spinal-cord-and-nerve-disorders-of-horses/cervical-vertebral-malformation-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_lumbosacral_pain',
|
||||
label: 'Dysfonction lombo-sacrée',
|
||||
description: 'Douleur localisée à la jonction L6-S1 et autour du sacrum.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['lumbar', 'sacrum'],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/disorders-of-the-back-and-pelvis-of-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_sacroiliac_dysfunction',
|
||||
label: 'Dysfonction sacro-iliaque',
|
||||
description: 'Restriction de mobilité ou douleur au niveau des articulations sacro-iliaques.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['sacro-iliac-l', 'sacro-iliac-r', 'sacrum'],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/disorders-of-the-back-and-pelvis-of-horses'), PUBMED('20840713')],
|
||||
},
|
||||
{
|
||||
id: 'eq_thoracolumbar_muscular',
|
||||
label: 'Tension musculaire thoraco-lombaire',
|
||||
description: 'Hypertonie des muscles long dorsal / longissimus, souvent secondaire à une selle inadaptée.',
|
||||
category: 'musculaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['thoracic-back', 'lumbar', 'withers'],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/muscle-disorders-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_supraspinous_ligament_desmitis',
|
||||
label: 'Desmite du ligament supra-épineux',
|
||||
description: 'Inflammation chronique du ligament supra-épineux dorsal, parfois associée aux kissing spines.',
|
||||
category: 'tendino-ligamentaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['thoracic-back', 'lumbar', 'withers'],
|
||||
sources: [PUBMED('15510510')],
|
||||
},
|
||||
{
|
||||
id: 'eq_nuchal_ligament_desmopathy',
|
||||
label: 'Desmopathie du ligament nuchal',
|
||||
description: 'Atteinte chronique du ligament nuchal, douleur à la flexion cervicale.',
|
||||
category: 'tendino-ligamentaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['neck', 'head'],
|
||||
sources: [IMAIOS],
|
||||
},
|
||||
{
|
||||
id: 'eq_tail_set_dysfunction',
|
||||
label: 'Restriction de mobilité de la queue',
|
||||
description: "Manque d'oscillation latérale ou de portée de la queue, signe d'irritation sacro-coccygienne.",
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['tail', 'sacrum'],
|
||||
sources: [IMAIOS],
|
||||
},
|
||||
{
|
||||
id: 'eq_tmj_dysfunction',
|
||||
label: 'Dysfonction temporo-mandibulaire',
|
||||
description: 'Asymétrie ou restriction de l’ATM, souvent associée à un déséquilibre dentaire.',
|
||||
category: 'cranio-sacre',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['head'],
|
||||
sources: [PUBMED('21916951')],
|
||||
},
|
||||
|
||||
// ─── Membres antérieurs ───────────────────────────────────────────────────
|
||||
{
|
||||
id: 'eq_navicular_syndrome',
|
||||
label: 'Syndrome naviculaire (douleur podotrochléaire)',
|
||||
description: 'Douleur chronique de l’appareil podotrochléaire, fréquente cause de boiterie antérieure.',
|
||||
category: 'osseux',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['fetlock-front-l', 'fetlock-front-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/navicular-disease-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_ringbone',
|
||||
label: 'Phalangite (ringbone)',
|
||||
description: 'Ostéoarthrose des articulations interphalangiennes, classiquement membres antérieurs.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['fetlock-front-l', 'fetlock-front-r', 'fetlock-rear-l', 'fetlock-rear-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/ringbone-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_splints',
|
||||
label: 'Suros (splints)',
|
||||
description: 'Inflammation périostée entre métacarpien principal et stylet, surtout chez le jeune cheval.',
|
||||
category: 'osseux',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['knee-l', 'knee-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/splints-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_carpal_osteoarthritis',
|
||||
label: 'Ostéoarthrose du carpe',
|
||||
description: 'Usure articulaire du carpe (genou antérieur), fréquente chez les chevaux de course.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['knee-l', 'knee-r'],
|
||||
sources: [PUBMED('20840713')],
|
||||
},
|
||||
{
|
||||
id: 'eq_suspensory_desmitis_front',
|
||||
label: 'Desmite suspensorale antérieure',
|
||||
description: 'Atteinte du ligament suspenseur du boulet, branches ou corps, des antérieurs.',
|
||||
category: 'tendino-ligamentaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['fetlock-front-l', 'fetlock-front-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/tendinitis-and-tendinosis-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_sdft_tendinitis',
|
||||
label: 'Tendinite du tendon fléchisseur superficiel',
|
||||
description: 'Atteinte du SDFT, classiquement à la moitié distale du métacarpe.',
|
||||
category: 'tendino-ligamentaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['fetlock-front-l', 'fetlock-front-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/tendinitis-and-tendinosis-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_shoulder_sweeney',
|
||||
label: 'Atrophie scapulaire (sweeney)',
|
||||
description: 'Atrophie des muscles supra-épineux/infra-épineux par lésion du nerf suprascapulaire.',
|
||||
category: 'nerveux',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['shoulder-l', 'shoulder-r'],
|
||||
sources: [MVM('horse-owners/brain-spinal-cord-and-nerve-disorders-of-horses/suprascapular-nerve-injury-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_elbow_capped',
|
||||
label: 'Hygroma du coude (capped elbow)',
|
||||
description: 'Bursite olécrânienne par traumatisme répété.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['elbow-l', 'elbow-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/bursitis-in-horses')],
|
||||
},
|
||||
|
||||
// ─── Membres postérieurs ──────────────────────────────────────────────────
|
||||
{
|
||||
id: 'eq_bone_spavin',
|
||||
label: 'Éparvin osseux (bone spavin)',
|
||||
description: 'Ostéoarthrose des articulations distales du tarse, principale cause d’éparvin.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['hock-l', 'hock-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/bone-spavin-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_bog_spavin',
|
||||
label: 'Vessigon articulaire du jarret (bog spavin)',
|
||||
description: 'Distension synoviale de l’articulation tibio-tarsienne.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['hock-l', 'hock-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/bog-spavin-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_curb',
|
||||
label: 'Courbe du jarret (curb)',
|
||||
description: 'Desmite du ligament tarsien plantaire long, palpable en arrière du jarret.',
|
||||
category: 'tendino-ligamentaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['hock-l', 'hock-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/curb-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_stifle_upward_fixation_patella',
|
||||
label: 'Accrochement intermittent de la rotule',
|
||||
description: 'Blocage transitoire de la rotule sur la trochlée fémorale, fréquent chez le jeune cheval.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['stifle-l', 'stifle-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/upward-fixation-of-the-patella-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_stifle_meniscal_injury',
|
||||
label: 'Lésion méniscale du grasset',
|
||||
description: 'Atteinte du ménisque médial ou latéral, conséquence de torsion ou de surcharge.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['stifle-l', 'stifle-r'],
|
||||
sources: [PUBMED('20840713')],
|
||||
},
|
||||
{
|
||||
id: 'eq_suspensory_desmitis_rear',
|
||||
label: 'Desmite suspensorale postérieure (PSD)',
|
||||
description: 'Desmite chronique du suspenseur, branche médiale postérieure principalement.',
|
||||
category: 'tendino-ligamentaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['hock-l', 'hock-r', 'fetlock-rear-l', 'fetlock-rear-r'],
|
||||
sources: [MVM('horse-owners/lameness-in-horses/tendinitis-and-tendinosis-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_coxofemoral_arthrosis',
|
||||
label: 'Arthrose coxo-fémorale',
|
||||
description: 'Atteinte dégénérative de la hanche, plus rare mais source de boiterie postérieure.',
|
||||
category: 'articulaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['hip-l', 'hip-r'],
|
||||
sources: [IMAIOS],
|
||||
},
|
||||
{
|
||||
id: 'eq_gluteal_strain',
|
||||
label: 'Lésion musculaire glutéale',
|
||||
description: 'Élongation ou contracture des muscles fessiers, fréquente après effort intense.',
|
||||
category: 'musculaire',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['hip-l', 'hip-r'],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/muscle-disorders-in-horses')],
|
||||
},
|
||||
|
||||
// ─── Fascial / viscéral / autre ───────────────────────────────────────────
|
||||
{
|
||||
id: 'eq_thoracolumbar_fascial_restriction',
|
||||
label: 'Restriction fasciale thoraco-lombaire',
|
||||
description: 'Adhérences fasciales limitant la flexion et l’extension dorsale.',
|
||||
category: 'fascial',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['thoracic-back', 'lumbar'],
|
||||
sources: [PUBMED('33555115')],
|
||||
},
|
||||
{
|
||||
id: 'eq_diaphragmatic_restriction',
|
||||
label: 'Restriction diaphragmatique',
|
||||
description: 'Limitation de mobilité diaphragmatique, palpable en pression abdominale antérieure.',
|
||||
category: 'visceral',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['thoracic-back', 'withers'],
|
||||
sources: [IMAIOS],
|
||||
},
|
||||
{
|
||||
id: 'eq_gastric_visceral_dysfunction',
|
||||
label: 'Dysfonction viscérale gastrique',
|
||||
description: 'Sensibilité épigastrique, parfois associée à ulcères gastriques (EGUS).',
|
||||
category: 'visceral',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['thoracic-back', 'lumbar'],
|
||||
sources: [MVM('horse-owners/digestive-disorders-of-horses/gastric-ulcers-in-horses')],
|
||||
},
|
||||
{
|
||||
id: 'eq_cranio_sacral_restriction',
|
||||
label: 'Restriction crânio-sacrée',
|
||||
description: 'Perte de rythme crânio-sacré, palpation crânienne et sacrée combinées.',
|
||||
category: 'cranio-sacre',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: ['head', 'sacrum'],
|
||||
sources: ['London College of Animal Osteopathy — https://lcao.com'],
|
||||
},
|
||||
{
|
||||
id: 'eq_post_fall_global',
|
||||
label: 'Conséquences post-traumatiques (chute)',
|
||||
description: 'Tableau combiné de tensions multi-zones après chute, à différencier d’une lésion focalisée.',
|
||||
category: 'autre',
|
||||
applicableSpecies: ['equine'],
|
||||
applicableZones: [],
|
||||
sources: [MVM('horse-owners/bone-joint-and-muscle-disorders-of-horses/disorders-of-the-back-and-pelvis-of-horses')],
|
||||
},
|
||||
];
|
||||
@@ -1,13 +0,0 @@
|
||||
import './equine';
|
||||
|
||||
export { SPECIES, getSpecies, isSpeciesAvailable } from './registry';
|
||||
export type {
|
||||
PathologyEntry,
|
||||
SpeciesAnatomy,
|
||||
SpeciesId,
|
||||
Subzone,
|
||||
View,
|
||||
Zone,
|
||||
ZoneCategory,
|
||||
VertebralFormula,
|
||||
} from './types';
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -1,20 +0,0 @@
|
||||
import type { PathologyEntry, SpeciesAnatomy, SpeciesId } from './types';
|
||||
|
||||
export interface SpeciesPack {
|
||||
anatomy: SpeciesAnatomy;
|
||||
pathologies: PathologyEntry[];
|
||||
}
|
||||
|
||||
export const SPECIES: Partial<Record<SpeciesId, SpeciesPack>> = {};
|
||||
|
||||
export function registerSpecies(id: SpeciesId, pack: SpeciesPack): void {
|
||||
SPECIES[id] = pack;
|
||||
}
|
||||
|
||||
export function getSpecies(id: SpeciesId): SpeciesPack | undefined {
|
||||
return SPECIES[id];
|
||||
}
|
||||
|
||||
export function isSpeciesAvailable(id: SpeciesId): boolean {
|
||||
return SPECIES[id] !== undefined;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
export type SpeciesId =
|
||||
| 'chien'
|
||||
| 'chat'
|
||||
| 'equine'
|
||||
| 'lapin'
|
||||
| 'bovin'
|
||||
| 'chevre'
|
||||
| 'ane'
|
||||
| 'mouton'
|
||||
| 'porc';
|
||||
|
||||
export type View = 'lateral_left' | 'lateral_right' | 'dorsal';
|
||||
|
||||
export type ZoneCategory = 'axial' | 'limb' | 'head' | 'tail' | 'other';
|
||||
|
||||
export interface Subzone {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface Zone {
|
||||
id: string;
|
||||
label: string;
|
||||
category: ZoneCategory;
|
||||
views: View[];
|
||||
subzones?: Subzone[];
|
||||
}
|
||||
|
||||
export interface VertebralFormula {
|
||||
cervical: number;
|
||||
thoracic: number;
|
||||
lumbar: number;
|
||||
sacral: number;
|
||||
}
|
||||
|
||||
export interface SpeciesAnatomy {
|
||||
id: SpeciesId;
|
||||
label: string;
|
||||
vertebralFormula: VertebralFormula;
|
||||
zones: Zone[];
|
||||
svg: Record<View, string>;
|
||||
}
|
||||
|
||||
export interface PathologyEntry {
|
||||
id: string;
|
||||
label: string;
|
||||
description: string;
|
||||
category:
|
||||
| 'osseux'
|
||||
| 'articulaire'
|
||||
| 'musculaire'
|
||||
| 'tendino-ligamentaire'
|
||||
| 'fascial'
|
||||
| 'visceral'
|
||||
| 'cranio-sacre'
|
||||
| 'nerveux'
|
||||
| 'autre';
|
||||
applicableSpecies: SpeciesId[];
|
||||
applicableZones: string[];
|
||||
sources: string[];
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist, createJSONStorage } from 'zustand/middleware';
|
||||
|
||||
import { newId } from '../lib/id';
|
||||
import type { Finding } from '../schema/finding';
|
||||
import type { Report } from '../schema/report';
|
||||
import { SCHEMA_VERSION } from '../schema/report';
|
||||
|
||||
interface ReportState {
|
||||
report: Report | null;
|
||||
selection: string[];
|
||||
|
||||
hydrate: (r: Report) => void;
|
||||
reset: () => void;
|
||||
|
||||
toggleZone: (zoneId: string) => void;
|
||||
clearSelection: () => void;
|
||||
setSelection: (zones: string[]) => void;
|
||||
|
||||
addFinding: (input: Omit<Finding, 'id'>) => Finding;
|
||||
updateFinding: (id: string, patch: Partial<Finding>) => void;
|
||||
removeFinding: (id: string) => void;
|
||||
|
||||
setConclusion: (text: string) => void;
|
||||
setRecommendations: (text: string) => void;
|
||||
setNextAppointment: (date: string | undefined) => void;
|
||||
}
|
||||
|
||||
function emptyReport(overrides: Partial<Report> = {}): Report {
|
||||
return {
|
||||
version: SCHEMA_VERSION,
|
||||
id: newId('report'),
|
||||
createdAt: new Date().toISOString(),
|
||||
species: 'equine',
|
||||
practitioner: { fullName: '' },
|
||||
animal: { name: '', owner: '' },
|
||||
sessionDate: new Date().toISOString().slice(0, 10),
|
||||
findings: [],
|
||||
conclusion: '',
|
||||
recommendations: '',
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export const useReportStore = create<ReportState>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
report: null,
|
||||
selection: [],
|
||||
|
||||
hydrate: (r) => set({ report: r, selection: [] }),
|
||||
reset: () => set({ report: null, selection: [] }),
|
||||
|
||||
toggleZone: (zoneId) =>
|
||||
set((s) => {
|
||||
const has = s.selection.includes(zoneId);
|
||||
return {
|
||||
selection: has ? s.selection.filter((z) => z !== zoneId) : [...s.selection, zoneId],
|
||||
};
|
||||
}),
|
||||
clearSelection: () => set({ selection: [] }),
|
||||
setSelection: (zones) => set({ selection: zones }),
|
||||
|
||||
addFinding: (input) => {
|
||||
const finding: Finding = { ...input, id: newId('finding') };
|
||||
const r = get().report;
|
||||
if (!r) return finding;
|
||||
set({
|
||||
report: { ...r, findings: [...r.findings, finding] },
|
||||
selection: [],
|
||||
});
|
||||
return finding;
|
||||
},
|
||||
|
||||
updateFinding: (id, patch) =>
|
||||
set((s) => {
|
||||
if (!s.report) return s;
|
||||
return {
|
||||
report: {
|
||||
...s.report,
|
||||
findings: s.report.findings.map((f) => (f.id === id ? { ...f, ...patch } : f)),
|
||||
},
|
||||
};
|
||||
}),
|
||||
|
||||
removeFinding: (id) =>
|
||||
set((s) => {
|
||||
if (!s.report) return s;
|
||||
return {
|
||||
report: {
|
||||
...s.report,
|
||||
findings: s.report.findings.filter((f) => f.id !== id),
|
||||
},
|
||||
};
|
||||
}),
|
||||
|
||||
setConclusion: (text) =>
|
||||
set((s) => (s.report ? { report: { ...s.report, conclusion: text } } : s)),
|
||||
setRecommendations: (text) =>
|
||||
set((s) => (s.report ? { report: { ...s.report, recommendations: text } } : s)),
|
||||
setNextAppointment: (date) =>
|
||||
set((s) => {
|
||||
if (!s.report) return s;
|
||||
const next: Report =
|
||||
date === undefined
|
||||
? { ...s.report, nextAppointment: undefined }
|
||||
: { ...s.report, nextAppointment: date };
|
||||
return { report: next };
|
||||
}),
|
||||
}),
|
||||
{
|
||||
name: 'osteo-report-draft',
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
partialize: (s) => ({ report: s.report }),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
export { emptyReport };
|
||||
@@ -1,19 +0,0 @@
|
||||
import type { Finding } from '../schema/finding';
|
||||
import type { Report } from '../schema/report';
|
||||
|
||||
export function findingsByZone(report: Report | null, zoneId: string): Finding[] {
|
||||
if (!report) return [];
|
||||
return report.findings.filter(
|
||||
(f) => f.zones.includes(zoneId) || f.linkedZones.includes(zoneId),
|
||||
);
|
||||
}
|
||||
|
||||
export function zonesInUse(report: Report | null): string[] {
|
||||
if (!report) return [];
|
||||
const ids = new Set<string>();
|
||||
for (const f of report.findings) {
|
||||
for (const z of f.zones) ids.add(z);
|
||||
for (const z of f.linkedZones) ids.add(z);
|
||||
}
|
||||
return Array.from(ids);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
@import 'tailwindcss';
|
||||
@import './tokens.css';
|
||||
|
||||
@theme {
|
||||
--color-clinic-50: var(--clinic-50);
|
||||
--color-clinic-100: var(--clinic-100);
|
||||
--color-clinic-200: var(--clinic-200);
|
||||
--color-clinic-300: var(--clinic-300);
|
||||
--color-clinic-400: var(--clinic-400);
|
||||
--color-clinic-500: var(--clinic-500);
|
||||
--color-clinic-600: var(--clinic-600);
|
||||
--color-clinic-700: var(--clinic-700);
|
||||
--color-clinic-800: var(--clinic-800);
|
||||
--color-clinic-900: var(--clinic-900);
|
||||
--color-warm-300: var(--warm-300);
|
||||
--color-warm-400: var(--warm-400);
|
||||
--color-warm-500: var(--warm-500);
|
||||
--color-surface: var(--surface);
|
||||
--color-ink: var(--ink);
|
||||
--font-sans: 'Inter', system-ui, sans-serif;
|
||||
--font-display: 'Fraunces', Georgia, serif;
|
||||
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#root {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--surface);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-sans);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
:root {
|
||||
/* Clinical green — primary identity */
|
||||
--clinic-50: #f4f7f2;
|
||||
--clinic-100: #e6ede0;
|
||||
--clinic-200: #cbdac1;
|
||||
--clinic-300: #a6c099;
|
||||
--clinic-400: #7ba370;
|
||||
--clinic-500: #4a7c59;
|
||||
--clinic-600: #3c6849;
|
||||
--clinic-700: #2d4a35;
|
||||
--clinic-800: #1f3527;
|
||||
--clinic-900: #14241b;
|
||||
|
||||
/* Warm accent — severity / warnings */
|
||||
--warm-300: #d4a574;
|
||||
--warm-400: #b9854a;
|
||||
--warm-500: #a8612d;
|
||||
|
||||
/* Neutrals */
|
||||
--surface: #fffdf8;
|
||||
--ink: #1a2b1f;
|
||||
|
||||
/* Severity scale tokens */
|
||||
--severity-mild: var(--clinic-400);
|
||||
--severity-moderate: var(--warm-300);
|
||||
--severity-severe: var(--warm-500);
|
||||
|
||||
/* Zone state tokens */
|
||||
--zone-default: transparent;
|
||||
--zone-hover: color-mix(in oklab, var(--clinic-300) 30%, transparent);
|
||||
--zone-selected: color-mix(in oklab, var(--clinic-500) 45%, transparent);
|
||||
--zone-linked: color-mix(in oklab, var(--warm-400) 45%, transparent);
|
||||
}
|
||||
Vendored
-2
@@ -1,2 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite-plugin-svgr/client" />
|
||||
@@ -1,41 +0,0 @@
|
||||
import type { Config } from 'tailwindcss';
|
||||
|
||||
const config: Config = {
|
||||
darkMode: 'class',
|
||||
content: [
|
||||
'./index.html',
|
||||
'./src/**/*.{ts,tsx,js,jsx}',
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
clinic: {
|
||||
'50': 'var(--clinic-50)',
|
||||
'100': 'var(--clinic-100)',
|
||||
'200': 'var(--clinic-200)',
|
||||
'300': 'var(--clinic-300)',
|
||||
'400': 'var(--clinic-400)',
|
||||
'500': 'var(--clinic-500)',
|
||||
'600': 'var(--clinic-600)',
|
||||
'700': 'var(--clinic-700)',
|
||||
'800': 'var(--clinic-800)',
|
||||
'900': 'var(--clinic-900)',
|
||||
},
|
||||
warm: {
|
||||
'300': 'var(--warm-300)',
|
||||
'400': 'var(--warm-400)',
|
||||
'500': 'var(--warm-500)',
|
||||
},
|
||||
surface: 'var(--surface)',
|
||||
ink: 'var(--ink)',
|
||||
},
|
||||
fontFamily: {
|
||||
sans: ['var(--font-sans)', 'system-ui', 'sans-serif'],
|
||||
mono: ['var(--font-mono)', 'monospace'],
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
|
||||
export default config;
|
||||
Whitespace-only changes.
@@ -1,20 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { newId } from '@/lib/id';
|
||||
|
||||
describe('newId', () => {
|
||||
it('returns a string without prefix when called bare', () => {
|
||||
const id = newId();
|
||||
expect(typeof id).toBe('string');
|
||||
expect(id.length).toBe(12);
|
||||
});
|
||||
|
||||
it('prefixes when asked', () => {
|
||||
expect(newId('finding')).toMatch(/^finding_[A-Za-z0-9_-]{10}$/);
|
||||
});
|
||||
|
||||
it('is unique across 1000 calls', () => {
|
||||
const ids = new Set(Array.from({ length: 1000 }, () => newId()));
|
||||
expect(ids.size).toBe(1000);
|
||||
});
|
||||
});
|
||||
@@ -1,75 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { exportReportBytes, type AnatomyAssets } from '@/pdf/export';
|
||||
import { importReport } from '@/pdf/import';
|
||||
import { EQUINE_ANATOMY } from '@/species/equine/anatomy';
|
||||
|
||||
// 1×1 transparent PNG as Uint8Array
|
||||
const TINY_PNG = Uint8Array.from([
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x15, 0xc4,
|
||||
0x89, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x00, 0x01, 0x00, 0x00,
|
||||
0x05, 0x00, 0x01, 0x0d, 0x0a, 0x2d, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
|
||||
0x42, 0x60, 0x82,
|
||||
]);
|
||||
|
||||
const assets: AnatomyAssets = {
|
||||
anatomy: EQUINE_ANATOMY,
|
||||
rasters: {
|
||||
lateral_left: TINY_PNG,
|
||||
lateral_right: TINY_PNG,
|
||||
dorsal: TINY_PNG,
|
||||
},
|
||||
};
|
||||
|
||||
const sampleReport = {
|
||||
version: 1 as const,
|
||||
id: 'r_roundtrip',
|
||||
createdAt: '2026-05-17T10:00:00.000Z',
|
||||
species: 'equine' as const,
|
||||
practitioner: {
|
||||
fullName: 'Dr. Test',
|
||||
phone: '0102030405',
|
||||
email: 'test@example.com',
|
||||
},
|
||||
animal: { name: 'Pégase', owner: 'Famille Martin' },
|
||||
sessionDate: '2026-05-17',
|
||||
findings: [
|
||||
{
|
||||
id: 'finding_1',
|
||||
zones: ['thoracic-back'],
|
||||
linkedZones: ['lumbar'],
|
||||
pathologies: [{ id: 'eq_kissing_spines', label: 'Kissing spines', free: false }],
|
||||
severity: 'moderate' as const,
|
||||
comment: 'Sensibilité marquée en flexion latérale.',
|
||||
},
|
||||
],
|
||||
conclusion: 'Tableau de dysfonction dorsale.',
|
||||
recommendations: 'Repos 7 jours, séance de contrôle à 3 semaines.',
|
||||
nextAppointment: '2026-06-07',
|
||||
};
|
||||
|
||||
describe('PDF roundtrip', () => {
|
||||
it('exports then imports back equal report', async () => {
|
||||
const bytes = await exportReportBytes(sampleReport, assets);
|
||||
expect(bytes.byteLength).toBeGreaterThan(0);
|
||||
expect(new TextDecoder().decode(bytes.slice(0, 5))).toBe('%PDF-');
|
||||
|
||||
const result = await importReport(bytes);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) {
|
||||
expect(result.report).toEqual(sampleReport);
|
||||
}
|
||||
});
|
||||
|
||||
it('rejects a PDF without our attachment', async () => {
|
||||
// Build a tiny PDF with no attachment using pdf-lib
|
||||
const { PDFDocument } = await import('pdf-lib');
|
||||
const pdf = await PDFDocument.create();
|
||||
pdf.addPage();
|
||||
const bytes = await pdf.save();
|
||||
const result = await importReport(bytes);
|
||||
expect(result.ok).toBe(false);
|
||||
if (!result.ok) expect(result.reason).toBe('NO_ATTACHMENT');
|
||||
});
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { FindingSchema, SeveritySchema } from '@/schema/finding';
|
||||
|
||||
describe('FindingSchema', () => {
|
||||
it('parses a minimal valid finding', () => {
|
||||
const r = FindingSchema.safeParse({
|
||||
id: 'f_1',
|
||||
zones: ['z1'],
|
||||
severity: 'mild',
|
||||
});
|
||||
expect(r.success).toBe(true);
|
||||
if (r.success) {
|
||||
expect(r.data.linkedZones).toEqual([]);
|
||||
expect(r.data.pathologies).toEqual([]);
|
||||
expect(r.data.comment).toBe('');
|
||||
}
|
||||
});
|
||||
|
||||
it('requires at least one zone', () => {
|
||||
const r = FindingSchema.safeParse({
|
||||
id: 'f_1',
|
||||
zones: [],
|
||||
severity: 'mild',
|
||||
});
|
||||
expect(r.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects invalid severity', () => {
|
||||
const r = FindingSchema.safeParse({
|
||||
id: 'f_1',
|
||||
zones: ['z1'],
|
||||
severity: 'extreme',
|
||||
});
|
||||
expect(r.success).toBe(false);
|
||||
});
|
||||
|
||||
it('accepts free-text pathology entries', () => {
|
||||
const r = FindingSchema.safeParse({
|
||||
id: 'f_1',
|
||||
zones: ['z1'],
|
||||
severity: 'moderate',
|
||||
pathologies: [{ id: 'free_xyz', label: 'Sensibilité atypique', free: true }],
|
||||
});
|
||||
expect(r.success).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('SeveritySchema', () => {
|
||||
it('enumerates mild | moderate | severe', () => {
|
||||
expect(SeveritySchema.options).toEqual(['mild', 'moderate', 'severe']);
|
||||
});
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { ReportSchema, SCHEMA_VERSION } from '@/schema/report';
|
||||
|
||||
const sample = {
|
||||
version: 1 as const,
|
||||
id: 'r_abc123',
|
||||
createdAt: '2026-05-17T10:00:00.000Z',
|
||||
species: 'equine' as const,
|
||||
practitioner: {
|
||||
fullName: 'Dr. Doe',
|
||||
},
|
||||
animal: { name: 'Pégase', owner: 'Famille Martin' },
|
||||
sessionDate: '2026-05-17',
|
||||
findings: [],
|
||||
conclusion: '',
|
||||
recommendations: '',
|
||||
};
|
||||
|
||||
describe('ReportSchema', () => {
|
||||
it('exposes schema version 1', () => {
|
||||
expect(SCHEMA_VERSION).toBe(1);
|
||||
});
|
||||
|
||||
it('parses a valid sample', () => {
|
||||
const result = ReportSchema.safeParse(sample);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('rejects missing version', () => {
|
||||
const { version: _v, ...withoutVersion } = sample;
|
||||
const result = ReportSchema.safeParse(withoutVersion);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects unknown species', () => {
|
||||
const bad = { ...sample, species: 'dinosaur' };
|
||||
const result = ReportSchema.safeParse(bad);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects empty animal name', () => {
|
||||
const bad = { ...sample, animal: { name: '', owner: 'X' } };
|
||||
const result = ReportSchema.safeParse(bad);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it('accepts optional nextAppointment', () => {
|
||||
const withNext = { ...sample, nextAppointment: '2026-06-01' };
|
||||
const result = ReportSchema.safeParse(withNext);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
@@ -1,9 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { SCHEMA_VERSION } from '@/schema/report';
|
||||
|
||||
describe('scaffold smoke', () => {
|
||||
it('schema version is 1', () => {
|
||||
expect(SCHEMA_VERSION).toBe(1);
|
||||
});
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { EQUINE_ANATOMY } from '@/species/equine/anatomy';
|
||||
import { EQUINE_PATHOLOGIES } from '@/species/equine/pathologies';
|
||||
|
||||
describe('EQUINE_ANATOMY', () => {
|
||||
it('has vertebral formula C7 / T18 / L6 / S5', () => {
|
||||
expect(EQUINE_ANATOMY.vertebralFormula).toEqual({
|
||||
cervical: 7,
|
||||
thoracic: 18,
|
||||
lumbar: 6,
|
||||
sacral: 5,
|
||||
});
|
||||
});
|
||||
|
||||
it('declares the expected macro zones', () => {
|
||||
const ids = EQUINE_ANATOMY.zones.map((z) => z.id);
|
||||
for (const expected of [
|
||||
'neck',
|
||||
'withers',
|
||||
'thoracic-back',
|
||||
'lumbar',
|
||||
'sacrum',
|
||||
'shoulder-l',
|
||||
'shoulder-r',
|
||||
'hip-l',
|
||||
'hip-r',
|
||||
'tail',
|
||||
]) {
|
||||
expect(ids).toContain(expected);
|
||||
}
|
||||
});
|
||||
|
||||
it('thoracic-back has 18 subzones T1..T18', () => {
|
||||
const z = EQUINE_ANATOMY.zones.find((zz) => zz.id === 'thoracic-back');
|
||||
expect(z).toBeDefined();
|
||||
expect(z?.subzones).toHaveLength(18);
|
||||
expect(z?.subzones?.[0]?.id).toBe('T1');
|
||||
expect(z?.subzones?.[17]?.id).toBe('T18');
|
||||
});
|
||||
|
||||
it('every zone declares at least one view', () => {
|
||||
for (const z of EQUINE_ANATOMY.zones) {
|
||||
expect(z.views.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('EQUINE_PATHOLOGIES', () => {
|
||||
it('seeds at least 30 entries', () => {
|
||||
expect(EQUINE_PATHOLOGIES.length).toBeGreaterThanOrEqual(30);
|
||||
});
|
||||
|
||||
it('every entry cites at least one source', () => {
|
||||
for (const p of EQUINE_PATHOLOGIES) {
|
||||
expect(p.sources.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('every entry is applicable to equine', () => {
|
||||
for (const p of EQUINE_PATHOLOGIES) {
|
||||
expect(p.applicableSpecies).toContain('equine');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { getSpecies, isSpeciesAvailable } from '@/species';
|
||||
|
||||
describe('species registry', () => {
|
||||
it('equine is registered', () => {
|
||||
expect(isSpeciesAvailable('equine')).toBe(true);
|
||||
const pack = getSpecies('equine');
|
||||
expect(pack).toBeDefined();
|
||||
expect(pack?.anatomy.id).toBe('equine');
|
||||
expect(pack?.pathologies.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('non-MVP species are not available yet', () => {
|
||||
for (const id of ['chien', 'chat', 'lapin', 'bovin', 'chevre', 'ane', 'mouton', 'porc'] as const) {
|
||||
expect(isSpeciesAvailable(id)).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,94 +0,0 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import { emptyReport, useReportStore } from '@/state/reportStore';
|
||||
|
||||
beforeEach(() => {
|
||||
useReportStore.getState().reset();
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
describe('useReportStore', () => {
|
||||
it('starts empty', () => {
|
||||
const s = useReportStore.getState();
|
||||
expect(s.report).toBeNull();
|
||||
expect(s.selection).toEqual([]);
|
||||
});
|
||||
|
||||
it('hydrate sets report', () => {
|
||||
const r = emptyReport({ animal: { name: 'Pégase', owner: 'X' } });
|
||||
useReportStore.getState().hydrate(r);
|
||||
expect(useReportStore.getState().report?.animal.name).toBe('Pégase');
|
||||
});
|
||||
|
||||
it('toggleZone adds then removes', () => {
|
||||
const { toggleZone } = useReportStore.getState();
|
||||
toggleZone('z1');
|
||||
expect(useReportStore.getState().selection).toEqual(['z1']);
|
||||
toggleZone('z2');
|
||||
expect(useReportStore.getState().selection).toEqual(['z1', 'z2']);
|
||||
toggleZone('z1');
|
||||
expect(useReportStore.getState().selection).toEqual(['z2']);
|
||||
});
|
||||
|
||||
it('addFinding appends and clears selection', () => {
|
||||
useReportStore.getState().hydrate(emptyReport());
|
||||
useReportStore.getState().setSelection(['z1', 'z2']);
|
||||
const f = useReportStore.getState().addFinding({
|
||||
zones: ['z1', 'z2'],
|
||||
linkedZones: [],
|
||||
pathologies: [],
|
||||
severity: 'mild',
|
||||
comment: '',
|
||||
});
|
||||
expect(useReportStore.getState().report?.findings).toHaveLength(1);
|
||||
expect(useReportStore.getState().selection).toEqual([]);
|
||||
expect(f.id).toMatch(/^finding_/);
|
||||
});
|
||||
|
||||
it('updateFinding merges', () => {
|
||||
useReportStore.getState().hydrate(emptyReport());
|
||||
const f = useReportStore.getState().addFinding({
|
||||
zones: ['z1'],
|
||||
linkedZones: [],
|
||||
pathologies: [],
|
||||
severity: 'mild',
|
||||
comment: '',
|
||||
});
|
||||
useReportStore.getState().updateFinding(f.id, { severity: 'severe', comment: 'lourd' });
|
||||
const found = useReportStore.getState().report?.findings[0];
|
||||
expect(found?.severity).toBe('severe');
|
||||
expect(found?.comment).toBe('lourd');
|
||||
});
|
||||
|
||||
it('removeFinding removes by id', () => {
|
||||
useReportStore.getState().hydrate(emptyReport());
|
||||
const f = useReportStore.getState().addFinding({
|
||||
zones: ['z1'],
|
||||
linkedZones: [],
|
||||
pathologies: [],
|
||||
severity: 'mild',
|
||||
comment: '',
|
||||
});
|
||||
useReportStore.getState().removeFinding(f.id);
|
||||
expect(useReportStore.getState().report?.findings).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('setConclusion / setRecommendations / setNextAppointment', () => {
|
||||
useReportStore.getState().hydrate(emptyReport());
|
||||
useReportStore.getState().setConclusion('A');
|
||||
useReportStore.getState().setRecommendations('B');
|
||||
useReportStore.getState().setNextAppointment('2026-06-01');
|
||||
const r = useReportStore.getState().report;
|
||||
expect(r?.conclusion).toBe('A');
|
||||
expect(r?.recommendations).toBe('B');
|
||||
expect(r?.nextAppointment).toBe('2026-06-01');
|
||||
});
|
||||
|
||||
it('persists report to localStorage', () => {
|
||||
useReportStore.getState().hydrate(emptyReport({ animal: { name: 'X', owner: 'Y' } }));
|
||||
const raw = localStorage.getItem('osteo-report-draft');
|
||||
expect(raw).not.toBeNull();
|
||||
const parsed = JSON.parse(raw ?? '{}') as { state?: { report?: { animal?: { name?: string } } } };
|
||||
expect(parsed.state?.report?.animal?.name).toBe('X');
|
||||
});
|
||||
});
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Strict */
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
|
||||
/* Paths */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
},
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": ["src", "tests"]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.node.json" },
|
||||
{ "path": "./tsconfig.app.json" }
|
||||
]
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2022"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"types": ["node"],
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Strict */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"include": ["vite.config.ts", "vitest.config.ts", "playwright.config.ts", "eslint.config.js"]
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'node:path';
|
||||
import { defineConfig } from 'vite';
|
||||
import svgr from 'vite-plugin-svgr';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react(), svgr(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(import.meta.dirname, 'src'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
},
|
||||
build: {
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
vendor: ['react', 'react-dom', 'react-router-dom'],
|
||||
pdf: ['pdf-lib'],
|
||||
motion: ['motion'],
|
||||
ui: ['lucide-react', 'class-variance-authority', 'clsx', 'tailwind-merge'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user