Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | 11x 243x 20x 60x 10x 4x 10x 10x 115x | import { Link } from "@tanstack/react-router";
import type { ReactNode } from "react";
import { cn } from "../../lib/utils";
import { StatusBadge } from "../ui/status-badge";
import { WORK_TONE, type WorkItem } from "./work-queue";
/**
* The work-queue band and its rows. Plan §1.3; the specification is
* `.context/mockups/today.html` (`.band` / `.rows` / `.row`, `_base.css` §7.1).
*
* THE BAND
* `▌ WAITING ON YOU 4` — a 3px index-red mark, the section name in `.label`
* caps, and a right-aligned tabular count. **No pill, ever.** The rule under
* it is the strong hairline; dividers are hairlines, not boxes.
*
* `quiet` swaps the index-red mark for the strong hairline: a band that is not
* a live queue is a plain ruled section head and should not spend index red.
*
* THE INDEX RED RULE, AS IT APPLIES HERE
* Index red is printed in exactly two places on this screen and neither is a
* state: the band marker above, and the 3px inset bar on the current row. A
* status is carried by its printed code, never by red. `secondary-600` is the
* portal's spelling for index red — `--secondary-600` IS the Shade Card's
* index ink; see the note in `components/ui/table.tsx` for why that token and
* not `--index`.
*
* THE ROWS
* Each row is ONE link: the whole row is the target, so there is one tab stop
* and one hit area per item rather than a decorative row with a button
* floating in it. The trailing `Log ▸` is that link's affordance, and the
* link carries an explicit accessible name ("Log contact with Priya Menon")
* so the printed label does not have to carry the whole sentence.
*
* Rows TINT on hover (7% ink === the design system's `--tint`, correct on
* every ground in both themes). They never lift — the −3px lift means
* "pick-up-able" and nothing on this screen is draggable.
*
* Controls inside rows are the 24px micro tier. The 44px touch floor is not
* set here: it arrives from the `@media (pointer: coarse)` block in
* `@interioring/design-system`, which is the only place it belongs.
*/
/** `.label` — the printed code. 0.06em is `tracking-wider` on the token scale. */
const LABEL = "text-xs font-semibold uppercase tracking-wider";
export interface WorkBandProps {
/** The section name, printed in caps by `.label`. */
title: string;
/** Right-aligned tabular count. Omitted when there is nothing to count. */
count?: number;
/** A plain ruled section head: strong-hairline mark, muted ink. */
quiet?: boolean;
className?: string;
}
/** `▌ WAITING ON YOU 4` — the ruled band head. */
export function WorkBand({ title, count, quiet, className }: WorkBandProps) {
return (
<div
className={cn(
"flex items-center gap-2.5 border-b border-border-strong pb-1.5",
quiet ? "text-foreground-muted" : "text-foreground-default",
className,
)}
>
{/* --mark-w, and only ever --mark-w. */}
<span
aria-hidden="true"
className={cn(
"h-4 w-[3px] shrink-0 rounded-sm",
quiet ? "bg-border-strong" : "bg-secondary-600",
)}
/>
<span className={cn(LABEL, "grow")}>{title}</span>
{count !== undefined && (
<span
className={cn(LABEL, "ml-auto tabular-nums text-foreground-muted")}
>
{count}
</span>
)}
</div>
);
}
export interface WorkRowProps {
item: WorkItem;
/**
* The one row the screen is currently about — the next thing to do. Gets
* the tint plus the single 3px index-red inset bar.
*/
isCurrent?: boolean;
}
/** One row: printed code, entity and context, relative age, one action. */
export function WorkRow({ item, isCurrent }: WorkRowProps) {
return (
<li className="first:rounded-t-lg last:rounded-b-lg [&+li]:border-t [&+li]:border-border-default">
<Link
to={item.href}
aria-label={`${item.actionDescription}${
item.when ? `, ${item.when}` : ""
}`}
aria-current={isCurrent ? "true" : undefined}
className={cn(
// `.row`: 0.5625rem 0.875rem padding, `min-height: var(--ctl-h)`.
// Reading the tier variable rather than hardcoding 24px is what
// gives the row the 44px floor under a coarse pointer — the
// `@media (pointer: coarse)` block in the design system rewrites
// `--ctl-h` for every tier, and a literal `min-h-6` would ignore
// it and leave a 24px tap target on a phone.
"ctl-24 relative flex min-h-[var(--ctl-h)] w-full items-start gap-3 px-3.5 py-2.5 text-sm no-underline transition-colors",
"hover:bg-foreground-default/7 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500",
isCurrent &&
"bg-foreground-default/7 shadow-[inset_3px_0_0_var(--secondary-600)]",
)}
>
<StatusBadge
status={item.code}
variant={WORK_TONE[item.code]}
className="mt-px shrink-0"
/>
<span className="min-w-0 grow">
<span className="block truncate font-semibold text-foreground-default">
{item.title}
</span>
{item.meta && (
<span className="block truncate text-sm text-foreground-muted">
{item.meta}
</span>
)}
</span>
<span className="ml-auto flex shrink-0 items-center gap-3">
{item.when && (
<span className="hidden whitespace-nowrap text-xs tabular-nums text-foreground-muted sm:inline">
{item.when}
</span>
)}
<span
aria-hidden="true"
className={cn(
LABEL,
"inline-flex items-center gap-1 rounded-md border border-border-default bg-background-elevated px-1.5 py-0.5 text-foreground-default",
)}
>
{item.actionLabel}
<span>▸</span>
</span>
</span>
</Link>
</li>
);
}
export interface WorkQueueProps {
title: string;
items: readonly WorkItem[];
/** Mark the first row as the next thing to do. */
markFirst?: boolean;
/** Printed in place of the rows when the band is empty. */
emptyLabel: string;
quiet?: boolean;
className?: string;
}
/**
* A band and its rows, or the band and an honest one-line statement that
* there is nothing in it.
*
* An empty band prints a sentence, not a zero: a zero a pro cannot act on is
* a chore printed as a figure, which is the whole thing this screen replaces.
* The count is therefore omitted when it would be `0`.
*/
export function WorkQueue({
title,
items,
markFirst,
emptyLabel,
quiet,
className,
}: WorkQueueProps) {
return (
<section className={className}>
<WorkBand
title={title}
count={items.length > 0 ? items.length : undefined}
quiet={quiet}
/>
{items.length === 0 ? (
<p className="mt-3 text-sm text-foreground-muted">{emptyLabel}</p>
) : (
<ul className="mt-3 overflow-hidden rounded-lg border border-border-default bg-background-elevated shadow-card">
{items.map((item, index) => (
<WorkRow
key={item.id}
item={item}
isCurrent={markFirst === true && index === 0}
/>
))}
</ul>
)}
</section>
);
}
export interface WorkQueueSkeletonProps {
title: string;
/** How many placeholder rows to rule out. */
rows?: number;
}
/** The band, ruled, with its rows still loading. */
export function WorkQueueSkeleton({ title, rows = 3 }: WorkQueueSkeletonProps) {
return (
<section>
<WorkBand title={title} />
<div className="mt-3 overflow-hidden rounded-lg border border-border-default bg-background-elevated shadow-card">
{Array.from({ length: rows }, (_unused, index) => index).map(
(index) => (
<div
key={index}
className="flex items-center gap-3 border-b border-border-default px-3.5 py-2.5 last:border-0"
>
<div className="h-4 w-16 animate-pulse rounded-sm bg-background-muted" />
<div className="h-4 w-40 animate-pulse rounded bg-background-muted" />
<div className="ml-auto h-3 w-20 animate-pulse rounded bg-background-muted" />
</div>
),
)}
</div>
</section>
);
}
export interface FigureProps {
label: string;
/** Already formatted — paise are formatted by `lib/currency-utils`. */
value: ReactNode;
}
/**
* One cell of the figure strip: a `.label` over a `.num-xl`, ruled off below
* with the strong 2px hairline the mockup prints under `.metric`.
*
* Figures are tabular and right-aligned, and ₹ is glyphed — the character,
* never "Rs." and never an image. 1.5rem is `text-2xl` on the token scale.
*/
export function Figure({ label, value }: FigureProps) {
return (
<div className="border-b-2 border-border-strong pt-2 pb-1.5">
<span className={cn(LABEL, "block text-foreground-muted")}>{label}</span>
<span className="mt-0.5 block text-right text-2xl font-bold tabular-nums text-foreground-default">
{value}
</span>
</div>
);
}
|