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

The desk and a lead's page work on a phone: no sideways scroll, readable text, buttons a thumb can hit #72

Merged opened this

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

Merged

mason/speed-to-lead:mason/70-the-desk-and-a-lead-s-page-work-on-a-pho → main 1 commit fork

  • Merged. mason/70-the-desk-and-a-lead-s-page-work-on-a-pho was merged into main as e567413.

Review

Sign in to review this change.
3 files changed +115 −1
docs/design/areas/desk.md added +14
@@ -0,0 +1,14 @@
1 # Desk: the phone
2
3 The agent opens the desk and a lead's page on a phone in the meeting. Under
4 40rem (`@media (max-width: 40rem)` in `static/app.css`), CSS only:
5
6 - `--text-sm` is raised to 1rem, so no text is under 16px and iOS does not zoom.
7 - `.lead-row` collapses to one column, the `.clock` first; the desk is a list,
8 not a table, so nothing scrolls sideways.
9 - `.actions` and `.states` become one full-width column of `.button`s; every
10 button, tab (`.views a`) and `Clear` link is at least `--size-tap` (44px).
11 - The header's `.row` wraps.
12
13 No new component class: the rules extend `.lead-row`, `.actions`, `.states`,
14 `.button`, `.views`, `.search` and `.plan`.
src/design.test.ts +26 −1
@@ -4,7 +4,7 @@
44 * anywhere but design/tokens.json.
55 */
66 import { expect, test } from "bun:test";
7 import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
7 import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
88 import { tmpdir } from "node:os";
99 import { join } from "node:path";
1010 import { lint, rawColours, unknownTokens } from "../scripts/lint-design.ts";
@@ -119,3 +119,28 @@ test("the lint refuses a raw colour and a token that is not there", () => {
119119 "static/extra.css:2: raw colour #fff — name it in design/tokens.json and use var(--…)",
120120 ]);
121121 });
122
123 // A phone: no sideways scroll, 16px text, controls a thumb can hit.
124 test("the stylesheet has the phone rules for the lead list and the buttons", () => {
125 const css = readFileSync(join(import.meta.dir, "../static/app.css"), "utf8");
126 const phone = css.slice(css.indexOf("@media (max-width: 40rem)"));
127 expect(phone).toContain("--text-sm: 1rem;");
128 expect(phone).toMatch(/\.lead-row\s*\{\s*grid-template-columns: minmax\(0, 1fr\);/);
129 expect(phone).toMatch(/\.button,[^{]*\{\s*min-height: var\(--size-tap\);/);
130 expect(phone).toContain(".actions,");
131 expect(token("size-tap")).toBe("44px");
132 expect(token("text-base")).toBe("1rem");
133 });
134
135 test("every page sends the viewport meta", async () => {
136 const { layout } = await import("./pages/layout.ts");
137 const html = layout({
138 body: "<p>x</p>",
139 who: { role: "anon", name: "" } as never,
140 agent: { name: "A", brokerage: "B", license: "C" } as never,
141 path: "/",
142 });
143 expect(html).toContain(
144 '<meta name="viewport" content="width=device-width, initial-scale=1">',
145 );
146 });
static/app.css +75
@@ -649,3 +649,78 @@ label.check input {
649649 padding-left: var(--space-3);
650650 border-left: 3px solid var(--color-brass);
651651 }
652
653 /* A phone (375px and up to 40rem): nothing scrolls sideways, text is 16px,
654 a thumb hits every control. CSS only; the markup is the same. */
655 @media (max-width: 40rem) {
656 :root {
657 --text-sm: 1rem;
658 }
659 .page {
660 padding-left: var(--space-3);
661 padding-right: var(--space-3);
662 }
663 .row {
664 flex-wrap: wrap;
665 }
666 .head nav.row {
667 gap: var(--space-1) var(--space-2);
668 }
669 .you {
670 white-space: normal;
671 overflow-wrap: anywhere;
672 }
673 /* A lead stacks: the clock above, the words below, full width. */
674 .lead-row {
675 grid-template-columns: minmax(0, 1fr);
676 }
677 .lead-row .clock {
678 order: -1;
679 justify-items: start;
680 text-align: left;
681 justify-self: start;
682 }
683 .plan li {
684 grid-template-columns: minmax(0, 1fr);
685 }
686 /* Every action is a full-width bar, 44px tall at least. */
687 .actions,
688 .states {
689 display: grid;
690 grid-template-columns: minmax(0, 1fr);
691 }
692 .actions form,
693 .states form,
694 .actions .button,
695 .states .button,
696 .actions summary {
697 width: 100%;
698 box-sizing: border-box;
699 }
700 .actions .button,
701 .states .button {
702 white-space: normal;
703 }
704 .button,
705 .views a,
706 .found a {
707 min-height: var(--size-tap);
708 }
709 .views a,
710 .found a {
711 display: inline-flex;
712 align-items: center;
713 }
714 .search {
715 flex-wrap: wrap;
716 }
717 .search .button {
718 flex: 1 0 100%;
719 }
720 .button {
721 white-space: normal;
722 }
723 .toast {
724 bottom: var(--space-3);
725 }
726 }

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs