import { stripText } from '../../../utils/counting/countingText'; import type { CountingView } from '../../../utils/counting/countingSelector'; /** * The appointments toolbar's count, INCLUDING at zero. * * Spencer, 2026-08-25: "Zero is information as opposed to not displaying and wondering if something is * broken." The receptionist overview was changed for exactly this - its board and rail state their zeroes * rather than deleting themselves. This page had not been. * * A clinician filtering to their own name and seeing no rows AND no count cannot tell "you have nothing * today" from "this did not load", and the line that would settle it is the one that was removed. * * WHY THIS DOES NOT CHANGE `stripText`, WHICH IS THE OBVIOUS PLACE * * That helper answers a different question - "is there anything I have not seen?" - and returning nothing * at zero is deliberate there: a permanent "0 unread" becomes wallpaper, which is the rule it was written * under. This line answers "how many rows are on this screen", and zero is a real answer to that. * -> Two different questions, two different treatments of zero. Changing the shared helper would trade * one ruling for the other on every surface that uses it. * * THE CANCELLED SUFFIX IS UNCHANGED and cannot appear at zero: it counts rows inside the same view, so a * total of none has none of them either. It is passed in rather than derived so this stays pure. */ export function appointmentCountText(view: CountingView, cancelledCount: number): string { if (view.total === 0) return '0 appointments'; return stripText(view, 'appointment') + (cancelledCount > 0 ? ` ยท ${cancelledCount} cancelled` : ''); }