Nasaq

CurrentVisit

The visit in progress - patient card with allergies, earlier visits, a running timer, notes, a prescription list with validation, follow-up choices and a finish that checks the record.

PreviewOpen ↗

Code

import { CurrentVisit } from "@fadymondy/nasaq/web";<CurrentVisit patient={patient} service="Consultation" startedAt={startedAt} history={history} onFinish={(result) => api.finish(result)} />

Healthcare · beta

Live examples and controls: CurrentVisit in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/current-visit.json

Everything the doctor needs while the patient is in the room. Finishing is blocked until there is a note or a valid prescription. A half-filled medicine is flagged rather than dropped.

When to use

  • The consultation screen.
  • Recording notes and a prescription before the next patient.

When not to use

  • A read-only record: use a Timeline of visits.

Import

import { VisitPatient, VisitHistoryItem, VisitResult, CurrentVisit } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

import { CurrentVisit } from "@fadymondy/nasaq/web";

<CurrentVisit patient={patient} service="Consultation" startedAt={startedAt} history={history} onFinish={(result) => api.finish(result)} />

Anatomy

CurrentVisit                  data-slot="current-visit"
├─ patient card               name, age, phone, allergies, conditions
├─ history                    Timeline of earlier visits
└─ visit panel
   ├─ timer
   ├─ notes
   ├─ prescriptions           validated rows
   ├─ follow-up               quick choices and a DatePicker
   └─ Finish visit

API

Every div prop is passed through unless noted.

PropTypeDefaultDescription
patientVisitPatientrequiredName, age, gender, phone, allergies, conditions.
service, roomstringShown under the title.
startedAtnumberrequiredEpoch ms the visit began.
historyVisitHistoryItem[][]Earlier visits.
defaultNotes, defaultPrescriptionsInitial values.
followUpOptionsnumber[][7, 14, 30]Quick follow-up choices, in days.
workingWeekdaysnumber[]0 is Sunday. A follow-up moves to the next working day.
onFinish(result) => Promise<void | { error? }>requiredSave the visit: notes, prescriptions and the follow-up date.
now, labelsFor stories; override strings.

Examples

Book the follow-up in the host

onFinish={async ({ followUp }) => {
  if (followUp) await api.book({ start: followUp });
}}

Accessibility

  • Prescription errors sit under the field and mark it invalid.
  • The timer has role timer and a label; it is not announced every second.

RTL & i18n

  • Doses and phone numbers are left to right; the panel mirrors.
  • Strings live in a STRINGS = { en, ar } object and any of them can be replaced with labels. The locale comes from NasaqProvider.

Styling & tokens

  • Colours, radii and type come from --nq-* tokens; nothing is a raw colour. Spacing and alignment use logical classes.
  • Target [data-slot="current-visit"] and the inner data-slot parts shown in the anatomy.

Do / Don't

  • Do keep the async callbacks honest: return { error } so the component can show the message.
  • Do pass now in tests and stories so the output stays the same.
  • Don't fetch inside the component: it is presentational and takes data and callbacks.
  • Don't rely on colour for state: every state also has a word.

Lab

https://docs.nasaqui.com/?path=/docs/components-healthcare-current-visit--docs

On this page