diff --git a/docs/GLOSSARY.md b/docs/GLOSSARY.md index 95f8a908d7..121d77dbd2 100644 --- a/docs/GLOSSARY.md +++ b/docs/GLOSSARY.md @@ -7012,6 +7012,7 @@ since v2.9156 a paid lien whose release was asked for in writing counts the ten since v2.9159 the line under Lien released ends with the door **Show all ›** while a released lien is older than the 90 days, which lists every one (`keepAll`), and **The last 90 days ›** goes back; since v2.9180 (finding 776) the card a chip shows when it is pointed at names the year of a day that is not this year, so a suit day a year off no longer reads as two weeks off; since v2.9244 (punch list #483, the owner's *Yes, third column* of 2026-12-02) a wide Board has a third column, **Liens on record**, which holds Lien in place, Paid awaiting release, Lien released and the lapsed end, with an arrow crossing into it from Filed · copies to mail, while a narrower Board keeps two columns with those bins under the filing (`lienBoardColumns`), and two bins stand 12 px apart; +since v2.9275 (punch list #483 step 2, the owner's picks of 2026-12-03) a computer's Board has **Fold ▴** at the right end of the line that names the columns, which folds the bins away under the four tiles and leaves one line, *The flow is folded · 31 papers in 12 bins*, with **Show the flow ▾**, kept for the login on that device (`lienBoardFold.ts`); a lien still owed past its suit day stands at a second closed end, *Suit day passed · lien lapsed*; since v2.9201 the office answers a lapsed lien from that bin's press **Answer N ›** or from its chip, in **the lapsed window** (`LienLapsedWindow`): *Suit was filed*, *Released* or *Let it lapse, ask the attorney*, kept on the lien with who and when, after which the lien leaves the bin; the line under the bin counts the answered liens, which stay in reach for good since v2.9270, and its door **Show ›** opens each one with its answer and **Take the answer back**, and an answer files, releases and voids nothing; diff --git a/docs/LIEN_DESK_ARCHITECTURE.md b/docs/LIEN_DESK_ARCHITECTURE.md index ea1256d6d3..96676bede5 100644 --- a/docs/LIEN_DESK_ARCHITECTURE.md +++ b/docs/LIEN_DESK_ARCHITECTURE.md @@ -275,6 +275,10 @@ last_updated: 2026-12-03 > Under `LIEN_BOARD_STACK_UNDER_PX` it stacks as before. > `lienBoardArrowPaths` draws a down arrow whose next bin stands in the column to the right as a crossing one along the gutter between the two, so *Filed · copies to mail* crosses into *Lien in place* as *Sent* crosses into *Waiting on its notice*. > Two bins of a flow stand `LIEN_BOARD_BIN_GAP_PX` apart, 12 px (22 px until then), in every layout. +> Since v2.9275 (punch list #483 step 2, finding 863, the owner's picks of 2026-12-03) a computer's Board folds to its tiles: `LienBoard` takes `foldFor`, the login, and draws **Fold ▴** (`data-lien-board-fold`) at the end of the last column head's line, or the first head's where the columns stack. +> Folded, the grid (`data-folded`) holds one line (`data-lien-board-folded`) from `lienBoardFoldedLine` in [`lienBoardFold.ts`](../src/lib/jobs/lienBoardFold.ts) with **Show the flow ▾** (`data-lien-board-unfold`), and the tiles and the desk's lines stay. +> `readLienBoardFolded` and `writeLienBoardFolded` keep the fold in the device's store, one entry a login, and the Board starts open. +> A phone's Board and a Board with no `foldFor` never fold. > `buildLienBoard` takes `serve` (every filed affidavit whose copies are not mailed, from `lienServeJobsFromDesk`): a filed entry listed there stays in `filed` and races its serve-by day, one that is not moves to `served`, and a lien listed with no affidavit on the desk still gets a chip. > Neither bin counts in the tiles. > `lienBoardRowBin` gives `serve:` rows that bin; diff --git a/docs/recent-features/v2.9275.md b/docs/recent-features/v2.9275.md new file mode 100644 index 0000000000..1895517421 --- /dev/null +++ b/docs/recent-features/v2.9275.md @@ -0,0 +1,24 @@ +# v2.9275 — Lien desk: the Board folds to its tiles, so the list starts higher (2026-12-03) + +Punch list #483, step 2, on the owner's two picks of 2026-12-03 (sheet 4 of run 19): the Board starts open until a person folds it, and the press stands as drawn. Finding 863: after the third column (v2.9244) the live Board still stood 727 px, so the list began 152 px under the screen at 1280 by 800 and 52 px under it at 1,440 by 900. Client only. No migration, no function change, nothing owed on prod. + +## What changed + +- [`lienBoardFold.ts`](../../src/lib/jobs/lienBoardFold.ts) (new, pure): the two presses' words, `lienBoardFoldCount` and `lienBoardFoldedLine` (*The flow is folded · 31 papers in 12 bins*, the two counts marked as values), and `readLienBoardFolded` / `writeLienBoardFolded`, which keep the fold in the device's store under one key a login (`LIEN_BOARD_FOLD_STORAGE_KEY`). No login, no store or a store that throws reads as open. An open Board keeps no entry. +- [`LienBoard.tsx`](../../src/components/jobs/LienBoard.tsx) takes `foldFor`, the login the fold is kept for. With it, a computer's Board draws **Fold ▴** (`data-lien-board-fold`) at the right end of the line that names the columns: on the last column's head side by side, on the first where the columns stack. No line is added between the tiles and the bins, which the owner asked to keep clear on 2026-11-17. +- Folded, the grid keeps its place and its measure (`data-folded="yes"`) and holds one line (`data-lien-board-folded`): what the flow holds, drawn with `ValueSentence`, and **Show the flow ▾** (`data-lien-board-unfold`). The tiles, the line over the bins, the line that says what the list is narrowed to and the leader's line stay. The bins, the arrows, the Retainage line and the desk's own bins under the affidavits fold away. +- `LienDesk` passes its login as `foldFor`. A phone's Board, and a Board with no `foldFor`, draw no fold and are never folded. +- The guide *read the Board on the Lien desk* has a section, *Fold the Board*. + +## What a count is + +A paper is a chip, held and unread ones too. A bin is counted when it holds a paper. A Board with no paper says *The flow is folded · no paper is in it*. + +## Tests + +- `lienBoardFold.test.ts`: the presses' words, the count, the line with many, one and none, the fold kept by login, and a missing or throwing store. +- `LienBoard.fold.render.test.tsx`: open with one **Fold ▴** on the last head, the fold and the way back with the store's entry made and removed, folded for the login that folded it and open for another, and no fold with no login or on a phone. + +## Left + +A read of the live desk at 1280 by 800 and 1,440 by 900 with the Board folded, by the walking desk. diff --git a/src/components/jobs/LienBoard.fold.render.test.tsx b/src/components/jobs/LienBoard.fold.render.test.tsx new file mode 100644 index 0000000000..05cfc17432 --- /dev/null +++ b/src/components/jobs/LienBoard.fold.render.test.tsx @@ -0,0 +1,87 @@ +// @vitest-environment jsdom +/** + * Render smoke for the Board's fold (punch list #483 step 2, finding 863): **Fold ▴** at the right end of the line + * that names the columns, the folded Board's one line with **Show the flow ▾**, the fold kept for the login on the + * device, and a phone or a Board with no login left as it was. + */ +import { afterEach, beforeEach, describe, expect, it } from 'vitest' +import { cleanup, fireEvent, render } from '@testing-library/react' +import LienBoard from './LienBoard' +import { buildLienBoard } from '../../lib/jobs/lienBoard' +import { LIEN_BOARD_FOLD_STORAGE_KEY } from '../../lib/jobs/lienBoardFold' +import type { LienDeskEntry, LienDeskPile } from '../../lib/jobs/lienDesk' +import type { LienAffidavitEntry, LienAffidavitPile } from '../../lib/jobs/lienDeskAffidavits' + +beforeEach(() => window.localStorage.clear()) +afterEach(cleanup) + +// Every job, name and day here is made up. +function notice(jobId: string, pile: LienDeskPile, over: Partial = {}): LienDeskEntry { + return { jobId, customerId: 'c1', gcCustomerId: 'gc1', openBalance: 1000, hasOwner: true, propertyKind: '', months: [], datedFromCreation: false, dueMonths: ['2026-08'], missedMonths: [], missedUnrecorded: [], affidavitDay: null, affidavitDaysLeft: null, earliestDeadline: '2026-11-20', daysLeft: 5, severity: 'amber', item: null, policy: 'ask', pile, ...over } +} +function affidavit(jobId: string, pile: LienAffidavitPile, over: Partial = {}): LienAffidavitEntry { + return { jobId, isSub: true, lastMonth: '2026-07', lastMonthFromCreation: false, deadline: '2026-12-15', daysLeft: 30, severity: 'quiet', openBalance: 1000, customerId: 'c1', gcCustomerId: 'gc1', propertyKind: '', gates: [{ key: 'owner', ok: true, label: 'owner' }], ready: true, item: null, pile, ...over } +} +const board = () => + buildLienBoard({ + todayYmd: '2026-11-15', + notices: [notice('2104', 'to_draft'), notice('2105', 'to_draft')], + affidavits: [affidavit('2111', 'ready')], + retainage: [], + jobNumber: (id) => id, + jobName: (id) => `ZZ Test ${id}`, + gcName: () => 'ZZ Test Builders', + leaderName: 'Sam', + }) + +const q = (sel: string) => document.querySelector(sel) +const all = (sel: string) => Array.from(document.querySelectorAll(sel)) + +describe('LienBoard · the fold to the tiles (punch list #483 step 2)', () => { + it('starts open, with Fold ▴ at the end of the last column head’s line and nowhere else', () => { + render() + expect(all('[data-lien-board-fold]').map((b) => b.textContent)).toEqual(['Fold ▴']) + const heads = all('[data-lien-board-heading]') + expect(heads[heads.length - 1]!.querySelector('[data-lien-board-fold]')).not.toBeNull() + expect(q('[data-lien-board-folded]')).toBeNull() + expect(all('[data-lien-board-bin]').length).toBeGreaterThan(0) + }) + + it('a press folds the bins away, keeps the tiles, and says what the flow holds with the way back', () => { + render() + fireEvent.click(q('[data-lien-board-fold]')!) + expect(all('[data-lien-board-bin]')).toEqual([]) + expect(all('[data-lien-board-heading]')).toEqual([]) + expect(q('[data-lien-board-tiles]')).not.toBeNull() + expect(q('[data-lien-board-folded-words]')!.textContent).toBe('The flow is folded · 3 papers in 2 bins') + expect(q('[data-lien-board-unfold]')!.textContent).toBe('Show the flow ▾') + expect(window.localStorage.getItem(`${LIEN_BOARD_FOLD_STORAGE_KEY}:u1`)).toBe('1') + // The way back opens the bins and forgets the fold. + fireEvent.click(q('[data-lien-board-unfold]')!) + expect(all('[data-lien-board-bin]').length).toBeGreaterThan(0) + expect(q('[data-lien-board-folded]')).toBeNull() + expect(window.localStorage.getItem(`${LIEN_BOARD_FOLD_STORAGE_KEY}:u1`)).toBeNull() + }) + + it('opens folded for the login that folded it, and open for another login on the same device', () => { + window.localStorage.setItem(`${LIEN_BOARD_FOLD_STORAGE_KEY}:u1`, '1') + const first = render() + expect(q('[data-lien-board-folded]')).not.toBeNull() + expect(all('[data-lien-board-bin]')).toEqual([]) + first.unmount() + render() + expect(q('[data-lien-board-folded]')).toBeNull() + expect(all('[data-lien-board-bin]').length).toBeGreaterThan(0) + }) + + it('a Board with no login, and a phone’s Board, draw no fold and are never folded', () => { + window.localStorage.setItem(`${LIEN_BOARD_FOLD_STORAGE_KEY}:u1`, '1') + const plain = render() + expect(q('[data-lien-board-fold]')).toBeNull() + expect(q('[data-lien-board-folded]')).toBeNull() + plain.unmount() + render() + expect(q('[data-lien-board-fold]')).toBeNull() + expect(q('[data-lien-board-folded]')).toBeNull() + }) +}) diff --git a/src/components/jobs/LienBoard.tsx b/src/components/jobs/LienBoard.tsx index 1db7e964f2..a78583b0b4 100644 --- a/src/components/jobs/LienBoard.tsx +++ b/src/components/jobs/LienBoard.tsx @@ -9,6 +9,8 @@ import { LIEN_BOARD_CARD_WIDTH_PX, lienBoardCardHeight, lienBoardCardPlace, type import { lienBoardTileDoorWords, lienBoardTilePicked } from '../../lib/jobs/lienBoardTileDoor' import { lienBoardDayLabelParts, lienBoardTileLabelSplits } from '../../lib/jobs/lienBoardPhoneTile' import { lienFlowDayLine, lienFlowPickedStage, lienFlowRail, readLienFlowView, writeLienFlowView, type LienFlowView } from '../../lib/jobs/lienBoardFlow' +import { LIEN_BOARD_FOLD_HINT, LIEN_BOARD_FOLD_PRESS, LIEN_BOARD_UNFOLD_HINT, LIEN_BOARD_UNFOLD_PRESS, lienBoardFoldedLine, readLienBoardFolded, writeLienBoardFolded } from '../../lib/jobs/lienBoardFold' +import { ValueSentence } from '../valuesInPlace/ValuesInPlace' import { LienBoardFlowDayLine, LienBoardFlowGrid, LienBoardFlowRail, LienBoardFlowSwitch } from './LienBoardPhoneFlow' /** @@ -485,6 +487,7 @@ export default function LienBoard({ prints, onRetainage, onPinned, + foldFor, }: { board: LienBoardModel isMobile: boolean @@ -508,6 +511,8 @@ export default function LienBoard({ underAffidavits?: ReactNode /** A press on a bin's title line, by the bin's key: *Print 12 liens’ copies ›* or *Enter mail numbers · 12 ›* on *Filed · copies to mail* (punch list #366, by stage since v2.7798), *Enter mail numbers · 6* on *Approved · to mail*, the leader's *Approve 2 affidavits* on his *Awaiting Master approval*, on *Approved · to sign* (v2.7712) the office's reminder or the leader's *Sign 7 notices ›*, and *Send 5 for approval ›* on the affidavits' *To send for Master approval* (v2.7714). */ binPress?: Partial> + /** The login the Board's fold is kept for on this device (v2.9275, punch list #483 step 2). Absent, the Board draws no **Fold ▴** and is never folded. A phone's Board never folds. */ + foldFor?: string | null /** The door at the end of a bin's line (v2.9159): *Show all ›* on *Lien released*. Absent, no bin draws one. */ onFootDoor?: (key: LienBoardBinKey) => void /** The bins whose line's door this caller can open (v2.9201). Absent, every bin with a door. A bin left out draws its line with no door. */ @@ -548,6 +553,18 @@ export default function LienBoard({ // the pointer cross to the next chip without a blink. const boardRef = useRef(null) const [cardShown, setCardShown] = useState<{ key: string; card: LienBoardChipCard; at: ChipCardAt } | null>(null) + // The Board folded to its tiles (v2.9275): open until a person folds it, then as that login left it on this device. + const canFold = !isMobile && Boolean(foldFor) + const [folded, setFolded] = useState(() => canFold && readLienBoardFolded(flowViewStore(), foldFor)) + useEffect(() => { + setFolded(canFold && readLienBoardFolded(flowViewStore(), foldFor)) + }, [canFold, foldFor]) + const fold = (next: boolean) => { + setFolded(next) + writeLienBoardFolded(flowViewStore(), foldFor, next) + // A chip's card has no chip to stand by once the bins are gone. + if (next) setCardShown(null) + } const hideTimer = useRef(null) const cancelHide = () => { if (hideTimer.current != null) window.clearTimeout(hideTimer.current) @@ -656,7 +673,7 @@ export default function LienBoard({ const ro = new ResizeObserver(() => measure()) ro.observe(grid) return () => ro.disconnect() - }, [board, isMobile, columnsOnly, notices.length, affidavits.length, binsOpen, three]) + }, [board, isMobile, columnsOnly, notices.length, affidavits.length, binsOpen, three, folded]) // A phone has no hover: its chips keep their press and draw no card. const cardHandler = cardFor && !isMobile ? onCard : undefined @@ -677,6 +694,7 @@ export default function LienBoard({ } // A phone's row over the fold: the two prints in their short words, side by side. const phonePrints = isMobile && printSides.length > 0 + const foldHead = layout ? columns[0]?.key : columns[columns.length - 1]?.key const column = ({ key: kind, title, bins }: LienBoardColumn, under: ReactNode) => { const flow = bins.filter((b) => !b.closed) const closed = bins.filter((b) => b.closed) @@ -686,6 +704,12 @@ export default function LienBoard({
{/* Both headings are the muted grey (the owner's pick of 2026-11-18): blue and red until then, and red on the Board now only means late. */}

{title}

+ {/* The fold's press ends the line that names the columns (v2.9275): the last head side by side, the first where they stack. No line is added between the tiles and the bins. */} + {canFold && kind === foldHead ? ( + + ) : null}
{flow.map((b) => )} @@ -800,7 +824,19 @@ export default function LienBoard({ {printsRow} {over} {emptyWords} -
+ {/* Folded, the grid keeps its place and its measure and holds one line: what the flow holds, and the press that opens it. */} +
+ {folded ? ( +
+ + + + +
+ ) : null} + {folded ? null : ( - {columns.map((c) => column(c, c.key === 'notice' ? retainage : c.key === 'affidavit' ? (underAffidavits ?? null) : null))} + )} + {folded ? null : columns.map((c) => column(c, c.key === 'notice' ? retainage : c.key === 'affidavit' ? (underAffidavits ?? null) : null))}
{pickLine} {foot} diff --git a/src/components/jobs/LienDesk.tsx b/src/components/jobs/LienDesk.tsx index ee7ab77d9a..e953a98b04 100644 --- a/src/components/jobs/LienDesk.tsx +++ b/src/components/jobs/LienDesk.tsx @@ -3240,7 +3240,7 @@ export default function LienDesk({ {kind === 'next' ? (
0 ? { ...doNow.frame, ['--lien-pinned-top' as string]: `${pinnedTop}px` } : doNow.frame}> {underLine.top ? listTop : null} - {board ? { if (key === 'affidavit:released') onToggleReleasedAll?.(); else if (key === 'affidavit:served' && counselCalledLiens.length > 0) setCounselCalledOpen(true); else if (key === 'affidavit:lapsed' && lapsedAnsweredIds.length > 0) setLapsedWalk({ ids: lapsedAnsweredIds, start: lapsedAnsweredIds[0]! }) }} footDoorKeys={boardFootDoors} onLayout={setBoardStacked} onChip={zoomTo} cardFor={chipCardFor} pick={boardPick} shown={nextUpRowsShown.length} onPick={pickBoardBin} onPinned={setPinnedTop} onTile={openBoardTile} onRetainage={openRetainageList} prints={boardPrints ? { ...boardPrints, onPress: onBoardPrint, onLeft: onBoardPrintLeft, onNote: onBoardPrintNote } : null} over={publicLine ? setPublicReview(publicLine.addressIds) : null} /> : null} underAffidavits={publicBin || offPathBin ?
{publicBin ? : null}{offPathBin ? : null}
: null} /> :
} + {board ? { if (key === 'affidavit:released') onToggleReleasedAll?.(); else if (key === 'affidavit:served' && counselCalledLiens.length > 0) setCounselCalledOpen(true); else if (key === 'affidavit:lapsed' && lapsedAnsweredIds.length > 0) setLapsedWalk({ ids: lapsedAnsweredIds, start: lapsedAnsweredIds[0]! }) }} footDoorKeys={boardFootDoors} onLayout={setBoardStacked} onChip={zoomTo} cardFor={chipCardFor} pick={boardPick} shown={nextUpRowsShown.length} onPick={pickBoardBin} onPinned={setPinnedTop} onTile={openBoardTile} onRetainage={openRetainageList} prints={boardPrints ? { ...boardPrints, onPress: onBoardPrint, onLeft: onBoardPrintLeft, onNote: onBoardPrintNote } : null} over={publicLine ? setPublicReview(publicLine.addressIds) : null} /> : null} underAffidavits={publicBin || offPathBin ?
{publicBin ? : null}{offPathBin ? : null}
: null} /> :
} {underLine.find ? ( pickBoardBins(null)} prints={boardPrints ? [boardPrints.notice, boardPrints.affidavit].flatMap((side) => (side ? [{ key: side.kind, label: side.short.label, left: side.short.left, dead: side.dead, onPress: () => onBoardPrint(side) }] : [])) : undefined}> diff --git a/src/content/help/read-the-board-on-the-lien-desk.md b/src/content/help/read-the-board-on-the-lien-desk.md index 07baa921d9..3a90b63d8d 100644 --- a/src/content/help/read-the-board-on-the-lien-desk.md +++ b/src/content/help/read-the-board-on-the-lien-desk.md @@ -31,6 +31,14 @@ One arrow crosses from Sent on the left to Waiting on its notice on the right. T A bin with a blue left edge has something to do now. Its press is beside its name. Each bin's count sits at its right. A bin with no paper is one quiet line with a zero. An empty bin's name and zero are grey. The column headings are grey too. Red on the Board always means a late day. +## Fold the Board + +On a computer the Board can be taller than the screen. The list then starts under it. A press named **Fold ▴** sits at the right end of the line that names the columns. Press it. The bins fold away and the four tiles stay. The list moves up. + +One line under the tiles then reads like *The flow is folded · 31 papers in 12 bins*. Press **Show the flow ▾** on that line to see the bins again. + +The Board opens the way you left it. That holds for your login on that computer. A press on a tile still narrows the list while the Board is folded. A phone has no fold. + ## What a chip's colour means A chip is a job's number. Its colour says how soon its day is. diff --git a/src/content/releaseNotes/v2.9275.ts b/src/content/releaseNotes/v2.9275.ts new file mode 100644 index 0000000000..6bdeda05c1 --- /dev/null +++ b/src/content/releaseNotes/v2.9275.ts @@ -0,0 +1,16 @@ +import type { ReleaseNote } from '../../lib/releaseNotes' + +const note: ReleaseNote = { + version: 'v2.9275', + date: '2026-12-03', + title: 'Lien desk: the Board folds to its tiles, so the list starts higher', + kind: 'feature', + highlights: [ + 'On a computer the Board has a new press, Fold, at the right end of the line that names its columns. It folds the bins away and keeps the four tiles.', + 'A folded Board says how many papers are in the flow. Show the flow opens the bins again.', + 'The Board opens as you left it, for your login on that computer. It starts open until you fold it.', + 'A phone’s Board is not changed.', + ], +} + +export default note diff --git a/src/lib/jobs/lienBoardFold.test.ts b/src/lib/jobs/lienBoardFold.test.ts new file mode 100644 index 0000000000..e8b3db11ad --- /dev/null +++ b/src/lib/jobs/lienBoardFold.test.ts @@ -0,0 +1,53 @@ +import { describe, expect, it } from 'vitest' +import { plainSentence } from '../valuesInPlace' +import { LIEN_BOARD_FOLD_PRESS, LIEN_BOARD_FOLD_STORAGE_KEY, LIEN_BOARD_UNFOLD_PRESS, lienBoardFoldCount, lienBoardFoldedLine, readLienBoardFolded, writeLienBoardFolded } from './lienBoardFold' + +/** A store that keeps what it is given, as a browser's does. */ +function store(): Pick & { kept: Map } { + const kept = new Map() + return { kept, getItem: (k) => kept.get(k) ?? null, setItem: (k, v) => void kept.set(k, v), removeItem: (k) => void kept.delete(k) } +} +const bins = (...counts: number[]) => counts.map((n) => ({ chips: Array.from({ length: n }, (_, i) => i) })) + +describe('the Board folded to its tiles (punch list #483 step 2, finding 863)', () => { + it('the two presses say what each does', () => { + expect([LIEN_BOARD_FOLD_PRESS, LIEN_BOARD_UNFOLD_PRESS]).toEqual(['Fold ▴', 'Show the flow ▾']) + }) + + it('counts every paper, and only the bins that hold one', () => { + expect(lienBoardFoldCount(bins(5, 0, 12, 14, 0))).toEqual({ papers: 31, bins: 3 }) + expect(lienBoardFoldCount([])).toEqual({ papers: 0, bins: 0 }) + }) + + it('the folded line says the flow is folded and counts what it holds', () => { + expect(plainSentence(lienBoardFoldedLine(bins(5, 0, 12, 14)))).toBe('The flow is folded · 31 papers in 3 bins') + expect(plainSentence(lienBoardFoldedLine(bins(1)))).toBe('The flow is folded · 1 paper in 1 bin') + expect(plainSentence(lienBoardFoldedLine(bins(0, 0)))).toBe('The flow is folded · no paper is in it') + }) + + it('the Board starts open, and a fold is kept for the login that made it (the owner’s picks of 2026-12-03)', () => { + const s = store() + expect(readLienBoardFolded(s, 'u1')).toBe(false) + writeLienBoardFolded(s, 'u1', true) + expect(readLienBoardFolded(s, 'u1')).toBe(true) + // Another login on the same device still opens on the bins. + expect(readLienBoardFolded(s, 'u2')).toBe(false) + expect([...s.kept.keys()]).toEqual([`${LIEN_BOARD_FOLD_STORAGE_KEY}:u1`]) + // Opened again, the entry is gone. + writeLienBoardFolded(s, 'u1', false) + expect(readLienBoardFolded(s, 'u1')).toBe(false) + expect(s.kept.size).toBe(0) + }) + + it('no login, no store and a store that throws all read as open, and none of them throws', () => { + const s = store() + writeLienBoardFolded(s, null, true) + expect(s.kept.size).toBe(0) + expect(readLienBoardFolded(s, null)).toBe(false) + expect(readLienBoardFolded(null, 'u1')).toBe(false) + const broken = { getItem: () => { throw new Error('refused') }, setItem: () => { throw new Error('refused') }, removeItem: () => { throw new Error('refused') } } + expect(readLienBoardFolded(broken, 'u1')).toBe(false) + expect(() => writeLienBoardFolded(broken, 'u1', true)).not.toThrow() + expect(() => writeLienBoardFolded(null, 'u1', true)).not.toThrow() + }) +}) diff --git a/src/lib/jobs/lienBoardFold.ts b/src/lib/jobs/lienBoardFold.ts new file mode 100644 index 0000000000..9cdc02353a --- /dev/null +++ b/src/lib/jobs/lienBoardFold.ts @@ -0,0 +1,64 @@ +/** + * The Board folded to its four tiles (punch list #483 step 2, finding 863). The live Board stood 727 px after the + * third column, so on a laptop the list still started under the screen. One press at the right end of the line that + * names the columns folds the bins away. One line under the tiles then says the flow is folded and counts what it + * holds, with the press that opens it again. The Board starts open until a person folds it, and the fold is kept for + * that person's login on the device (the owner's picks of 2026-12-03). A phone's Board is not changed. + * + * Pure: the words, the count and the store's key. The component owns the press. + */ +import { pluralNoun } from '../batchWords' +import { val } from '../valuesInPlace' + +/** The press at the right end of the column heads' line. */ +export const LIEN_BOARD_FOLD_PRESS = 'Fold ▴' +/** The press on the folded Board's one line. */ +export const LIEN_BOARD_UNFOLD_PRESS = 'Show the flow ▾' +export const LIEN_BOARD_FOLD_HINT = 'Fold the Board to its tiles, so the list starts higher' +export const LIEN_BOARD_UNFOLD_HINT = 'Show the Board’s bins again' + +/** Where a device keeps the fold, one entry a login. */ +export const LIEN_BOARD_FOLD_STORAGE_KEY = 'pipetooling_lien_board_folded' + +type FoldStore = Pick + +const keyFor = (userId: string): string => `${LIEN_BOARD_FOLD_STORAGE_KEY}:${userId}` + +/** True when this login folded the Board on this device. No login, no store or a store that throws reads as open. */ +export function readLienBoardFolded(store: FoldStore | null | undefined, userId: string | null | undefined): boolean { + if (!store || !userId) return false + try { + return store.getItem(keyFor(userId)) === '1' + } catch { + return false + } +} + +/** Keeps the fold for the login's next visit. An open Board keeps no entry. A store that throws is left alone: the Board still folds on the screen. */ +export function writeLienBoardFolded(store: FoldStore | null | undefined, userId: string | null | undefined, folded: boolean): void { + if (!store || !userId) return + try { + if (folded) store.setItem(keyFor(userId), '1') + else store.removeItem(keyFor(userId)) + } catch { + /* the fold still works for this visit */ + } +} + +/** What the folded flow holds: every paper on the Board, and the bins that hold one. */ +export function lienBoardFoldCount(bins: ReadonlyArray<{ chips: ReadonlyArray }>): { papers: number; bins: number } { + let papers = 0 + let holding = 0 + for (const b of bins) { + papers += b.chips.length + if (b.chips.length > 0) holding += 1 + } + return { papers, bins: holding } +} + +/** The folded Board's one line, its two counts marked as values: *The flow is folded · 31 papers in 12 bins*. */ +export function lienBoardFoldedLine(bins: ReadonlyArray<{ chips: ReadonlyArray }>): string { + const count = lienBoardFoldCount(bins) + if (count.papers === 0) return 'The flow is folded · no paper is in it' + return `The flow is folded · ${val('papers', String(count.papers))} ${pluralNoun('paper', count.papers)} in ${val('bins', String(count.bins))} ${pluralNoun('bin', count.bins)}` +} diff --git a/to-dos/lien-desk-board-shorter-than-a-laptop/README.md b/to-dos/lien-desk-board-shorter-than-a-laptop/README.md index af4ff3481f..02a3879206 100644 --- a/to-dos/lien-desk-board-shorter-than-a-laptop/README.md +++ b/to-dos/lien-desk-board-shorter-than-a-laptop/README.md @@ -1,8 +1,8 @@ --- name: "Lien desk Board: shorter than a laptop's screen" number: 483 -group: gated -status: found 2026-12-02 on the live desk at 1,440 by 900 (finding 822) · measured the same day on made-up rows · the owner's *Yes, third column* the same day · built: the third column and the shorter arrows (v2.9244) · the live read failed on 2026-12-03 (finding 863): the Board is 727 px and the list still starts under the screen · step 2, the fold, is drawn (2026-12-03) and waits on two calls · nothing of step 2 is built +group: close +status: found 2026-12-02 on the live desk at 1,440 by 900 (finding 822) · measured the same day on made-up rows · the owner's *Yes, third column* the same day · built: the third column and the shorter arrows (v2.9244) · the live read failed on 2026-12-03 (finding 863): the Board is 727 px and the list still starts under the screen · step 2, the fold, was drawn on 2026-12-03 · the owner answered its two calls the same day: the Board starts open, and the press stands as drawn · step 2 is built (v2.9275) summary: > On a 1,440 by 900 laptop the Lien desk's To do view shows the Board and no row of the list. The Board stood 930 px in a 675 px frame, so the list starts under the bottom of the screen. This is @@ -11,14 +11,14 @@ summary: > affidavit column gained the bins after the filing. The pick is a shorter Board: those bins get a third column, **Liens on record**, and the arrows between bins get shorter. On made-up rows that takes the Board from 798 px to 592 px. That step is live, and the live Board still stands 727 - px, so the list is still under the screen. The second step is drawn and waits on the owner: a - press that folds the Board to its four tiles. -next: The owner looks at the fold's drawing and answers its two calls. Then step 2 is built, client only. -ask: owner · look · Open the drawing of the folded Board and say how the Board starts and where its press stands. -size: S as a train of two (S · S); step 1 built, step 2 only if step 1 is not enough -blocker: The owner's look at the fold's drawing, and its two calls. -ver: v2.9244 -opinion: build — the third column was not enough on the live desk, and a fold gives the list the screen without changing a bin + px, so the list is still under the screen. The second step is built on the owner's two picks: + a press that folds the Board to its four tiles. +next: The walking desk reads the live desk at 1280 by 800 and 1,440 by 900 with the Board folded. +ask: owner · look · Fold the Board on the live Lien desk on a laptop and say whether the list now starts in sight. +size: S as a train of two (S · S); both built; left: none to build +blocker: None to build. The live read with the Board folded is left. +ver: v2.9275 +opinion: close out — both steps are built, and the card closes once the live read is taken --- # Lien desk Board: shorter than a laptop's screen (#483) @@ -73,6 +73,7 @@ The top of [`mockup.html`](mockup.html) draws it, on 2026-12-03 (UTC), at half s - The fold is kept for the person's login on that device. The phone's Board is not changed. Two calls are on the drawing, each with the builder's pick. +**Answered 2026-12-03.** The owner took both picks: the Board starts open, and the press stands as drawn. | | The question | The pick | |---|---|---| @@ -118,7 +119,7 @@ On made-up rows the list gets one row at 1,440 by 900. The live Board is taller, ## Steps 1. **A third column and shorter arrows (S). Built, v2.9244.** The Board draws three columns from a grid 1,100 px wide, where a column is 329 px, and two under it. On made-up rows in a 675 px frame it stands 607 px at 1,232 wide, and 661 px with twice the rows at 1,140. Left: the read of the live Board's height. As planned: the Board's kernel gives the bins after the filing a column; the component draws three columns at a width that holds them and two under it; the arrows' paths follow. Kernel tests, the render test, the map's lines, the guide [read the Board on the Lien desk](../../src/content/help/read-the-board-on-the-lien-desk.md). A read of the live Board's height after it. -2. **Fold to the tiles (S). Asked for by the live read (finding 863). Drawn 2026-12-03, not built.** It waits on the two calls above. As planned: a pure kernel for the folded line's words and its count, the fold kept for the login on the device, the press on the column heads' line, a render test, and the guide. +2. **Fold to the tiles (S). Built, v2.9275.** Asked for by the live read (finding 863), drawn 2026-12-03, and built on the owner's two picks of the same day. A pure kernel (`lienBoardFold.ts`) holds the folded line's words and its count and keeps the fold for the login on the device. **Fold ▴** ends the column heads' line, and the folded Board's one line has **Show the flow ▾**. Kernel tests, a render test, the map's lines and the guide. Left: a read of the live desk with the Board folded. ## Not in this card