Tally UI

CashierSheet

CashierSheet is the signed-in cashier's sheet on the right edge, with the header, "Your sales today", "Hand the till to" and Sign out.

Import

import { CashierSheet, RegisterBar } from '@tallyui/components';

Usage

const [open, setOpen] = useState(false);

<RegisterBar {...barProps} cashier={{ name: 'Sam Lee', onPress: () => setOpen(true) }} />
{open && (
  <CashierSheet
    cashier={{ name: 'Sam Lee' }}
    description="Main Street · Till 2 · since 09:05"
    salesToday={{ amountMinor: 123450, currency: 'EUR' }}
    signOutDisabled={paying}
    onSignOut={() => setSignOutConfirm(true)}
    onOpenChange={setOpen}
  />
)}

Behaviour

  • Opening: the app mounts the sheet while it is open, usually from RegisterBar's cashier.onPress. Dismissing it calls onOpenChange(false).
  • Header: the cashier's avatar (or initials) and name. The description line shows as given; the app joins the store, the register (when there are several) and "since HH:mm" with " · ". Without it the line is hidden.
  • Your sales today: the app's figure for the cashier's own sales on the store day, formatted in the given currency. Without salesToday the row is hidden. The sheet does not compute the figure.
  • Drawer door: with drawer, an "In the drawer" door sits under "Your sales today". It shows the app's figure: the expected cash, a blind count's number of sales, "—" while figures are pending, or "Register closed · last closure {n}". It also shows the opener line and the register verbs. Pressing it calls drawer.onOpen and leaves the sheet open, and drawer.disabled blocks it. The sheet computes nothing.
  • Sign out: a destructive button that calls onSignOut. It never closes the sheet itself: the app decides, for example after SwitchConfirm with kind="signOut". signOutDisabled disables it while a payment or a switch is in progress.
  • Notices and "Hand the till to": awaitingStore above 0 shows "Awaiting store · n sales" with "Sent when you are signed in online."; paying shows "Finish the payment first". With handTo, a row per other cashier (with "n open carts" when above 0) calls handTo.onHandTo(id) and leaves the sheet open, so the app can show SwitchConfirm with kind="cashier"; the rows are disabled while handTo.disabled, paying or handTo.counting, and counting adds "Finish or abandon the count first" to the header unless paying. The app passes the list without the signed-in cashier and counts the carts.
  • Store and Register rows: with store and register, a row each, Store first, shows "Store" or "Register" with the name. With onSwitch, a "Switch" verb calls it and leaves the sheet open, so the app opens its own picker (RegisterPicker for registers). Switch is disabled while disabled, paying or heldReason, and heldReason shows as a line under the row unless paying. The app passes register only when bound with two or more registers, and decides the reason (for example "Needs the store to switch" offline). The sheet writes nothing.

Props

PropTypeDefaultDescription
cashier{ name: string; avatar?: string }requiredThe signed-in cashier
descriptionstring---The header line, already joined; hidden when absent
salesToday{ amountMinor: number; currency: string }---"Your sales today" in integer minor units; hidden when absent
onSignOut() => voidrequiredCalled when Sign out is pressed
signOutDisabledbooleanfalseDisables Sign out
onOpenChange(open: boolean) => voidrequiredCalled with false when the sheet is dismissed
drawerCashierSheetDrawer---The drawer door; hidden when absent
handToCashierSheetHandTo---"Hand the till to"; hidden when absent or empty
payingbooleanfalseShows "Finish the payment first" and disables the hand-to rows
awaitingStorenumber0Sales the store has still to hear; the notice is hidden at 0
storeCashierSheetPlace---The Store row; hidden when absent
registerCashierSheetPlace---The Register row; hidden when absent

CashierSheetDrawer

type CashierSheetDrawer = {
  onOpen: () => void; // the door was pressed: open the register panel
  disabled?: boolean; // a payment or a switch is in progress
} & (
  | { state: 'closed'; lastClosure?: string | number } // default "—"
  | {
      state: 'open' | 'counting';
      figure: { kind: 'cash'; amountMinor: number; currency: string } | { kind: 'blind'; salesCount: number } | { kind: 'pending' };
      openedAt: string; // already formatted, "HH:mm" in the store's zone
      opener: { name: string; avatar?: string };
      registerName?: string; // only when there is more than one register
      countingSince?: string; // state "counting" only, already formatted; default "—"
    }
);

CashierSheetHandTo

interface CashierSheetCashier {
  id: string;
  name: string;
  avatar?: string;
  openCarts?: number; // this cashier's open carts on this register; hidden at 0
}

interface CashierSheetHandTo {
  cashiers: CashierSheetCashier[]; // the other cashiers, without the one signed in
  onHandTo: (id: string) => void; // a row was pressed: show SwitchConfirm kind="cashier"
  disabled?: boolean; // a switch is in progress
  counting?: boolean; // a count is open on this register
}

CashierSheetPlace

interface CashierSheetPlace {
  name: string; // the current store's or register's name
  onSwitch?: () => void; // "Switch" was pressed: open the app's picker; absent hides the verb
  heldReason?: string; // why Switch is held; drawn under the row unless paying, and disables Switch
  disabled?: boolean; // a switch is in progress: Switch is disabled, with no line
}