import React from 'react'; import clsx from 'clsx'; export type DeskInboxRowProps = { avatar: React.ReactNode; name: React.ReactNode; /** What kind of conversation this is: Shared inbox, Referral to triage, Colleague. */ chip?: string; preview?: string; time: string; unread: number; selected: boolean; onOpen: (event: React.SyntheticEvent) => void; }; // The desk deck's row: name, time and unread on one line, the kind of conversation under it, then the // last thing said. export const DeskInboxRow = ({ avatar, name, chip, preview, time, unread, selected, onOpen }: DeskInboxRowProps) => (
{ if (event.key !== 'Enter' && event.key !== ' ') return; event.preventDefault(); onOpen(event); }} className={clsx('ahr-desk-row', selected && 'ahr-desk-row--on')} > {avatar} {name} {time} {unread > 0 && {unread}} {chip && {chip}} {preview && {preview}}
); export type DeskDirectoryRowProps = { avatar: React.ReactNode; name: React.ReactNode; sub?: string; onOpen: () => void; /** The practitioner deck's flat directory row (.trow) rather than the desk deck's card. */ flat?: boolean; /** A colleague-only page names the person here and draws a Message button, as its deck does. */ messageLabel?: string; }; // A person to start a conversation with: the desk deck's directory card, or the practitioner deck's // flat row drawn by the shared row hooks. export const DeskDirectoryRow = ({ avatar, name, sub, onOpen, flat = false, messageLabel }: DeskDirectoryRowProps) => messageLabel ? (
{avatar} {name} {sub && {sub}}
) : flat ? ( ) : ( );