Skip to content

Add BodyMap: a front and back body map for React - #1

Merged
YauhenBichel merged 1 commit into
mainfrom
feat/initial-package
Sep 26, 2026
Merged

YauhenBichel merged 1 commit into
mainfrom
feat/initial-package

Conversation

@YauhenBichel

Copy link
Copy Markdown
Member

This is the first version of @molecare/react-body-map. It replaces the MoleCare web app's two different body drawings (BodyPartSelector and BodyMapWidget) with one reusable package.

One component, two uses

  • Pick a region: selected + onSelect.
  • Show what was recorded: counts, as neutral shades plus a number badge.
  • Or both together, where each region button also says its count.

What makes it different

  • Left and right are the person's. left_upper_arm is drawn on the viewer's right on the front view and on the viewer's left on the back view. A test checks every region from its geometry, so a swapped side can't slip through.
  • Accessible.
    • When picking, each region is a named, focusable button that works with Enter and Space and says its count ("Chest, 2 recorded").
    • A read-only map gives screen readers a list of its counts, so nothing depends on colour.
  • Calm. A count is never coloured good or bad; CONTRIBUTING rules out red or amber and risk levels.
  • Yours to change.
    • Colours are --rbm-* CSS variables.
    • Every word is a prop, including each region's name for translation.
    • regions replaces the drawing entirely, and mirrorPath means a limb only needs drawing once.
  • Stateless, SSR-safe, "use client", React 18+, no dependencies.

Regions: 13 per view, 26 in total: head, neck, chest/upper back, abdomen/lower back, pelvis/buttocks, and upper arm, forearm and hand, thigh, and lower leg and foot on each side.

Also included, the same as react-photo-compare:

  • CI: lint, types, 100% coverage, the demo build, publint and arethetypeswrong, the tarball allowlist, and installs with 6 package managers and React 18.
  • A release workflow for npm trusted publishing.
  • A demo site on Pages.
  • Issue and PR templates, CODEOWNERS and Dependabot.

Checked

  • All CI steps pass locally, with 31 tests at 100% coverage.
  • The packed package installs and server-renders with npm, pnpm, Yarn 1, Yarn 4 (PnP and node_modules) and Bun, and with React 18.
  • All three README examples typecheck, and all 26 region ids are documented.
  • In real Chrome, on the demo:
    • Clicking the arm on the viewer's right picks Left upper arm.
    • Enter and Space pick by keyboard.
    • The badges and the screen-reader list match the counts.
    • No sideways scroll or errors in light, dark or phone widths.
  • gitleaks finds no leaks.

Not done yet: the repo is private, and the Pages site goes live once it's set up after merge. Switching the web app to this package is a separate PR once it's on npm.

🤖 Generated with Claude Code

One component, two uses: pick a region (selected + onSelect), or show
what was recorded per region (counts, as neutral shades and badges), or
both. 13 regions on each view, drawn once per side and mirrored.

- Left and right are the person's: left_upper_arm is on the viewer's
  right on the front and on the viewer's left on the back. A test checks
  every region from its geometry.
- Accessible: picking makes each region a named button (Enter, Space)
  that says its count; a read-only map lists counts for screen readers.
- Calm: counts are never coloured good or bad. Colours are --rbm-* CSS
  variables; every word is a prop; regions can be replaced.
- Stateless, SSR-safe, "use client", React 18+, no dependencies.

Replaces the two different body drawings in the MoleCare web app. Same
checks, CI, release and demo site as react-photo-compare.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YauhenBichel
YauhenBichel merged commit 39b5ffa into main Sep 26, 2026
9 checks passed
@YauhenBichel
YauhenBichel deleted the feat/initial-package branch September 26, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant