import type { MouseEvent } from 'react'; import type { EffectiveSeat } from '../../utils/seatStanding'; /** * Navigation state that asks the Workspaces tab to tick the seat and open its confirmation. The tab keeps * every rule about who may grant a seat and what it costs; this only saves the admin the hunt for it. */ export const GIVE_CLINICIAN_SEAT_STATE = { grantClinicianSeat: true } as const; export const asksToGiveClinicianSeat = (state: unknown): boolean => (state as { grantClinicianSeat?: unknown } | null)?.grantClinicianSeat === true; export const GiveClinicianSeatButton = ({ onGive, className = '' }: { onGive: () => void; className?: string; }) => ( ); const SEAT_WORDS: Record = { none: 'None', held: 'Held', 'free-keeper': 'Held. Keeps the free seat while your subscription is lapsed.', kept: 'Not in use. Kept for when your subscription resumes.', checking: 'Checking…', unknown: "Can't be confirmed right now.", }; /** The seat line at the top of a provider's staff record: what this person can do now, not only what is stored. */ export const ClinicianSeatStatus = ({ seat, onGive, onChooseFreeSeat }: { seat: EffectiveSeat; /** Absent when the reader may not grant a seat; the status still shows. */ onGive?: () => void; /** Opens the free-seat choice for a person whose seat is kept; absent when the reader may not choose. */ onChooseFreeSeat?: () => void; }) => (
Clinician seat:{' '} {SEAT_WORDS[seat]} {seat === 'none' && onGive && } {seat === 'kept' && onChooseFreeSeat && ( )}
);