docs(docs): restore 2026-05 design specs and plans under docs/history
Purged from docs/superpowers by the gitflow finish of step 1 (BDR-065); that path is purged at every finish, so the records live under docs/history/superpowers/ instead. References updated.
This commit is contained in:
1 parent
8673475293
commit
02052f3622
12 files changed
+8581
-3
No files matched your search
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,738 @@
|
||||
# Laterality Support Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Add bilateral/unpaired laterality to anatomical zones so practitioners can specify left/right side on bilateral structures.
|
||||
|
||||
**Architecture:** New `data-anno-lateral` SVG attribute parsed into `Bone.lateral`. New `side` field on `ObservationZone` schema. LateralityPicker modal triggered on bilateral zone clicks. Side displayed in zone badges and PDF output. SVG editor gets a laterality dropdown.
|
||||
|
||||
**Tech Stack:** React 19, TypeScript strict, Zustand 5, Zod 3, Tailwind v4, pdf-lib, vitest
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Schema + Bone Type — Add `side` to ObservationZone and `lateral` to Bone
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/domain/schema/observation.ts`
|
||||
- Modify: `src/anatomy/types.ts`
|
||||
- Test: `tests/unit/schema.observation.test.ts`
|
||||
|
||||
- [ ] **Step 1: Write failing tests for LateralSideSchema and side field**
|
||||
|
||||
Add to `tests/unit/schema.observation.test.ts`:
|
||||
|
||||
```ts
|
||||
import {
|
||||
ObservationSchema,
|
||||
ObservationZoneSchema,
|
||||
LateralSideSchema,
|
||||
VertebraSchema,
|
||||
SeveritySchema,
|
||||
FindingSchema,
|
||||
} from '@/domain/schema/observation'
|
||||
|
||||
describe('LateralSideSchema', () => {
|
||||
it('accepts left and right', () => {
|
||||
expect(LateralSideSchema.parse('left')).toBe('left')
|
||||
expect(LateralSideSchema.parse('right')).toBe('right')
|
||||
})
|
||||
|
||||
it('rejects unknown side', () => {
|
||||
expect(() => LateralSideSchema.parse('both')).toThrow()
|
||||
expect(() => LateralSideSchema.parse('')).toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
describe('ObservationZoneSchema with side', () => {
|
||||
it('accepts a zone without side (unpaired)', () => {
|
||||
expect(() => ObservationZoneSchema.parse({ boneId: 'sternum' })).not.toThrow()
|
||||
})
|
||||
|
||||
it('accepts a zone with side left', () => {
|
||||
const parsed = ObservationZoneSchema.parse({ boneId: 'knee', side: 'left' })
|
||||
expect(parsed.side).toBe('left')
|
||||
})
|
||||
|
||||
it('accepts a zone with side right', () => {
|
||||
const parsed = ObservationZoneSchema.parse({ boneId: 'knee', side: 'right' })
|
||||
expect(parsed.side).toBe('right')
|
||||
})
|
||||
|
||||
it('accepts two zones with same boneId but different sides', () => {
|
||||
const obs = {
|
||||
id: 'obs-1',
|
||||
zones: [
|
||||
{ boneId: 'knee', side: 'left' },
|
||||
{ boneId: 'knee', side: 'right' },
|
||||
],
|
||||
findings: [],
|
||||
freeTextFindings: [],
|
||||
comment: '',
|
||||
}
|
||||
expect(() => ObservationSchema.parse(obs)).not.toThrow()
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run tests to verify they fail**
|
||||
|
||||
Run: `pnpm test:run -- tests/unit/schema.observation.test.ts`
|
||||
Expected: FAIL — `LateralSideSchema` is not exported
|
||||
|
||||
- [ ] **Step 3: Add LateralSideSchema and side field to observation.ts**
|
||||
|
||||
In `src/domain/schema/observation.ts`, add after the `VertebraSchema` definition:
|
||||
|
||||
```ts
|
||||
export const LateralSideSchema = z.enum(['left', 'right'])
|
||||
|
||||
export type LateralSide = z.infer<typeof LateralSideSchema>
|
||||
```
|
||||
|
||||
Add `side` to `ObservationZoneSchema`:
|
||||
|
||||
```ts
|
||||
export const ObservationZoneSchema = z.object({
|
||||
boneId: z.string().min(1),
|
||||
detailSourceId: z.string().optional(),
|
||||
vertebrae: z.array(VertebraSchema).optional(),
|
||||
side: LateralSideSchema.optional(),
|
||||
})
|
||||
```
|
||||
|
||||
- [ ] **Step 4: Add `lateral` field to Bone interface**
|
||||
|
||||
In `src/anatomy/types.ts`, add to `Bone` interface after `special?`:
|
||||
|
||||
```ts
|
||||
lateral?: 'bilateral' | 'unpaired'
|
||||
```
|
||||
|
||||
- [ ] **Step 5: Run tests to verify they pass**
|
||||
|
||||
Run: `pnpm test:run -- tests/unit/schema.observation.test.ts`
|
||||
Expected: ALL PASS
|
||||
|
||||
- [ ] **Step 6: Run full typecheck**
|
||||
|
||||
Run: `pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 7: Commit**
|
||||
|
||||
```bash
|
||||
git add src/domain/schema/observation.ts src/anatomy/types.ts tests/unit/schema.observation.test.ts
|
||||
git commit -m "feat(schema): add LateralSideSchema and Bone.lateral for laterality support"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: SVG Parser — Read `data-anno-lateral` attribute
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/anatomy/svgConvention.ts`
|
||||
- Test: `tests/unit/anatomy.svgConvention.test.ts`
|
||||
|
||||
- [ ] **Step 1: Write failing tests for lateral parsing**
|
||||
|
||||
Add to `tests/unit/anatomy.svgConvention.test.ts`, update the `FIXTURE` and add tests:
|
||||
|
||||
Update `FIXTURE` — add a bilateral element:
|
||||
|
||||
```xml
|
||||
<circle data-anno-id="point-knee" data-anno-name-fr="Genou" data-anno-name-en="Knee"
|
||||
data-anno-category="articulations" data-anno-lateral="bilateral" />
|
||||
```
|
||||
|
||||
Add tests:
|
||||
|
||||
```ts
|
||||
it('captures data-anno-lateral when present', () => {
|
||||
const map = parseSvgBones(svgFromString(FIXTURE))
|
||||
expect(map.get('point-knee')?.lateral).toBe('bilateral')
|
||||
})
|
||||
|
||||
it('leaves lateral undefined when attribute absent', () => {
|
||||
const map = parseSvgBones(svgFromString(FIXTURE))
|
||||
expect(map.get('point-shoulder')?.lateral).toBeUndefined()
|
||||
})
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run tests to verify they fail**
|
||||
|
||||
Run: `pnpm test:run -- tests/unit/anatomy.svgConvention.test.ts`
|
||||
Expected: FAIL — `lateral` is undefined for knee
|
||||
|
||||
- [ ] **Step 3: Update parseSvgBones to read data-anno-lateral**
|
||||
|
||||
In `src/anatomy/svgConvention.ts`, in `parseSvgBones()`, add after the `special` read:
|
||||
|
||||
```ts
|
||||
const lateral = el.getAttribute('data-anno-lateral') as
|
||||
| 'bilateral'
|
||||
| 'unpaired'
|
||||
| undefined ?? undefined
|
||||
```
|
||||
|
||||
In the `else` branch (new Bone creation), add `lateral` to the object:
|
||||
|
||||
```ts
|
||||
map.set(id, {
|
||||
id,
|
||||
fr,
|
||||
en,
|
||||
category,
|
||||
opensDetail,
|
||||
special,
|
||||
lateral,
|
||||
els: [el],
|
||||
})
|
||||
```
|
||||
|
||||
In the `existing` merge branch, add:
|
||||
|
||||
```ts
|
||||
if (lateral && !existing.lateral) {
|
||||
existing.lateral = lateral
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 4: Run tests to verify they pass**
|
||||
|
||||
Run: `pnpm test:run -- tests/unit/anatomy.svgConvention.test.ts`
|
||||
Expected: ALL PASS
|
||||
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
```bash
|
||||
git add src/anatomy/svgConvention.ts tests/unit/anatomy.svgConvention.test.ts
|
||||
git commit -m "feat(anatomy): parse data-anno-lateral attribute from SVG"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 3: i18n — Add laterality translation keys
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/i18n/fr.ts`
|
||||
- Modify: `src/i18n/en.ts`
|
||||
- Test: `tests/unit/i18n.dicts.test.ts` (existing test verifies key parity)
|
||||
|
||||
- [ ] **Step 1: Add keys to fr.ts**
|
||||
|
||||
Add after the vertebra section in `src/i18n/fr.ts`:
|
||||
|
||||
```ts
|
||||
// laterality
|
||||
'lateral.which_side': 'Quel côté ?',
|
||||
'lateral.left': 'Gauche',
|
||||
'lateral.right': 'Droite',
|
||||
'lateral.both': 'Les deux',
|
||||
'lateral.left_short': 'G',
|
||||
'lateral.right_short': 'D',
|
||||
'lateral.bilateral': 'Bilatéral',
|
||||
'lateral.unpaired': 'Impair',
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Add keys to en.ts**
|
||||
|
||||
Add after the vertebra section in `src/i18n/en.ts`:
|
||||
|
||||
```ts
|
||||
// laterality
|
||||
'lateral.which_side': 'Which side?',
|
||||
'lateral.left': 'Left',
|
||||
'lateral.right': 'Right',
|
||||
'lateral.both': 'Both',
|
||||
'lateral.left_short': 'L',
|
||||
'lateral.right_short': 'R',
|
||||
'lateral.bilateral': 'Bilateral',
|
||||
'lateral.unpaired': 'Unpaired',
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Run i18n key parity test**
|
||||
|
||||
Run: `pnpm test:run -- tests/unit/i18n.dicts.test.ts`
|
||||
Expected: PASS (both dicts have same keys)
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add src/i18n/fr.ts src/i18n/en.ts
|
||||
git commit -m "feat(i18n): add laterality translation keys (FR/EN)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 4: LateralityPicker Component
|
||||
|
||||
**Files:**
|
||||
- Create: `src/components/observation/LateralityPicker.tsx`
|
||||
|
||||
- [ ] **Step 1: Create LateralityPicker component**
|
||||
|
||||
Create `src/components/observation/LateralityPicker.tsx`:
|
||||
|
||||
```tsx
|
||||
import Dialog from '@/components/ui/Dialog'
|
||||
import Button from '@/components/ui/Button'
|
||||
import type { LateralSide } from '@/domain/schema/observation'
|
||||
import { useT } from '@/i18n/useT'
|
||||
|
||||
export interface LateralityPickerProps {
|
||||
open: boolean
|
||||
onClose: () => void
|
||||
onSelect: (sides: LateralSide[]) => void
|
||||
title: string
|
||||
/** Sides already present in the active observation for this boneId. */
|
||||
existingSides: LateralSide[]
|
||||
}
|
||||
|
||||
export default function LateralityPicker({
|
||||
open,
|
||||
onClose,
|
||||
onSelect,
|
||||
title,
|
||||
existingSides,
|
||||
}: LateralityPickerProps) {
|
||||
const t = useT()
|
||||
const hasLeft = existingSides.includes('left')
|
||||
const hasRight = existingSides.includes('right')
|
||||
|
||||
return (
|
||||
<Dialog open={open} onClose={onClose} title={title} size="sm">
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t('lateral.which_side')}
|
||||
</p>
|
||||
<div className="flex gap-3 justify-center">
|
||||
<Button
|
||||
variant={hasLeft ? 'ghost' : 'default'}
|
||||
disabled={hasLeft}
|
||||
onClick={() => onSelect(['left'])}
|
||||
>
|
||||
{t('lateral.left')}
|
||||
</Button>
|
||||
<Button
|
||||
variant={hasRight ? 'ghost' : 'default'}
|
||||
disabled={hasRight}
|
||||
onClick={() => onSelect(['right'])}
|
||||
>
|
||||
{t('lateral.right')}
|
||||
</Button>
|
||||
<Button
|
||||
variant={hasLeft && hasRight ? 'ghost' : 'default'}
|
||||
disabled={hasLeft && hasRight}
|
||||
onClick={() => {
|
||||
const sides: LateralSide[] = []
|
||||
if (!hasLeft) sides.push('left')
|
||||
if (!hasRight) sides.push('right')
|
||||
onSelect(sides)
|
||||
}}
|
||||
>
|
||||
{t('lateral.both')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run typecheck**
|
||||
|
||||
Run: `pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/observation/LateralityPicker.tsx
|
||||
git commit -m "feat(ui): add LateralityPicker modal component"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 5: EditorRoute — Integrate LateralityPicker into zone click flow
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/app/routes/EditorRoute.tsx`
|
||||
|
||||
- [ ] **Step 1: Add laterality state and imports**
|
||||
|
||||
Add imports at top of `EditorRoute.tsx`:
|
||||
|
||||
```ts
|
||||
import LateralityPicker from '@/components/observation/LateralityPicker'
|
||||
import type { LateralSide } from '@/domain/schema/observation'
|
||||
```
|
||||
|
||||
Add state after `vertebraTarget` state:
|
||||
|
||||
```ts
|
||||
const [lateralTarget, setLateralTarget] = useState<{
|
||||
boneId: string
|
||||
detailSourceId?: string
|
||||
} | null>(null)
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Modify onZoneClick to handle bilateral zones**
|
||||
|
||||
In `onZoneClick()`, after the `vertebral-precision` block and before the unpaired toggle logic, add:
|
||||
|
||||
```ts
|
||||
if (bone.lateral === 'bilateral') {
|
||||
setLateralTarget({
|
||||
boneId,
|
||||
...(detailSourceId ? { detailSourceId } : {}),
|
||||
})
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Add LateralityPicker to JSX**
|
||||
|
||||
Add before the closing `</main>` tag, after the VertebraPicker block:
|
||||
|
||||
```tsx
|
||||
{lateralTarget && activeObs && (
|
||||
<LateralityPicker
|
||||
open
|
||||
onClose={() => setLateralTarget(null)}
|
||||
title={boneLabel(
|
||||
allBones.get(lateralTarget.boneId),
|
||||
locale,
|
||||
lateralTarget.boneId,
|
||||
)}
|
||||
existingSides={
|
||||
activeObs.zones
|
||||
.filter(
|
||||
(z) =>
|
||||
z.boneId === lateralTarget.boneId &&
|
||||
z.detailSourceId === lateralTarget.detailSourceId &&
|
||||
z.side,
|
||||
)
|
||||
.map((z) => z.side!) as LateralSide[]
|
||||
}
|
||||
onSelect={(sides) => {
|
||||
const fresh =
|
||||
useReportStore.getState().report?.observations[activeIndex]
|
||||
if (!fresh) {
|
||||
setLateralTarget(null)
|
||||
return
|
||||
}
|
||||
let nextZones = [...fresh.zones]
|
||||
for (const side of sides) {
|
||||
const exists = nextZones.some(
|
||||
(z) =>
|
||||
z.boneId === lateralTarget.boneId &&
|
||||
z.detailSourceId === lateralTarget.detailSourceId &&
|
||||
z.side === side,
|
||||
)
|
||||
if (!exists) {
|
||||
nextZones.push({
|
||||
boneId: lateralTarget.boneId,
|
||||
...(lateralTarget.detailSourceId
|
||||
? { detailSourceId: lateralTarget.detailSourceId }
|
||||
: {}),
|
||||
side,
|
||||
})
|
||||
}
|
||||
}
|
||||
updateObservation(activeIndex, { ...fresh, zones: nextZones })
|
||||
setLateralTarget(null)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
```
|
||||
|
||||
- [ ] **Step 4: Handle re-click toggle for bilateral zones**
|
||||
|
||||
The current flow in `onZoneClick` for the bilateral case:
|
||||
- If both sides already exist → remove both (toggle off)
|
||||
- If one or zero sides → open picker
|
||||
|
||||
Update the bilateral block:
|
||||
|
||||
```ts
|
||||
if (bone.lateral === 'bilateral') {
|
||||
const sidesPresent = activeObs.zones
|
||||
.filter(
|
||||
(z) =>
|
||||
z.boneId === boneId &&
|
||||
z.detailSourceId === detailSourceId,
|
||||
)
|
||||
.map((z) => z.side)
|
||||
.filter(Boolean) as LateralSide[]
|
||||
|
||||
if (sidesPresent.includes('left') && sidesPresent.includes('right')) {
|
||||
const nextZones = activeObs.zones.filter(
|
||||
(z) =>
|
||||
!(z.boneId === boneId && z.detailSourceId === detailSourceId),
|
||||
)
|
||||
updateObservation(activeIndex, { ...activeObs, zones: nextZones })
|
||||
return
|
||||
}
|
||||
|
||||
setLateralTarget({
|
||||
boneId,
|
||||
...(detailSourceId ? { detailSourceId } : {}),
|
||||
})
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 5: Run typecheck**
|
||||
|
||||
Run: `pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 6: Commit**
|
||||
|
||||
```bash
|
||||
git add src/app/routes/EditorRoute.tsx
|
||||
git commit -m "feat(editor): integrate LateralityPicker in zone click flow"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 6: ObservationCard — Display side in zone badges
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/observation/ObservationCard.tsx`
|
||||
|
||||
- [ ] **Step 1: Update describeZone to show side suffix**
|
||||
|
||||
In `ObservationCard.tsx`, update the `describeZone` function:
|
||||
|
||||
```ts
|
||||
function describeZone(
|
||||
z: ObservationZone,
|
||||
bones: Map<string, Bone>,
|
||||
locale: Locale,
|
||||
t: (key: string) => string,
|
||||
): string {
|
||||
const label = boneLabel(bones.get(z.boneId), locale, z.boneId)
|
||||
if (z.vertebrae?.length) {
|
||||
const vs = z.vertebrae
|
||||
.map((v: Vertebra) => `${v.region}${v.index}`)
|
||||
.join(', ')
|
||||
return `${label} (${vs})`
|
||||
}
|
||||
if (z.side) {
|
||||
const sideLabel = t(
|
||||
z.side === 'left' ? 'lateral.left_short' : 'lateral.right_short',
|
||||
)
|
||||
return `${label} (${sideLabel})`
|
||||
}
|
||||
return label
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update describeZone call sites to pass t**
|
||||
|
||||
In the JSX, update the two places `describeZone` is called:
|
||||
|
||||
In the zone badges list:
|
||||
```tsx
|
||||
{describeZone(z, bones, locale, t)}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Run typecheck**
|
||||
|
||||
Run: `pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/observation/ObservationCard.tsx
|
||||
git commit -m "feat(ui): display laterality side in zone badges"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 7: PDF Output — Include side in zone labels
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/pdf/render/observationPage.ts`
|
||||
|
||||
- [ ] **Step 1: Update zone label rendering**
|
||||
|
||||
In `addObservationPage()`, find the `zonesText` construction (around line 369-379). Update to include side:
|
||||
|
||||
```ts
|
||||
const zonesText = observation.zones
|
||||
.map((z) => {
|
||||
const pair = zoneLabels.get(z.boneId)
|
||||
const label = pair
|
||||
? (locale === 'en' ? pair.en || pair.fr : pair.fr || pair.en) || z.boneId
|
||||
: z.boneId
|
||||
const v = z.vertebrae?.length
|
||||
? ` (${z.vertebrae.map((x) => `${x.region}${x.index}`).join(', ')})`
|
||||
: ''
|
||||
const side = z.side
|
||||
? ` (${dict[z.side === 'left' ? 'lateral.left' : 'lateral.right']})`
|
||||
: ''
|
||||
return `${label}${v}${side}`
|
||||
})
|
||||
.join(' · ')
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run typecheck**
|
||||
|
||||
Run: `pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/pdf/render/observationPage.ts
|
||||
git commit -m "feat(pdf): include laterality side in zone labels"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 8: SVG Editor — Add laterality dropdown
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/app/routes/SvgEditorRoute.tsx`
|
||||
- Modify: `src/i18n/fr.ts`
|
||||
- Modify: `src/i18n/en.ts`
|
||||
|
||||
- [ ] **Step 1: Add SVG editor i18n keys**
|
||||
|
||||
In `src/i18n/fr.ts`, add:
|
||||
|
||||
```ts
|
||||
'svg_editor.lateral': 'Latéralité',
|
||||
'svg_editor.lateral_unpaired': 'Impair (pas de côté)',
|
||||
'svg_editor.lateral_bilateral': 'Bilatéral (gauche / droite)',
|
||||
```
|
||||
|
||||
In `src/i18n/en.ts`, add:
|
||||
|
||||
```ts
|
||||
'svg_editor.lateral': 'Laterality',
|
||||
'svg_editor.lateral_unpaired': 'Unpaired (no side)',
|
||||
'svg_editor.lateral_bilateral': 'Bilateral (left / right)',
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Add dropdown to SvgEditorRoute JSX**
|
||||
|
||||
In `SvgEditorRoute.tsx`, inside the `svg-editor-osteo-fields` div, after the category `<select>`, add:
|
||||
|
||||
```tsx
|
||||
<label>{t('svg_editor.lateral')}</label>
|
||||
<select id="svg-editor-edit-lateral">
|
||||
<option value="">{t('svg_editor.lateral_unpaired')}</option>
|
||||
<option value="bilateral">{t('svg_editor.lateral_bilateral')}</option>
|
||||
</select>
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Wire up event listener in initSvgEditor**
|
||||
|
||||
In `setupGlobalListeners()`, add the lateral select to the change listener array:
|
||||
|
||||
```ts
|
||||
;['svg-editor-edit-fr', 'svg-editor-edit-en', 'svg-editor-edit-category', 'svg-editor-edit-lateral'].forEach(
|
||||
(id) => {
|
||||
getEl(id).addEventListener('change', applyEdit, sig)
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
- [ ] **Step 4: Read lateral in showEditPanel**
|
||||
|
||||
In `showEditPanel()`, after reading category, add:
|
||||
|
||||
```ts
|
||||
;(getEl('svg-editor-edit-lateral') as HTMLSelectElement).value =
|
||||
svgEl.getAttribute('data-anno-lateral') || ''
|
||||
```
|
||||
|
||||
- [ ] **Step 5: Write lateral in applyEdit**
|
||||
|
||||
In `applyEdit()`, after reading `cat`, add:
|
||||
|
||||
```ts
|
||||
const lateral = (getEl('svg-editor-edit-lateral') as HTMLSelectElement).value
|
||||
```
|
||||
|
||||
In the siblings loop, inside the non-opens-detail branch (where `data-anno-name-fr` etc. are set), add after the special attribute logic:
|
||||
|
||||
```ts
|
||||
if (lateral) {
|
||||
s.setAttribute('data-anno-lateral', lateral)
|
||||
} else {
|
||||
s.removeAttribute('data-anno-lateral')
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 6: Propagate lateral when creating new elements**
|
||||
|
||||
In `addCircleAt()`, after setting `data-anno-special` on both `hit` and `vis`, add for each:
|
||||
|
||||
```ts
|
||||
if (CATEGORIES[cat]?.lateral) hit.setAttribute('data-anno-lateral', CATEGORIES[cat].lateral!)
|
||||
```
|
||||
|
||||
Wait — categories don't carry lateral. Lateral is per-element, not per-category. New elements start as unpaired (no attribute). The user sets it via the edit panel. No change needed for addCircleAt/finalizePolygon.
|
||||
|
||||
- [ ] **Step 7: Run typecheck and i18n test**
|
||||
|
||||
Run: `pnpm typecheck && pnpm test:run -- tests/unit/i18n.dicts.test.ts`
|
||||
Expected: No errors, i18n parity PASS
|
||||
|
||||
- [ ] **Step 8: Commit**
|
||||
|
||||
```bash
|
||||
git add src/app/routes/SvgEditorRoute.tsx src/i18n/fr.ts src/i18n/en.ts
|
||||
git commit -m "feat(editor): add laterality dropdown to SVG editor"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 9: Documentation — Update ANATOMY-SVG-CONVENTION.md
|
||||
|
||||
**Files:**
|
||||
- Modify: `docs/ANATOMY-SVG-CONVENTION.md`
|
||||
|
||||
- [ ] **Step 1: Add data-anno-lateral to optional attributes table**
|
||||
|
||||
In the "Optional data attributes" table, add a row:
|
||||
|
||||
```markdown
|
||||
| `data-anno-lateral` | `string` | Laterality hint: `bilateral` (zone has left/right instances, e.g. knee) or `unpaired` (no laterality). Default when absent: `unpaired`. Used by the report editor to prompt side selection on bilateral zones. |
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add docs/ANATOMY-SVG-CONVENTION.md
|
||||
git commit -m "docs(anatomy): document data-anno-lateral attribute"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 10: Full Verification
|
||||
|
||||
- [ ] **Step 1: Run full test suite**
|
||||
|
||||
Run: `pnpm test:run`
|
||||
Expected: ALL PASS
|
||||
|
||||
- [ ] **Step 2: Run typecheck**
|
||||
|
||||
Run: `pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 3: Run lint**
|
||||
|
||||
Run: `pnpm lint`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 4: Build**
|
||||
|
||||
Run: `pnpm build`
|
||||
Expected: Build succeeds
|
||||
@@ -0,0 +1,760 @@
|
||||
# Responsive Mobile Fixes — Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Make Faunosteo SPA fully usable on phone screens (375px+) and polished on tablets (768px+) via surgical CSS/className-only changes.
|
||||
|
||||
**Architecture:** No behavior changes — pure Tailwind class and CSS media query updates across ~12 files. No store, schema, or PDF changes. Existing tests must stay green since only visual layout changes.
|
||||
|
||||
**Tech Stack:** Tailwind CSS v4 (CSS-first), React 19, existing component library
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Dialog viewport clamping
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/ui/Dialog.tsx`
|
||||
|
||||
- [ ] **Step 1: Update Dialog SIZE map and container classes**
|
||||
|
||||
In `src/components/ui/Dialog.tsx`, replace the SIZE constant and the dialog container/content classes:
|
||||
|
||||
```tsx
|
||||
const SIZE: Record<NonNullable<DialogProps['size']>, string> = {
|
||||
sm: 'max-w-sm',
|
||||
md: 'max-w-md',
|
||||
lg: 'max-w-2xl',
|
||||
xl: 'max-w-4xl',
|
||||
}
|
||||
```
|
||||
|
||||
with:
|
||||
|
||||
```tsx
|
||||
const SIZE: Record<NonNullable<DialogProps['size']>, string> = {
|
||||
sm: 'max-w-sm max-w-[calc(100vw-2rem)]',
|
||||
md: 'max-w-md max-w-[calc(100vw-2rem)]',
|
||||
lg: 'max-w-2xl max-w-[calc(100vw-2rem)]',
|
||||
xl: 'max-w-4xl max-w-[calc(100vw-2rem)]',
|
||||
}
|
||||
```
|
||||
|
||||
Note: Tailwind applies the last matching utility — `max-w-[calc(100vw-2rem)]` wins on small screens where the named max-width exceeds viewport, and the named max-width wins on large screens where it's smaller. Actually, this won't work — Tailwind just uses specificity/order. Need a different approach.
|
||||
|
||||
Instead, add the viewport clamp directly on the motion.div alongside the SIZE class. Change:
|
||||
|
||||
```tsx
|
||||
className={`relative w-full ${SIZE[size]} max-h-[90vh] overflow-y-auto rounded-2xl bg-[var(--color-surface)] shadow-xl`}
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
className={`relative w-full ${SIZE[size]} max-h-[85vh] overflow-y-auto rounded-2xl bg-[var(--color-surface)] shadow-xl`}
|
||||
```
|
||||
|
||||
And change the outer container padding from:
|
||||
|
||||
```tsx
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4">
|
||||
```
|
||||
|
||||
And change the dialog header padding from:
|
||||
|
||||
```tsx
|
||||
<header className="flex items-center justify-between px-6 py-4 border-b border-[var(--color-border)]">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<header className="flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-[var(--color-border)]">
|
||||
```
|
||||
|
||||
And change the dialog body padding from:
|
||||
|
||||
```tsx
|
||||
<div className="px-6 py-4">{children}</div>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="px-4 sm:px-6 py-3 sm:py-4">{children}</div>
|
||||
```
|
||||
|
||||
The key fix: since all sizes already use `w-full` with `max-w-*`, the dialog box naturally fills available width minus padding. Reducing container padding from `p-4` to `p-3` on small screens gives 6px more breathing room per side. The `max-w-sm` (384px) fits within 375px - 24px = 351px viewport on phones (it doesn't — 384 > 351). The real fix is that `w-full` makes the dialog width = container width = viewport - 2*padding, so the max-w-* values are upper caps that only kick in when there's room.
|
||||
|
||||
Wait — `w-full` with `max-w-md` means the dialog takes min(100%, 448px). On a 375px phone with p-3 (12px each side), available width = 375 - 24 = 351px. `w-full` = 351px which is < 448px, so dialog = 351px. This already works correctly. No extra `max-w-[calc(...)]` needed. The existing `w-full` + `max-w-*` pattern is responsive by design.
|
||||
|
||||
So the actual changes are: tighten padding for mobile comfort + reduce max-h for better mobile viewport fit.
|
||||
|
||||
- [ ] **Step 2: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass (no behavior change)
|
||||
|
||||
- [ ] **Step 3: Run typecheck**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/ui/Dialog.tsx
|
||||
git commit -m "fix(ui): responsive dialog — tighter mobile padding and max-height"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: Button touch targets
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/ui/Button.tsx`
|
||||
|
||||
- [ ] **Step 1: Update SIZES to ensure mobile-friendly touch targets**
|
||||
|
||||
In `src/components/ui/Button.tsx`, change the SIZES constant from:
|
||||
|
||||
```tsx
|
||||
const SIZES: Record<NonNullable<ButtonProps['size']>, string> = {
|
||||
sm: 'h-8 px-3 text-sm rounded-md',
|
||||
md: 'h-10 px-4 text-base rounded-lg',
|
||||
lg: 'h-12 px-6 text-base rounded-lg',
|
||||
}
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
const SIZES: Record<NonNullable<ButtonProps['size']>, string> = {
|
||||
sm: 'h-9 px-3 text-sm rounded-md',
|
||||
md: 'h-10 px-4 text-sm sm:text-base rounded-lg',
|
||||
lg: 'h-12 px-5 sm:px-6 text-base rounded-lg',
|
||||
}
|
||||
```
|
||||
|
||||
Changes:
|
||||
- `sm`: `h-8` → `h-9` (36px, closer to 44px minimum)
|
||||
- `md`: add responsive text `text-sm sm:text-base`
|
||||
- `lg`: tighter padding on mobile `px-5 sm:px-6`
|
||||
|
||||
- [ ] **Step 2: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/ui/Button.tsx
|
||||
git commit -m "fix(ui): increase button sm touch target to 36px, responsive text sizing"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 3: VertebraPicker touch targets
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/observation/VertebraPicker.tsx`
|
||||
|
||||
- [ ] **Step 1: Increase region tab touch targets**
|
||||
|
||||
In `src/components/observation/VertebraPicker.tsx`, change the region tab button className from:
|
||||
|
||||
```tsx
|
||||
'rounded-full px-4 py-1.5 text-sm font-medium border',
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
'rounded-full px-4 py-2.5 sm:py-1.5 text-sm font-medium border min-h-[2.75rem]',
|
||||
```
|
||||
|
||||
This ensures 44px minimum height on mobile (py-2.5 = 10px top+bottom + text ≈ 44px), drops back to denser on desktop.
|
||||
|
||||
- [ ] **Step 2: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/observation/VertebraPicker.tsx
|
||||
git commit -m "fix(ui): vertebra picker region tabs — 44px touch target on mobile"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 4: SVG editor sidebar responsive stacking
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/styles/svg-editor.css`
|
||||
|
||||
- [ ] **Step 1: Add media query for sidebar stacking**
|
||||
|
||||
In `src/styles/svg-editor.css`, change the `.svg-editor-root` rule from:
|
||||
|
||||
```css
|
||||
.svg-editor-root {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
font-family: var(--font-sans);
|
||||
color: var(--color-ink);
|
||||
background: var(--color-bg);
|
||||
}
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```css
|
||||
.svg-editor-root {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
font-family: var(--font-sans);
|
||||
color: var(--color-ink);
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.svg-editor-root {
|
||||
flex-direction: row;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then change the `.svg-editor-sidebar` rule from:
|
||||
|
||||
```css
|
||||
.svg-editor-sidebar {
|
||||
width: 380px;
|
||||
background: var(--color-surface);
|
||||
border-left: 1px solid var(--color-border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```css
|
||||
.svg-editor-sidebar {
|
||||
width: 100%;
|
||||
background: var(--color-surface);
|
||||
border-top: 1px solid var(--color-border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
max-height: 50vh;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.svg-editor-sidebar {
|
||||
width: 380px;
|
||||
max-height: none;
|
||||
border-top: none;
|
||||
border-left: 1px solid var(--color-border);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Also update `.svg-editor-canvas` to ensure minimum usable height on mobile by changing:
|
||||
|
||||
```css
|
||||
.svg-editor-canvas {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
background: var(--color-surface);
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
}
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```css
|
||||
.svg-editor-canvas {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
background: var(--color-surface);
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
min-height: 40vh;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.svg-editor-canvas {
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Also update the zoom controls for mobile — make buttons bigger:
|
||||
|
||||
```css
|
||||
.svg-editor-zoom-controls button {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```css
|
||||
.svg-editor-zoom-controls button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.svg-editor-zoom-controls button {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run typecheck and build**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm typecheck && ~/.local/share/pnpm/bin/pnpm build`
|
||||
Expected: Clean
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/styles/svg-editor.css
|
||||
git commit -m "fix(ui): SVG editor sidebar stacks below canvas on mobile (<768px)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 5: AnatomyCanvas height constraint + EditorRoute responsive
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/canvas/AnatomyCanvas.tsx`
|
||||
- Modify: `src/app/routes/EditorRoute.tsx`
|
||||
|
||||
- [ ] **Step 1: Add responsive classes to AnatomyCanvas wrapper**
|
||||
|
||||
In `src/components/canvas/AnatomyCanvas.tsx`, change the wrapper div from:
|
||||
|
||||
```tsx
|
||||
<div
|
||||
data-testid="anatomy-canvas"
|
||||
ref={wrapperRef}
|
||||
className={`svg-canvas relative w-full h-full ${className}`}
|
||||
>
|
||||
<div ref={svgRef} className="w-full h-full" />
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div
|
||||
data-testid="anatomy-canvas"
|
||||
ref={wrapperRef}
|
||||
className={`svg-canvas relative w-full h-full ${className}`}
|
||||
>
|
||||
<div ref={svgRef} className="w-full h-full [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:mx-auto" />
|
||||
```
|
||||
|
||||
This ensures the SVG inside doesn't overflow and centers horizontally.
|
||||
|
||||
- [ ] **Step 2: Update EditorRoute grid layout for mobile**
|
||||
|
||||
In `src/app/routes/EditorRoute.tsx`, change the main grid container from:
|
||||
|
||||
```tsx
|
||||
<div className="flex-1 grid grid-cols-1 lg:grid-cols-[2fr_3fr] gap-6 p-6">
|
||||
<section className="border border-[var(--color-border)] rounded-2xl bg-[var(--color-surface)] overflow-hidden">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="flex-1 grid grid-cols-1 lg:grid-cols-[2fr_3fr] gap-4 sm:gap-6 p-4 sm:p-6">
|
||||
<section className="border border-[var(--color-border)] rounded-2xl bg-[var(--color-surface)] overflow-hidden max-h-[55vh] lg:max-h-none">
|
||||
```
|
||||
|
||||
The `max-h-[55vh] lg:max-h-none` constrains the SVG canvas on mobile/tablet (single-column) so the observation list is visible without scrolling past the entire SVG. On desktop (lg+, two-column), it fills naturally.
|
||||
|
||||
Also change the observations section from:
|
||||
|
||||
```tsx
|
||||
<section className="space-y-6">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<section className="space-y-4 sm:space-y-6">
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 4: Run typecheck**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm typecheck`
|
||||
Expected: No errors
|
||||
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/canvas/AnatomyCanvas.tsx src/app/routes/EditorRoute.tsx
|
||||
git commit -m "fix(ui): constrain anatomy canvas height on mobile, responsive editor spacing"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 6: Responsive typography and padding — HomeRoute + EditorsRoute
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/app/routes/HomeRoute.tsx`
|
||||
- Modify: `src/app/routes/EditorsRoute.tsx`
|
||||
|
||||
- [ ] **Step 1: Update HomeRoute**
|
||||
|
||||
In `src/app/routes/HomeRoute.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<section className="flex-1 grid place-items-center px-6">
|
||||
<div className="grid gap-4 md:grid-cols-2 max-w-3xl w-full">
|
||||
<Card className="p-6 space-y-4">
|
||||
<h2 className="font-serif text-2xl">{t('home.new_report.title')}</h2>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<section className="flex-1 grid place-items-center px-4 sm:px-6">
|
||||
<div className="grid gap-4 md:grid-cols-2 max-w-3xl w-full">
|
||||
<Card className="p-4 sm:p-6 space-y-3 sm:space-y-4">
|
||||
<h2 className="font-serif text-xl sm:text-2xl">{t('home.new_report.title')}</h2>
|
||||
```
|
||||
|
||||
And the second card heading too:
|
||||
|
||||
```tsx
|
||||
<Card className="p-6 space-y-4">
|
||||
<h2 className="font-serif text-2xl">{t('home.import.title')}</h2>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<Card className="p-4 sm:p-6 space-y-3 sm:space-y-4">
|
||||
<h2 className="font-serif text-xl sm:text-2xl">{t('home.import.title')}</h2>
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update EditorsRoute**
|
||||
|
||||
In `src/app/routes/EditorsRoute.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<section className="flex-1 grid place-items-center px-6">
|
||||
<div className="grid gap-4 md:grid-cols-2 max-w-3xl w-full">
|
||||
<Card className="p-6 space-y-4">
|
||||
<h2 className="font-serif text-2xl">{t('editors.svg.title')}</h2>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<section className="flex-1 grid place-items-center px-4 sm:px-6">
|
||||
<div className="grid gap-4 md:grid-cols-2 max-w-3xl w-full">
|
||||
<Card className="p-4 sm:p-6 space-y-3 sm:space-y-4">
|
||||
<h2 className="font-serif text-xl sm:text-2xl">{t('editors.svg.title')}</h2>
|
||||
```
|
||||
|
||||
And the second card:
|
||||
|
||||
```tsx
|
||||
<Card className="p-6 space-y-4">
|
||||
<h2 className="font-serif text-2xl">{t('editors.pathology.title')}</h2>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<Card className="p-4 sm:p-6 space-y-3 sm:space-y-4">
|
||||
<h2 className="font-serif text-xl sm:text-2xl">{t('editors.pathology.title')}</h2>
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add src/app/routes/HomeRoute.tsx src/app/routes/EditorsRoute.tsx
|
||||
git commit -m "fix(ui): responsive padding and typography on home and editors pages"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 7: Responsive typography and padding — NewReportRoute
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/app/routes/NewReportRoute.tsx`
|
||||
|
||||
- [ ] **Step 1: Update NewReportRoute responsive classes**
|
||||
|
||||
In `src/app/routes/NewReportRoute.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<div className="max-w-3xl mx-auto px-6 py-8 space-y-8">
|
||||
<h1 className="font-serif text-3xl">{t('new_report.title')}</h1>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="max-w-3xl mx-auto px-4 sm:px-6 py-6 sm:py-8 space-y-6 sm:space-y-8">
|
||||
<h1 className="font-serif text-2xl sm:text-3xl">{t('new_report.title')}</h1>
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/app/routes/NewReportRoute.tsx
|
||||
git commit -m "fix(ui): responsive padding and typography on new report page"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 8: Responsive typography — ObservationList + ConclusionPanel
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/observation/ObservationList.tsx`
|
||||
- Modify: `src/components/report/ConclusionPanel.tsx`
|
||||
|
||||
- [ ] **Step 1: Update ObservationList heading**
|
||||
|
||||
In `src/components/observation/ObservationList.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<h2 className="font-serif text-xl text-[var(--color-ink)]">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<h2 className="font-serif text-lg sm:text-xl text-[var(--color-ink)]">
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update ConclusionPanel heading**
|
||||
|
||||
In `src/components/report/ConclusionPanel.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<h2 className="font-serif text-xl text-[var(--color-ink)]">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<h2 className="font-serif text-lg sm:text-xl text-[var(--color-ink)]">
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/observation/ObservationList.tsx src/components/report/ConclusionPanel.tsx
|
||||
git commit -m "fix(ui): responsive typography for observation and conclusion headings"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 9: Footer and AppHeader mobile polish
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/brand/Footer.tsx`
|
||||
- Modify: `src/components/brand/AppHeader.tsx`
|
||||
|
||||
- [ ] **Step 1: Update Footer spacing**
|
||||
|
||||
In `src/components/brand/Footer.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<footer className="mt-12 border-t border-neutral-200 bg-neutral-50 py-6 text-center text-sm text-neutral-600">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<footer className="mt-8 sm:mt-12 border-t border-neutral-200 bg-neutral-50 py-4 sm:py-6 text-center text-xs sm:text-sm text-neutral-600">
|
||||
```
|
||||
|
||||
And the flex container from:
|
||||
|
||||
```tsx
|
||||
<div className="flex flex-wrap items-center justify-center gap-4">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="flex flex-wrap items-center justify-center gap-2 sm:gap-4">
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update AppHeader padding**
|
||||
|
||||
In `src/components/brand/AppHeader.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<header className="px-6 py-3 border-b border-[var(--color-border)] flex items-center justify-between bg-[var(--color-surface)]">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<header className="px-3 sm:px-6 py-2 sm:py-3 border-b border-[var(--color-border)] flex items-center justify-between bg-[var(--color-surface)]">
|
||||
```
|
||||
|
||||
And the right-side gap from:
|
||||
|
||||
```tsx
|
||||
<div className="flex items-center gap-4">
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="flex items-center gap-2 sm:gap-4">
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/brand/Footer.tsx src/components/brand/AppHeader.tsx
|
||||
git commit -m "fix(ui): responsive footer and header spacing for mobile"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 10: ReportHeader mobile polish
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/components/report/ReportHeader.tsx`
|
||||
|
||||
- [ ] **Step 1: Make report info responsive on mobile**
|
||||
|
||||
In `src/components/report/ReportHeader.tsx`, change:
|
||||
|
||||
```tsx
|
||||
<div className="text-sm text-right text-[var(--color-ink-muted)]">
|
||||
<div className="text-[var(--color-ink)] font-medium">
|
||||
{report.animal.name} · {report.owner.name}
|
||||
</div>
|
||||
<div>{formatDate(report.date, locale)}</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
to:
|
||||
|
||||
```tsx
|
||||
<div className="text-xs sm:text-sm text-right text-[var(--color-ink-muted)]">
|
||||
<div className="text-[var(--color-ink)] font-medium truncate max-w-[10rem] sm:max-w-none">
|
||||
{report.animal.name} · {report.owner.name}
|
||||
</div>
|
||||
<div className="hidden sm:block">{formatDate(report.date, locale)}</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
Changes:
|
||||
- Smaller text on mobile (`text-xs sm:text-sm`)
|
||||
- Truncate long names on narrow screens (`truncate max-w-[10rem]`)
|
||||
- Hide date on very small screens (header is already tight)
|
||||
|
||||
- [ ] **Step 2: Run tests**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm test:run`
|
||||
Expected: All tests pass
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add src/components/report/ReportHeader.tsx
|
||||
git commit -m "fix(ui): responsive report header — compact on mobile"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 11: Final verification
|
||||
|
||||
- [ ] **Step 1: Run full verification suite**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm typecheck && ~/.local/share/pnpm/bin/pnpm test:run && ~/.local/share/pnpm/bin/pnpm lint && ~/.local/share/pnpm/bin/pnpm build
|
||||
```
|
||||
|
||||
Expected: All clean — typecheck, tests, lint (0 warnings), build success.
|
||||
|
||||
- [ ] **Step 2: Dev server visual check**
|
||||
|
||||
Run: `cd /home/bchanot-ubuntu/Documents/osteo && ~/.local/share/pnpm/bin/pnpm dev`
|
||||
|
||||
Open in browser, test at:
|
||||
- 375px width (iPhone SE): all pages, editor, dialogs
|
||||
- 768px width (iPad): editor two-panel, SVG editor with sidebar
|
||||
- 1280px width (desktop): no regressions
|
||||
|
||||
Check:
|
||||
- No horizontal overflow on any page at 375px
|
||||
- Dialogs fit within viewport
|
||||
- SVG editor sidebar stacks below canvas at <768px
|
||||
- AnatomyCanvas constrained in height on single-column layout
|
||||
- All buttons tappable (no tiny targets)
|
||||
- Typography scales appropriately
|
||||
- Footer wraps cleanly
|
||||
|
||||
- [ ] **Step 3: Stop dev server**
|
||||
Reference in new issue
Block a user