Public: anyone can read this; the crew can change it.

Each deal has a client timeline: one printable page of its dates and who owes each, to hand to buyers or sellers, without the agent's controls #33

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/deal-clock:mason/31-each-deal-has-a-client-timeline-one-prin → main 2 commits fork 3 threads · 3 unresolved

  • Merged. mason/31-each-deal-has-a-client-timeline-one-prin was merged into main as c28a514.

Review

Sign in to review this change.
13 files changed +324 −14
README.md +5
@@ -85,6 +85,11 @@ for the same list; over MCP, an agent asks for the `this_week` tool.
8585 12. **Download the calendar file.** On a deal's page, tap Add to calendar.
8686 You get a calendar file with every date of the deal and an alarm three days
8787 before and the morning of, to open in your own calendar app.
88 13. **Print the client timeline.** On a sample deal's page, tap Client
89 timeline: its dates in order, who owes each and whether it is done,
90 upcoming or overdue, with no controls. Print it with your browser's print
91 to hand to a buyer or seller. In the terminal, open the deal with o and press
92 t; over MCP, an agent asks for the `client_timeline` tool.
8893
8994 ## What is real, and what is not yet
9095
docs/TECHNICAL.md +8 −1
@@ -36,13 +36,20 @@ sent until undone. Over the API: `POST /api/deals/:id/reminders/decline` and
3636 `decline_reminder` and `undo_decline_reminder`; in the terminal, `n` then the
3737 reason on the reminders list, and `u` to undo. Each is an update of the deal.
3838
39 `GET /deals/:id/timeline` is a deal's printable client timeline: its dates in
40 order, who owes each, and Done, Upcoming or Overdue in words, with no forms,
41 contacts or script (`src/pages/timeline.ts`, rows from `src/timeline.ts`). It
42 reads like the deal page: `deal` read through `permit`, 401 signed out, 404 for
43 no such deal. Over MCP it is `client_timeline`; in the terminal, `t` on an open
44 deal (`b` goes back). Its print rules in `static/app.css` apply to that page only.
45
3946 A deal is **closed** when its Closing date is marked done (derived, no column; `closed` on `GET /api/deals` and `list_deals`). It leaves the clock for the Closed card, sends no reminders (`/tick`, `reminders_today`, the terminal `r` list), and the terminal date list shows its dates only after `h`. Reopening the Closing date reopens the deal.
4047
4148 `POST /tick` answers the reminders that go out today and are not yet
4249 marked sent, as JSON — call it each morning as a signed-in account (a
4350 stranger gets 401; it sends nothing and changes nothing). `GET /deals/:id/ics` is a deal's calendar file. The JSON API is
4451 `/api/deals`, described at `/openapi.json`; the same operations are MCP
45 tools at `POST /mcp` (`list_deals`, `get_deal`, `reminders_today`, `this_week`,
52 tools at `POST /mcp` (`list_deals`, `get_deal`, `client_timeline`, `reminders_today`, `this_week`,
4653 `open_deal`, `add_date`, `add_party`, `edit_party`, `remove_party`,
4754 `remove_date` — custom dates only — `remove_deal` — its author or an admin —
4855 `mark_done` — with `done: false` to
docs/design/areas/timeline.md added +10
@@ -0,0 +1,10 @@
1 # Timeline
2
3 Classes on `/deals/:id/timeline`, the page handed to a client. It prints portrait Letter/A4, black on white, with no header, footer or tools.
4
5 - `.timeline` — the page's one section.
6 - `.timeline-tools` — the hint to print and the link back; on screen only.
7 - `body.timeline-page` — scopes every print rule to this page.
8 - `.timeline-list` — the ordered list of dates, no markers.
9 - `.timeline-row` — one date; never split across printed pages.
10 - `.timeline-date`, `.timeline-label`, `.timeline-owner`, `.timeline-status` — its four facts; the status is words first, with a mark.
src/mcp.ts +12
@@ -29,6 +29,7 @@ import {
2929 import { agent, title } from "./env.ts";
3030 import { dueOn } from "./reminders.ts";
3131 import { fields } from "./http.ts";
32 import { timelineRows } from "./timeline.ts";
3233 import { owner, thisWeek } from "./week.ts";
3334 import type { Who } from "./who.ts";
3435
@@ -56,6 +57,17 @@ export const tools: readonly Tool[] = [
5657 inputSchema: { type: "object", properties: { id: { type: "integer" } }, required: ["id"] },
5758 run: (db, who, args) => getDeal(db, who, { id: Number(args.id) }),
5859 },
60 {
61 name: "client_timeline",
62 description: "One deal's dates as a client would receive them: address, the agent, and each date in due order with who owes it and whether it is Done, Upcoming or Overdue. No contacts, drafts or reasons.",
63 inputSchema: { type: "object", properties: { id: { type: "integer" } }, required: ["id"] },
64 run: (db, who, args) => {
65 const got = getDeal(db, who, { id: Number(args.id) });
66 if (!got.ok) return got;
67 const dates = timelineRows(got.value, today()).map(({ label, due, role, name, status }) => ({ label, due, owed_by: { role, name: name ?? null }, status }));
68 return { ok: true, value: { address: got.value.address, agent, dates } };
69 },
70 },
5971 {
6072 name: "reminders_today",
6173 description: "The reminder drafts that go out today and have not been sent.",
src/pages/deal.ts +1 −1
@@ -110,7 +110,7 @@ export function dealPage(input: {
110110 <h1>${escape(deal.address)}</h1>
111111 <p class="summary">${deal.closed ? `<b>Closed on ${escape(spoken(closedOn(deal)))}</b> · ` : ""}Under contract ${escape(spoken(deal.contract_date))} · closes ${escape(spoken(deal.closing))}, ${escape(relative(deal.closing, on))}${deal.business_days ? " · business days" : ""}</p>
112112 </div>
113 <a class="button button-quiet" href="${path}/ics" download>Add to calendar</a>
113 <div class="row"><a class="button button-quiet" href="${path}/timeline">Client timeline</a> <a class="button button-quiet" href="${path}/ics" download>Add to calendar</a></div>
114114 </section>
115115 <div id="deal" data-live="deal.changed">
116116 <section class="card">
src/pages/layout.ts +15 −7
@@ -25,8 +25,12 @@ export function layout(input: {
2525 path: string;
2626 heading?: string;
2727 notice?: string | undefined;
28 /** A page handed to someone outside the app: the brand only, no sign-in, footer or script. */
29 plain?: boolean;
30 /** A class on <body>, for styles that belong to one page only. */
31 bodyClass?: string;
2832 }): string {
29 const { body, who, path, notice } = input;
33 const { body, who, path, notice, plain = false, bodyClass } = input;
3034 const pageTitle = input.heading === undefined ? title : `${input.heading} · ${title}`;
3135 const to = encodeURIComponent(path);
3236 const door =
@@ -54,26 +58,30 @@ export function layout(input: {
5458 <meta name="twitter:description" content="${escape(description)}">
5559 <link rel="stylesheet" href="${tokensHref}">
5660 <link rel="stylesheet" href="${asset("app.css")}">
57 <script type="module" src="${asset("live.js")}"></script>
58 <body>
61 ${plain ? "" : `<script type="module" src="${asset("live.js")}"></script>`}
62 <body${bodyClass === undefined ? "" : ` class="${escape(bodyClass)}"`}>
5963 <div class="page">
6064 <header class="head">
6165 <a class="brand" href="/">
6266 <span class="brand-mark" aria-hidden="true"></span>
6367 <span><b>${escape(agent.name)}</b><small>${escape(agent.brokerage)}</small></span>
6468 </a>
65 <nav class="row">
69 ${
70 plain
71 ? ""
72 : `<nav class="row">
6673 ${env === "production" ? "" : `<span class="pill" data-env="${escape(env)}">${escape(where)}</span>`}
6774 ${door}
68 </nav>
75 </nav>`
76 }
6977 </header>
7078 <main>${body}</main>
71 <footer class="muted">
79 ${plain ? "" : `<footer class="muted">
7280 <p>${escape(title)}${commit ? ` <span class="mono">${escape(commit)}</span>` : ""} — reminders here are drafted and marked sent; nothing is emailed or texted yet.</p>
7381 ${ssh === undefined ? "<p>The terminal is off.</p>" : `<p>Terminal: <code>${escape(ssh)}</code></p>`}
7482 <p>Also at <a href="/api/deals">/api/deals</a> (<a href="/openapi.json">described</a>), <code>POST /tick</code> and <code>POST /mcp</code>, with the same rules.</p>
7583 <p>Something wrong? <a href="/__forge/report">Report a problem</a>, no account needed.</p>
76 </footer>
84 </footer>`}
7785 </div>
7886 ${notice === undefined ? "" : `<p class="toast" role="status">${escape(notice)}</p>`}
7987 </body>
src/pages/timeline.ts added +35
@@ -0,0 +1,35 @@
1 /**
2 * A deal's client timeline at `/deals/:id/timeline`: the page the agent
3 * shows or prints for a buyer or seller. Its dates in due order, who owes
4 * each and whether it is done, upcoming or overdue — and nothing internal:
5 * no forms, drafts, reasons, audit or contacts. No script is sent.
6 */
7
8 import type { DealView } from "../deals.ts";
9 import { agent } from "../env.ts";
10 import { escape } from "../http.ts";
11 import { timelineRows } from "../timeline.ts";
12 import type { Who } from "../who.ts";
13 import { layout } from "./layout.ts";
14
15 export function timelinePage(input: { who: Who; deal: DealView; on: string }): string {
16 const { who, deal, on } = input;
17 const path = `/deals/${deal.id}/timeline`;
18 const rows = timelineRows(deal, on)
19 .map(
20 (r) => `<li class="timeline-row" data-u="${r.urgency}">
21 <p class="timeline-date">${escape(r.spoken)}</p>
22 <p class="timeline-label"><b>${escape(r.label)}</b></p>
23 <p class="timeline-owner">${escape(r.role)}${r.name === undefined ? "" : ` · ${escape(r.name)}`}</p>
24 <p class="timeline-status"><span aria-hidden="true">${r.mark}</span> ${r.status}</p>
25 </li>`,
26 )
27 .join("");
28 const body = `<p class="crumb timeline-tools"><a href="/deals/${deal.id}">← Back to the deal</a> · To print, use your browser's print (Ctrl/Cmd+P)</p>
29 <section class="timeline">
30 <h1>${escape(deal.address)}</h1>
31 <p class="summary">Key dates, prepared by ${escape(agent.name)}, ${escape(agent.brokerage)}</p>
32 <ol class="timeline-list">${rows}</ol>
33 </section>`;
34 return layout({ body, who, path, heading: `Timeline · ${deal.address}`, plain: true, bodyClass: "timeline-page" });
35 }
src/routes.ts +20
@@ -61,6 +61,7 @@ import { rpc } from "./mcp.ts";
6161 import { clock } from "./pages/clock.ts";
6262 import { dealPage, newDealPage } from "./pages/deal.ts";
6363 import { refusedPage } from "./pages/refused.ts";
64 import { timelinePage } from "./pages/timeline.ts";
6465 import { dueOn } from "./reminders.ts";
6566 import { tokensCss } from "./tokens.ts";
6667 import type { Who } from "./who.ts";
@@ -355,6 +356,25 @@ export const routes: readonly Route[] = [
355356 return html(dealPage({ who: c.who, deal: found.value, on: today(), notice }), 200, clear);
356357 },
357358 },
359 {
360 method: "GET",
361 path: "/deals/:id/timeline",
362 handle: (c) => {
363 const found = getDeal(c.db, c.who, { id: Number(c.params.id) });
364 if (!found.ok)
365 return html(
366 refusedPage({
367 who: c.who,
368 path: c.url.pathname,
369 heading: found.error === "not_found" || found.error === "invalid" ? "No such deal" : "A deal",
370 error: found.error,
371 message: found.message,
372 }),

The same data must be reachable from the terminal and MCP (tool with the same getDeal gate); only the web door has it now.

373 STATUS[found.error],
374 );
375 return html(timelinePage({ who: c.who, deal: found.value, on: today() }));
376 },
377 },
358378 {
359379 method: "GET",
360380 path: "/deals/:id/ics",
src/server.test.ts +18
@@ -156,6 +156,7 @@ test("the MCP server lists the tools and calls them as the caller", async () =>
156156 expect(listed.result.tools.map((t: { name: string }) => t.name)).toEqual([
157157 "list_deals",
158158 "get_deal",
159 "client_timeline",
159160 "reminders_today",
160161 "this_week",
161162 "mark_done",
@@ -431,10 +432,27 @@ test("a deal's page, its calendar file, and a 404 for one that is not there", as
431432 expect(guestPage).toContain(`/__forge/signin?to=${encodeURIComponent(`/deals/${deal.id}`)}`);
432433 expect(guestPage).not.toContain(deal.address.replace("&", "&amp;"));
433434 expect((await fetch(`${base}/deals/${deal.id}/ics`)).status).toBe(401);
435 const guestTimeline = await fetch(`${base}/deals/${deal.id}/timeline`);
436 expect(guestTimeline.status).toBe(401);
437 expect(await guestTimeline.text()).not.toContain(deal.address.replace("&", "&amp;"));
438 const timeline = await api(`/deals/${deal.id}/timeline`, {}, alice);
439 expect(timeline.status).toBe(200);
440 const timelineHtml = await timeline.text();
441 expect(timelineHtml).toContain(deal.address.replace("&", "&amp;"));
442 expect(timelineHtml).not.toContain("live.js");
443 expect(timelineHtml).not.toContain("<footer");
444 expect(timelineHtml).not.toContain("<nav");
445 expect(timelineHtml).toContain('<body class="timeline-page">');
446 const tool = (await rpc({ jsonrpc: "2.0", id: 11, method: "tools/call", params: { name: "client_timeline", arguments: { id: deal.id } } }, alice)).result;
447 expect(JSON.parse(tool.content[0].text).dates[0]).toHaveProperty("owed_by");
448 expect(JSON.stringify(tool)).not.toContain("contact");
449 expect((await api(`/deals/999999/timeline`, {}, alice)).status).toBe(404);
450 expect(await (await api(`/deals/${deal.id}`, {}, alice)).text()).toContain("<footer");
434451 expect((await fetch(`${base}/api/deals`)).status).toBe(401);
435452 const page = await (await api(`/deals/${deal.id}`, {}, alice)).text();
436453 expect(page).toContain(deal.address.replace("&", "&amp;"));
437454 expect(page).toContain(`href="/deals/${deal.id}/ics"`);
455 expect(page).toContain(`href="/deals/${deal.id}/timeline"`);
438456 expect(page).toContain('popover id="sheet-');
439457 const ics = await api(`/deals/${deal.id}/ics`, {}, alice);
440458 expect(ics.headers.get("content-type")).toContain("text/calendar");
src/terminal.ts +21 −5
@@ -6,6 +6,7 @@
66 * dates every open date of every deal, soonest first (h shows done ones)
77 * week the open dates overdue or due in the next seven days, by day
88 * reminders what goes out today; enter reads a draft, e edits its words, s sends it
9 * timeline a deal's dates as a client would get them (t on a deal)
910 * deal one deal's dates and parties; a adds a date, p a party, D removes it
1011 *
1112 * On a date (dates or deal view): x marks it done, u reopens it, m moves it
@@ -15,6 +16,7 @@
1516 */
1617
1718 import type { Database } from "bun:sqlite";
19 import { timelineRows } from "./timeline.ts";
1820 import { isDate, relative, spoken, today, urgency, type Urgency } from "./dates.ts";
1921 import {
2022 addDeadline,
@@ -54,7 +56,7 @@ const bold = (s: string): string => `${esc}1m${s}${esc}0m`;
5456 const COLOUR: Readonly<Record<Urgency, string>> = { overdue: "31", soon: "33", later: "36", done: "2" };
5557 const tint = (u: Urgency, s: string): string => `${esc}${COLOUR[u]}m${s}${esc}0m`;
5658
57 type View = "dates" | "week" | "reminders" | "deal" | "messages";
59 type View = "dates" | "week" | "reminders" | "deal" | "messages" | "timeline";
5860 interface Row {
5961 readonly deal: DealView;
6062 readonly date: DeadlineView;
@@ -337,12 +339,15 @@ export function terminal(
337339 }
338340 if (key === "j") cursor = Math.min(cursor + 1, Math.max(0, rowCount() - 1));
339341 else if (key === "k") cursor = Math.max(cursor - 1, 0);
340 else if (view === "messages" && (key === "b" || key === "\x1b")) {
342 else if ((view === "messages" || view === "timeline") && (key === "b" || key === "\x1b")) {
341343 view = "deal";
342344 cursor = 0;
343345 reading = undefined;
344346 } else if (view === "messages" && key === "\r") reading = reading === cursor ? undefined : cursor;
345 else if (view === "deal" && key === "s") {
347 else if (view === "deal" && key === "t") {
348 view = "timeline";
349 cursor = 0;
350 } else if (view === "deal" && key === "s") {
346351 view = "messages";
347352 cursor = 0;
348353 reading = undefined;
@@ -379,7 +384,7 @@ export function terminal(
379384 showDone = !showDone;
380385 cursor = 0;
381386 } else if (view === "reminders") onReminder(key);
382 else if (view === "messages") return;
387 else if (view === "messages" || view === "timeline") return;
383388 else if (!(view === "deal" && onDeal(key))) onDate(key);
384389 cursor = Math.min(cursor, Math.max(0, rowCount() - 1));
385390 }
@@ -443,6 +448,15 @@ export function terminal(
443448 if (reading === i) lines.push("", ` ${bold(m.subject === "" ? "(words not kept)" : m.subject)}`, ...m.body.split("\n").map((l) => ` ${l}`), "");
444449 });
445450 }
451 } else if (view === "timeline") {
452 const deal = openDeal();
453 if (deal === undefined) lines.push(dim("That deal is gone."));
454 else {
455 lines.push(bold(`Client timeline — ${deal.address}`), dim(`${context.agent.name}, ${context.agent.brokerage}`), "");
456 timelineRows(deal, day).forEach((r) =>
457 lines.push(` ${tint(r.urgency, `${r.spoken.padEnd(16)} ${r.status.padEnd(9)}`)} ${r.label} · ${r.name === undefined ? r.role : `${r.role}: ${r.name}`}`),
458 );
459 }
446460 } else if (view === "deal") {
447461 const deal = openDeal();
448462 if (deal === undefined) lines.push(dim("That deal is gone."));
@@ -478,8 +492,10 @@ export function terminal(
478492 ? "j/k move · enter read · e edit · s send · n don't send · u undo · d dates · q quit"
479493 : view === "messages"
480494 ? "j/k move · enter read · b back to the deal · d dates · q quit"
495 : view === "timeline"
496 ? "b back to the deal · d dates · q quit"
481497 : view === "deal"
482 ? "j/k move · s messages · x done · u reopen · m move · a add date · p add party · e edit party · X remove date/party · D remove deal · b back · q quit"
498 ? "j/k move · t client timeline · s messages · x done · u reopen · m move · a add date · p add party · e edit party · X remove date/party · D remove deal · b back · q quit"
483499 : `j/k move · x done · u reopen · m move · o open deal · n new deal · c check dates · h ${showDone ? "hide" : "show"} done · w this week · r reminders · q quit`;
484500 lines.push(dim(me.role === "anon" ? `${keys} · sign in with a key the forge knows to change anything` : keys));
485501 }
src/timeline.test.ts added +80
@@ -0,0 +1,80 @@
1 /** The client timeline: the deal's dates and owners, and nothing internal. */
2 import { expect, test } from "bun:test";
3 import { mkdtempSync } from "node:fs";
4 import { tmpdir } from "node:os";
5 import { join } from "node:path";
6 import { addDeadline, addParty, createDeal, getDeal, markDone, removeDeadline } from "./deals.ts";
7 import { terminal } from "./terminal.ts";
8 import { openDb } from "./db.ts";
9 import { timelinePage } from "./pages/timeline.ts";
10 import type { Who } from "./who.ts";
11
12 const db = openDb(mkdtempSync(join(tmpdir(), "app-timeline-")));
13 const alice: Who = { role: "user", id: "u1", name: "alice" };
14
15 const made = createDeal(db, alice, { address: "9 <b>Oak</b> Rd", buyer: "Ann Buyer", seller: "Sam Seller", contractDate: "2026-10-01", closingDate: "2026-11-06" });
16 if (!made.ok) throw new Error(made.message);
17 const id = made.value.id;
18 addParty(db, alice, { dealId: id, role: "lender", name: "Lena Lender", contact: "[email protected]" });
19 addParty(db, alice, { dealId: id, role: "buyer", name: "Ann Buyer", contact: "[email protected]" });
20 const keep = addDeadline(db, alice, { dealId: id, label: "HOA review ends", due: "2026-10-20", owes: "buyer", what: "" });
21 const drop = addDeadline(db, alice, { dealId: id, label: "Gone repair date", due: "2026-10-22", owes: "seller", what: "" });
22 if (!keep.ok || !drop.ok) throw new Error("setup");
23 removeDeadline(db, alice, { dealId: id, id: drop.value.id });
24 const inspection = getDeal(db, alice, { id });
25 if (!inspection.ok) throw new Error("setup");
26 markDone(db, alice, { id: inspection.value.deadlines.find((d) => d.kind !== "closing")!.id, done: true });
27
28 const page = (on: string): string => {
29 const deal = getDeal(db, alice, { id });
30 if (!deal.ok) throw new Error(deal.message);
31 return timelinePage({ who: alice, deal: deal.value, on });
32 };
33
34 test("lists the dates in due order with owners and status words", () => {
35 const html = page("2026-10-25");
36 const dates = [...html.matchAll(/timeline-label"><b>([^<]*)</g)].map((m) => m[1]);
37 expect(dates).toContain("HOA review ends");
38 expect(html.indexOf("HOA review ends")).toBeLessThan(html.indexOf("Closing"));
39 expect(html).toContain("Buyer · Ann Buyer");
40 expect(html).toContain("Overdue");
41 expect(html).toContain("Done");
42 expect(html).toContain("Upcoming");
43 expect(html).toContain("Dana Whitfield");
44 });
45
46 test("has no forms, scripts, contacts or removed dates, and escapes the address", () => {
47 const html = page("2026-10-25");
48 expect(html).not.toContain("<form");
49 expect(html).not.toContain("<script");
50 expect(html).not.toContain("<button");
51 expect(html).not.toContain("[email protected]");
52 expect(html).not.toContain("[email protected]");
53 expect(html).not.toContain("Gone repair date");
54 expect(html).toContain("9 &lt;b&gt;Oak&lt;/b&gt; Rd");
55 expect(html).not.toContain("<b>Oak</b>");
56 });
57
58 test("the print rules are scoped to the timeline page", async () => {
59 const css = await Bun.file(join(import.meta.dir, "..", "static", "app.css")).text();
60 const print = css.slice(css.indexOf("@media print"));
61 const selectors = [...print.matchAll(/^\s*([^{}@\n]+)\{/gm)].map((m) => m[1]!.trim());
62 expect(selectors.length).toBeGreaterThan(0);
63 for (const sel of selectors) for (const part of sel.split(",")) expect(part.trim()).toStartWith(".timeline-page");
64 });
65
66 test("the terminal shows the same dates and owners for the open deal, ", () => {
67 const t = terminal(db, alice, { title: "deal-clock", where: "test", agent: { name: "Dana", brokerage: "HP" }, on: () => "2026-10-25" });
68 const row = (): string => t.screen().join("\n").split("\n").find((l) => l.startsWith("▸")) ?? "";
69 for (let i = 0; i < 300 && !row().includes("HOA review ends"); i++) t.press("j");
70 t.press("o");
71 t.press("t");
72 const screen = t.screen().join("\n").replace(/\x1b\[[0-9;]*m/g, "");
73 expect(screen).toContain("Client timeline");
74 expect(screen).toContain("HOA review ends");
75 expect(screen).toContain("Buyer: Ann Buyer");
76 expect(screen).toContain("Overdue");
77 expect(screen).not.toContain("[email protected]");
78 t.press("b");
79 expect(t.screen().join("\n")).not.toContain("Client timeline");
80 });
src/timeline.ts added +42
@@ -0,0 +1,42 @@
1 /**
2 * What a client is told about a deal's dates: each in due order with who owes
3 * it and whether it is done, upcoming or overdue. Plain data from a deal and
4 * a day, shared by the page, the terminal and the MCP tool; it holds nothing
5 * internal — no notes, drafts, reasons or contacts.
6 */
7
8 import { spoken, urgency, type Urgency } from "./dates.ts";
9 import type { DealView } from "./deals.ts";
10 import { owner } from "./week.ts";
11
12 export type TimelineStatus = "Done" | "Upcoming" | "Overdue";
13
14 /** Words first, so black and white reads the same as colour; the mark is only a helper. */
15 const STATUS: Readonly<Record<Urgency, { mark: string; word: TimelineStatus }>> = {
16 done: { mark: "✓", word: "Done" },
17 overdue: { mark: "!", word: "Overdue" },
18 soon: { mark: "○", word: "Upcoming" },
19 later: { mark: "○", word: "Upcoming" },
20 };
21
22 export interface TimelineRow {
23 readonly label: string;
24 /** ISO date. */
25 readonly due: string;
26 /** "Thu, Oct 15, 2026". */
27 readonly spoken: string;
28 /** The role that owes it, and the deal's party in that role if it has one. */
29 readonly role: string;
30 readonly name: string | undefined;
31 readonly status: TimelineStatus;
32 readonly mark: string;
33 readonly urgency: Urgency;
34 }
35
36 export function timelineRows(deal: DealView, on: string): TimelineRow[] {
37 return deal.deadlines.map((d) => {
38 const u = urgency(d.due, on, d.done_at !== null);
39 const { name, role } = owner(deal, d);
40 return { label: d.label, due: d.due, spoken: spoken(d.due), role, name, status: STATUS[u].word, mark: STATUS[u].mark, urgency: u };
41 });
42 }
static/app.css +57
@@ -781,3 +781,60 @@ textarea.input {
781781 .week-row .badge {
782782 flex: none;
783783 }
784
785 /* The client timeline. */
786 .timeline-list {
787 list-style: none;
788 margin: var(--space-4) 0 0;
789 padding: 0;
790 }
791 .timeline-row {
792 display: grid;
793 grid-template-columns: 11rem 1fr 14rem 7rem;
794 gap: var(--space-1) var(--space-3);
795 padding: var(--space-3) 0;
796 border-top: 1px solid var(--color-line);
797 }
798 .timeline-row p {
799 margin: 0;
800 }
801 .timeline-status {
802 font-weight: 650;
803 }
804 .timeline-row[data-u="overdue"] .timeline-status {
805 color: var(--color-overdue);
806 }
807 @media (max-width: 40rem) {
808 .timeline-row {
809 grid-template-columns: 1fr;
810 }
811 }
812
813 /* On paper: only the client timeline changes — black on white, no tools, no row split. */
814 @media print {
815 .timeline-page {
816 background: white;
817 color: black;
818 }
819 .timeline-page .head,
820 .timeline-page footer,
821 .timeline-page .timeline-tools {
822 display: none;
823 }
824 .timeline-page .page {
825 max-width: none;
outdated

These selectors hide controls on every page when printed. Scope them under the timeline page only.

826 padding: 0;
827 }
828 .timeline-page .timeline-row {
829 grid-template-columns: 30% 1fr 25% 15%;
830 break-inside: avoid;
831 border-color: black;
832 color: black;
833 }
834 .timeline-page .timeline-row[data-u="overdue"] .timeline-status {
835 color: black;
836 }
837 @page {
838 margin: 15mm;
839 }
840 }

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs