"use client"; import Link from "next/link"; import { useState } from "react"; import { buttonVariants } from "@/components/ui/button"; import { LitList } from "@/components/ui/lit-list"; import { LitActions, LitGroup, LitLine } from "@/components/ui/lit-line"; import { cn } from "@/lib/utils"; import { LifecycleButton, MuteButton, type LifecycleState } from "@/components/piece/Lifecycle"; import Menu from "@/components/piece/Menu"; import { PhoneOnly } from "@/components/shell/phone"; import DecisionSettle from "@/components/projects/report/DecisionSettle"; import type { Decision } from "@/lib/decisions"; // --------------------------------------------------------------------------- // The Inbox's cards as ONE lit list (canvas "Inbox"): a group head, then a // line per card -- piece · what, why under it, the count in Meter, the ONE // primary action (filled Signal on the lit line only, app/globals.css // `.lit-go`), then Park and Mute. // // Park and Mark done are the piece's lifecycle (lib/lifecycle.ts); Mute is one // kind of call on one piece (lib/mutes.ts, beside it). Both are the server's, // so every page and the API agree; a muted or parked card is listed again under // "Muted N" / "Show hidden" with Unmute / Reactivate. // // Park and Mute change state, so a tap on a line never reaches them: on the // desk they take a press only on the LIT line (app/globals.css, `.lit-line`), // and on a phone -- where nothing is hover-only -- they are behind the card's // own ⋯, always drawn, which opens them in a sheet with their names on. // --------------------------------------------------------------------------- export type InboxCard = { key: string; piece: string | null; title: string; kind: string; what: string; why: string; count: number; severity: string; action: { label: string; href: string }; /** The piece's lifecycle (a hidden card's is parked or done). */ lifecycle: LifecycleState; /** This kind of call is muted on the piece: the action is Unmute. */ muted?: boolean; /** Mark done is the action (POST), not a link. */ finish?: boolean; /** A report video's Play address (at the card's note), when the piece has one. */ play?: string | null; /** The project the card's rows are about (its settle is pressed on it). */ project?: string; /** * ONE-CLICK (umtool redesign L4): the settle its rows agree on (lib/inbox/groups.mjs mergeSettle), pressed * in place -- Use embed ids, Run quote-check, Snap the cut to the words, Check links -- through the * routes the project page's Checks list presses (DecisionSettle). The card's title links where it is settled. */ settle?: Decision["settle"] | null; }; export type InboxGroup = { id: string; label: string; note?: string; collapsed: boolean; decisions: number; hidden: number; cards: InboxCard[]; }; export default function InboxList({ groups }: { groups: InboxGroup[] }) { const [open, setOpen] = useState>({}); const shown = groups.filter((g) => g.cards.length > 0); if (shown.length === 0) { return (

Nothing waiting on you

); } return ( {shown.map((g) => g.collapsed && !open[g.id] ? ( ) : ( setOpen((o) => ({ ...o, [g.id]: false }))} className="hover:text-text"> collapse ▾ ) : ( g.note ) } > {g.cards.map((c) => ( ))} ), )} ); } function Card({ card: c }: { card: InboxCard }) { const parked = c.lifecycle !== "active"; // A research case's card (`c:`): cases have no lifecycle or mutes yet, so no Park or Mute. const parkable = !!c.piece && !c.piece.startsWith("c:"); // Pressed in place only on an active, unmuted card: a hidden one's action is its way back. const oneClick = !!(c.settle && c.project && !parked && !c.muted && !c.finish); return (
{oneClick ? ( {c.title} · {c.what} ) : ( <> {c.title} · {c.what} )} {c.why}
{c.count} {c.muted && c.piece ? ( ) : parked && c.piece ? ( ) : c.finish && c.piece ? ( ) : oneClick && c.settle && c.project ? ( ) : ( {c.action.label} )} {c.play && ( ▶ )} {!parked && !c.muted && c.piece && parkable && ( <> )} {!parked && !c.muted && c.piece && parkable && ( )}
); }