Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions docs/LIEN_DESK_ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions docs/recent-features/v2.9275.md
Original file line number Diff line number Diff line change
@@ -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.
87 changes: 87 additions & 0 deletions src/components/jobs/LienBoard.fold.render.test.tsx
Original file line number Diff line number Diff line change
@@ -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> = {}): 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> = {}): 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<HTMLElement>(sel)
const all = (sel: string) => Array.from(document.querySelectorAll<HTMLElement>(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(<LienBoard board={board()} isMobile={false} columnsOnly foldFor="u1" />)
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(<LienBoard board={board()} isMobile={false} columnsOnly foldFor="u1" />)
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(<LienBoard board={board()} isMobile={false} columnsOnly foldFor="u1" />)
expect(q('[data-lien-board-folded]')).not.toBeNull()
expect(all('[data-lien-board-bin]')).toEqual([])
first.unmount()
render(<LienBoard board={board()} isMobile={false} columnsOnly foldFor="u2" />)
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(<LienBoard board={board()} isMobile={false} columnsOnly />)
expect(q('[data-lien-board-fold]')).toBeNull()
expect(q('[data-lien-board-folded]')).toBeNull()
plain.unmount()
render(<LienBoard board={board()} isMobile foldFor="u1" />)
expect(q('[data-lien-board-fold]')).toBeNull()
expect(q('[data-lien-board-folded]')).toBeNull()
})
})
43 changes: 40 additions & 3 deletions src/components/jobs/LienBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

/**
Expand Down Expand Up @@ -485,6 +487,7 @@ export default function LienBoard({
prints,
onRetainage,
onPinned,
foldFor,
}: {
board: LienBoardModel
isMobile: boolean
Expand All @@ -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<Record<LienBoardBinKey, LienBoardBinPress>>
/** 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. */
Expand Down Expand Up @@ -548,6 +553,18 @@ export default function LienBoard({
// the pointer cross to the next chip without a blink.
const boardRef = useRef<HTMLElement | null>(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<boolean>(() => 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<number | null>(null)
const cancelHide = () => {
if (hideTimer.current != null) window.clearTimeout(hideTimer.current)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -686,6 +704,12 @@ export default function LienBoard({
<div data-lien-board-heading={kind} style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '6px 10px', minHeight: 24 }}>
{/* 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. */}
<h3 style={{ margin: 0, flex: '1 1 auto', fontSize: '0.72rem', fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: LIEN_BOARD_COLUMN_HEAD_COLOR }}>{title}</h3>
{/* 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 ? (
<button type="button" className="lienJobDoor" data-lien-board-fold aria-expanded="true" onClick={() => fold(true)} title={LIEN_BOARD_FOLD_HINT} style={{ ...LINE_DOOR, fontSize: '0.78rem' }}>
{LIEN_BOARD_FOLD_PRESS}
</button>
) : null}
</div>
<div data-lien-board-flow={kind} style={{ display: 'grid', gap: LIEN_BOARD_BIN_GAP_PX }}>
{flow.map((b) => <Bin key={b.key} bin={b} picked={Boolean(pick?.bins.includes(b.key))} isMobile={isMobile} onPick={onPick} onChip={onChip} pairLit={pairLit} onHover={setPairLit} onCard={cardHandler} press={presses[b.key]} onFootDoor={onFootDoor} footDoorKeys={footDoorKeys} />)}
Expand Down Expand Up @@ -800,7 +824,19 @@ export default function LienBoard({
{printsRow}
{over}
{emptyWords}
<div ref={gridRef} data-lien-board-grid style={{ position: 'relative', display: binsOpen ? 'grid' : 'none', gridTemplateColumns: layout ? '1fr' : `repeat(${columns.length}, minmax(0, 1fr))`, columnGap: 56, rowGap: 22, alignItems: 'start' }}>
{/* Folded, the grid keeps its place and its measure and holds one line: what the flow holds, and the press that opens it. */}
<div ref={gridRef} data-lien-board-grid data-folded={folded ? 'yes' : undefined} style={{ position: 'relative', display: binsOpen ? 'grid' : 'none', gridTemplateColumns: layout || folded ? '1fr' : `repeat(${columns.length}, minmax(0, 1fr))`, columnGap: 56, rowGap: 22, alignItems: 'start' }}>
{folded ? (
<div data-lien-board-folded style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: '4px 12px', fontSize: '0.8125rem', color: 'var(--text-muted)', padding: '2px 4px' }}>
<span data-lien-board-folded-words>
<ValueSentence text={lienBoardFoldedLine([...notices, ...affidavits])} />
</span>
<button type="button" className="lienJobDoor" data-lien-board-unfold aria-expanded="false" onClick={() => fold(false)} title={LIEN_BOARD_UNFOLD_HINT} style={LINE_DOOR}>
{LIEN_BOARD_UNFOLD_PRESS}
</button>
</div>
) : null}
{folded ? null : (
<svg aria-hidden="true" data-lien-board-arrows style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', pointerEvents: 'none', overflow: 'visible' }}>
<defs>
<marker id="lienBoardArrowHead" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
Expand All @@ -809,7 +845,8 @@ export default function LienBoard({
</defs>
{lines.map((l) => <path key={l.key} data-lien-board-arrow={l.key} data-kind={l.kind} d={l.d} fill="none" stroke={ARROW} strokeWidth="1.3" strokeDasharray={l.kind === 'cross' ? '4 3' : undefined} markerEnd="url(#lienBoardArrowHead)" />)}
</svg>
{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))}
</div>
{pickLine}
{foot}
Expand Down
Loading
Loading