import type { FC, ReactNode } from "react"; import { FONT } from "../brand/fonts"; import { useT } from "../content/CopyContext"; import { COLOR, DRAW } from "../brand/tokens"; /** Shared drawing parts for illustrations. Everything is SVG, drawn in stage coordinates. */ export type IconName = | "cart" | "invoice" | "people" | "mail" | "check" | "book" | "form" | "chat" | "bell" | "tasks"; const ICON_PATHS: Readonly> = { cart: ( <> ), invoice: ( <> ), people: ( <> ), mail: ( <> ), check: ( <> ), book: ( <> ), form: ( <> ), chat: , bell: ( <> ), tasks: ( <> ), }; /** A line icon from a 24 x 24 grid, centred on (cx, cy). */ export const Icon: FC<{ name: IconName; cx: number; cy: number; size: number; color: string }> = ({ name, cx, cy, size, color, }) => ( {ICON_PATHS[name]} ); export const TILE_SIZE = 150; /** One tool: a dark rounded tile with an icon and a mono label below. */ export const Tile: FC<{ x: number; y: number; icon: IconName; label: string; /** Coloured outline, e.g. while someone works in this tool. */ ring?: string; scale?: number; opacity?: number; }> = ({ x, y, icon, label, ring, scale = 1, opacity = 1 }) => { const centre = TILE_SIZE / 2; return ( {ring && ( )} {useT()(label).toUpperCase()} ); }; /** Round badge with a tick, centred on (cx, cy). */ export const DoneBadge: FC<{ cx: number; cy: number; r: number; scale?: number }> = ({ cx, cy, r, scale = 1 }) => ( ); /** Round amber badge with one character: something needs attention. */ export const WarnBadge: FC<{ cx: number; cy: number; r: number; scale?: number; char?: string }> = ({ cx, cy, r, scale = 1, char = "!", }) => ( {char} ); /** Mono caption inside a drawing. */ export const Label: FC<{ x: number; y: number; text: string; anchor?: "start" | "middle" | "end"; color?: string; size?: number }> = ({ x, y, text, anchor = "middle", color = DRAW.label, size = 19, }) => ( {useT()(text).toUpperCase()} ); /** Mouse pointer with its tip at (x, y): stands for a person doing the step by hand. */ export const Cursor: FC<{ x: number; y: number; scale?: number }> = ({ x, y, scale = 1.5 }) => ( ); /** A piece of data: dark pill with binary digits. */ export const DataChip: FC<{ x: number; y: number; width?: number; digits?: string; color?: string }> = ({ x, y, width = 150, digits = "0110", color = DRAW.fg, }) => ( {digits} ); /** An app window: white card with a title bar. Children are drawn in its coordinates. */ export const AppWindow: FC<{ x: number; y: number; width: number; height: number; title: string; children?: ReactNode; }> = ({ x, y, width, height, title, children }) => ( {[30, 56, 82].map((cx) => ( ))} {useT()(title).toUpperCase()} {children} ); /** A box for one day of a week or a countdown, centred on cx. */ export const DayBox: FC<{ cx: number; y: number; width: number; label: string; filled: boolean; scale?: number; }> = ({ cx, y, width, label, filled, scale = 1 }) => ( ); /** A sheet of paper. Children are drawn in its coordinates. */ export const Page: FC<{ x: number; y: number; width: number; height: number; children?: ReactNode }> = ({ x, y, width, height, children, }) => ( {children} );