Skip to content

feat(emergency): public scan completeness preview for QR profile - #1198

Merged
llinsss merged 1 commit into
DogStark:mainfrom
sunred-liu:fix/1116-emergency-profile-completeness-preview
Oct 30, 2026
Merged

llinsss merged 1 commit into
DogStark:mainfrom
sunred-liu:fix/1116-emergency-profile-completeness-preview

Conversation

@sunred-liu

Copy link
Copy Markdown
Contributor

closes #1116

Summary

Adds an accessible public scan completeness preview for the emergency QR profile (issue #1116). It shows the owner exactly which field categories an anonymous scanner will see — before they publish or change the profile.

What changed (all additive, no existing behaviour touched)

  • src/utils/emergencyProfilePreview.ts — pure, dependency-free helper buildCompletenessPreview(profile) that reuses the existing, tested projectEmergencyProfile privacy projection. Each of the five field categories (medical notes, contacts, emergency vet, poison control, custom message) is reported with visible (enabled and populated), hasContent, and visibleOnMobile / visibleOnDesktop (the public scan is responsive, so the visible set is identical on both viewports).
  • src/components/EmergencyProfile/EmergencyProfileCompletenessPreview.tsx — a keyboard- and screen-reader-friendly panel (<section> + real <ul> list, per-row status text that does not rely on colour alone) summarising which fields are shown vs hidden, and calling out when data exists but is still set private.
  • Unit tests: emergencyProfilePreview.test.ts (primary flow, empty/denied/null, all-public boundary, per-item isPublic override on contacts) and EmergencyProfileCompletenessPreview.test.tsx (render + jest-axe accessibility, no violations).

Mounting (for review)

The component is self-contained and ready to drop into the owner view of src/pages/pets/[id]/emergency.tsx, e.g. inside the owner main panel:

{viewMode === 'owner' && (
  <EmergencyProfileCompletenessPreview profile={data} id="panel-completeness" />
)}

Verification

  • jest (ts-jest): 20/20 passing across the 3 relevant suites, including the pre-existing emergencyProjection.test.ts (unchanged) — zero regression.
  • tsc --noEmit: no type errors in the added files.
  • Privacy-by-default is preserved: visibility decisions remain owned by the backend / the existing visibility flags; this PR only surfaces them.

@llinsss
llinsss merged commit c404f1a into DogStark:main Oct 30, 2026
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.

[Frontend] Add emergency QR profile completeness preview

2 participants