Bound list/PDF payloads, stream MinIO I/O with cancellation, paginate history and FHIR $everything, tighten OCR lifetimes/buffers, and add phase tracking docs.
5.7 KiB
Phase 15 — Shared UX Primitives
What exists
From Phase 14: design tokens, AppShell, redesigned login.
Still fragmented across views:
- Status rendering via ad-hoc Tailwind classes /
.status-badgein lists and forms - OCR assist via
useOcrFieldConfidence.ts(thresholds 0.85 / 0.7) and banners inEntryForm.vue/VerificationForm.vue - SoD: Verification subtitle shows truncated
enteredByUserIdonly (VerificationView.vue) - Toasts:
ToastContainer.vue+useToast.ts - Empty/loading: inconsistent per view (
BatchListloading text, etc.)
Design reference: design-doc.md §§9, 14 (OCR), 15 (SoD), 26–29, 31.
What needs to be built
Reusable components and composables that Phases 16–17 apply. Prefer shared primitives over one-off markup. Frontend-only threshold tweaks for OCR badges are allowed; no API changes.
Do not start Phase 16 until these primitives exist and have basic tests.
Step 1 — Status badge system
Create e.g. StatusBadge.vue:
- Input: batch
statusstring (UPLOADED,IN_ENTRY,PENDING_VERIFICATION,AWAITING_CLINICAL_APPROVAL,VERIFIED,APPROVED,PROMOTED,REJECTED,CANCELLED, …) - Output: label (humanized) + semantic color + optional icon
- Must not rely on color alone (icon or text prefix)
Wire into BatchList.vue and any header chips that show status.
Step 2 — Empty, loading, error patterns
Create small presentational components (names flexible):
| Component | Behavior |
|---|---|
EmptyState.vue |
Operational copy (“No batches are waiting for verification.”) + optional CTA |
SkeletonBlock.vue / row skeletons |
Prefer over full-page spinner (design-doc §27) |
InlineError.vue |
What happened / what was preserved / Retry action (design-doc §28) |
Apply to queue lists as the first consumer; other views adopt in Phase 16–17.
Step 3 — Sticky workstation action bar
Create e.g. WorkstationActionBar.vue:
- Sticky bottom of the form/panel column
- Slots:
left(e.g. Reject),center(Save Draft),primary(Submit…),right(Next) - Uses Phase 14 primary/destructive button styles
Not wired into Entry/Verification/Approval until Phase 16 — but component + Story/test fixture ready.
Step 4 — OCR field badges
Update useOcrFieldConfidence.ts:
- Expose numeric confidence and a badge label helper (
OCR 98%) in addition to CSS class - Align thresholds with design-doc §14 (recommended): 95–100% subtle green, 80–94% amber, <80% strong warning (adjust from current 0.85 / 0.7)
Update Entry/Verification forms to show compact badges beside fields when ocrConfidence.fieldConfidences[path] exists. Banner copy must say OCR is assistive, not authoritative (e.g. “Pre-filled by OCR — review against the scan”).
Out of this step: click-to-highlight regions on the scan (no coordinates in API).
Step 5 — Separation of Duties banner
Create e.g. SeparationOfDutiesBanner.vue:
Props: enteredByUserId, enteredByUserName?, currentUserId, currentUserName?
- When IDs differ: restrained info banner — “Separation of Duties Enforced” + entered by / current verifier
- When same: blocking message — “You cannot verify a batch you entered.” Emit/
disabledflag for parent to disable Pass actions
Use enteredByUserId from batch detail today; names optional until API/history provides them.
Unit-test both states.
Step 6 — Confirmation dialog pattern
Create e.g. ConfirmDialog.vue for meaningful actions only:
- Approve & Promote
- Reject batch / return for rework
- Cancel batch / delete unsubmitted upload (if used)
Props: title, body, confirmLabel, variant (primary | danger). Do not use for harmless navigation.
Approval copy must state promotion into live clinical tables (design-doc §16).
Success criteria
StatusBadgecovers all batch statuses used in the UI- Empty/skeleton/error components exist and are used at least on one queue list
WorkstationActionBarrenders sticky with slots; documented for Phase 16- OCR badges show percentage + threshold colors; banner is non-authoritative
- SoD banner blocks same-user verify in UI (in addition to API 409)
- Confirm dialog used for at least one destructive/irreversible path or ready with tests
npm testpasses; new component tests undersrc/__tests__/components/
Out of scope
- Full Entry/Verification/Approval layout redesign (Phase 16)
- Batch events audit panel (Phase 18)
- Changing verification/approval API contracts
Verification
cd vigilcare-records-web && npm test- Manual: open a batch with OCR confidence (OCR enabled env) — badges visible
- Manual: as entry clerk who entered a batch, open verification for that batch — SoD banner + disabled Pass (if seed allows; else unit test covers)
Gate
Do not start Phase 16 until success criteria above are met.