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 @@ -2345,6 +2345,7 @@ Forty-eight **steps**, each with two **sides**: what waits on a robot, and what
A robot is anything that works with no person pressing, a digital twin or the computer's timed work.
A side is a **line** (so many of a thing wait), a **note** (a robot that keeps no line), a **fact** (the crews out today) or nothing.
A person's line has one **door**, the page where the work is done, and `consoleChain.routes.test.ts` holds each door to the router.
Since v2.9280 a step worked on a Bridge desk opens the desk by its own address, `/bridge?desk=build`, `?desk=bill` or `?desk=collect` (`bridgeDeskHref`, `deskFromSearch` in `src/lib/bridge/doors.ts`), which the Bridge writes when a desk opens and drops when it shuts.
A line names its **reader**, where its count comes from.
A line with no reader says so: *No count yet* on the people's side and *Not read yet* on the robots'.
Not to be confused with the **Console** under Bids → Robots, which is written *Robot console* wherever the two could meet.
Expand Down
22 changes: 22 additions & 0 deletions docs/recent-features/v2.9280.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# v2.9280 — The Bridge: a step's desk has an address of its own (2026-12-03)

Punch list #463, step 3, the small piece before the Console's page. Client only. Nothing owed on prod.

## What it does

- **A desk rides in the address.** `?desk=market`, `sales`, `build`, `bill` or `collect` on `/bridge` opens that step's desk, the window its card's **Break it down** opens (`DESK_PARAM`, `deskFromSearch` and `bridgeDeskHref` in `src/lib/bridge/doors.ts`).
- **The address is the one way a desk opens.** A press on the pipe or on **Break it down** writes the address (`askDesk` in `Bridge.tsx`), and the address opens the desk once its figures are read. A step whose desk cannot be read yet stays shut, and a press on its row of the pipe opens The flow as before.
- **Shutting a desk takes it off the address** (`shutDesk`, `searchWithoutDesk`). The address is replaced, never pushed, so the browser's Back does not walk through desks.
- **The Console's chain opens the desks.** The eight steps worked on the Build, Bill and Collect desks now open `/bridge?desk=build`, `?desk=bill` and `?desk=collect`, and their presses read *Open the Build desk*, *Open the Bill desk* and *Open the Collect desk* (`consoleChain.ts`). Before, each opened `/bridge?door=flow` and said *Open the Bridge, then Build*.

## Tests

`doors.test.ts` (three new cases: a desk read from the address, the address written and read back, the desk taken off). `consoleChain.routes.test.ts` (the Bridge's doors are three desks and Soft numbers, eight presses open a desk, and each desk named is one the Bridge reads).

The Bridge page has no render test of its own, so the page's wiring is held by lint and the type check alone.

## To verify on the live site

Read only, as the owner or a dev. Open `/bridge?desk=build`: the Build desk opens once the page has read. Shut it: the address is `/bridge`. Press **Break it down** on Collect: the address ends `?desk=collect`. Copy it into a new tab and see the same window. Do the same for Market, Sales and Bill.

Not seen in a browser.
2 changes: 2 additions & 0 deletions src/content/help/the-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ Behind **The flow**, the desk of the pressed stage sits under the three resource

The red sits on the step the page reads as narrowest today. No step is held for the week.

A step's **Break it down** window has an address of its own. Open the window and copy the address from the browser. The address opens the Bridge with that window up. Closing the window takes it off the address.

## Money owed and Crew hours, opened

**Money owed** sits behind Money. The card reads owed to you, owed by you, finished work not yet billed, and the collections balance. Owed to you leaves collections out. The collections balance is written off for planning.
Expand Down
16 changes: 16 additions & 0 deletions src/content/releaseNotes/v2.9280.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { ReleaseNote } from '../../lib/releaseNotes'

const note: ReleaseNote = {
version: 'v2.9280',
date: '2026-12-03',
title: 'The Bridge: a step\'s window has an address of its own (punch list #463, step 3)',
kind: 'feature',
roles: ['dev', 'master_technician'],
highlights: [
'On the Bridge, Break it down on a step now puts the step in the address. Copy the address and it opens the Bridge with that window up.',
'Closing the window takes the step off the address again.',
'The coming Console page will use these addresses, so a press on a Build, Bill or Collect step opens the window itself and not only the Bridge.',
],
}

export default note
22 changes: 21 additions & 1 deletion src/lib/bridge/doors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import { plainWordsFailures } from '../plainWords'
import { BRIDGE_DOORS, doorFromSearch, doorsToDraw, searchAfterDoor } from './doors'
import { BRIDGE_DOORS, bridgeDeskHref, deskFromSearch, doorFromSearch, doorsToDraw, searchAfterDoor, searchWithoutDesk } from './doors'

describe('the Bridge’s doors', () => {
it('reads the open door from the address, and nothing from a word that is no door', () => {
Expand Down Expand Up @@ -35,3 +35,23 @@ describe('the Bridge’s doors', () => {
for (const d of BRIDGE_DOORS) for (const s of [d.name, d.holds, d.holdsShort]) expect(plainWordsFailures(s), s).toEqual([])
})
})

describe('a desk’s address (punch list #463, step 3)', () => {
it('reads the desk the address names, and nothing from a word that is no step', () => {
for (const id of ['market', 'sales', 'build', 'bill', 'collect'] as const) expect(deskFromSearch(id)).toBe(id)
expect(deskFromSearch('money')).toBeNull()
expect(deskFromSearch('')).toBeNull()
expect(deskFromSearch(null)).toBeNull()
})

it('writes an address the Bridge reads back as that desk', () => {
expect(bridgeDeskHref('build')).toBe('/bridge?desk=build')
expect(deskFromSearch(new URL(bridgeDeskHref('collect'), 'https://app.example').searchParams.get('desk'))).toBe('collect')
})

it('takes the desk off the address when it shuts, and keeps the rest', () => {
expect(searchWithoutDesk('desk=bill')).toBe('')
expect(searchWithoutDesk('door=flow&desk=bill&week=2026-11-08')).toBe('door=flow&week=2026-11-08')
expect(searchWithoutDesk('door=money')).toBe('door=money')
})
})
30 changes: 30 additions & 0 deletions src/lib/bridge/doors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* - Soft numbers: the one list of what makes the reading unsure.
*/

import { BRIDGE_PATH } from '../devBridgeLanding'
import type { StageId } from './stageFlow'

export type DoorId = 'flow' | 'money' | 'people' | 'soft'

export const DOOR_PARAM = 'door'
Expand Down Expand Up @@ -48,3 +51,30 @@ export function searchAfterDoor(search: string, pressed: DoorId, open: DoorId |
export function doorsToDraw(softCount: number): Door[] {
return BRIDGE_DOORS.flatMap((d) => (d.id !== 'soft' ? [d] : softCount > 0 ? [{ ...d, name: `${softCount} soft ${softCount === 1 ? 'number' : 'numbers'}` }] : []))
}

// ---------- a desk's address (punch list #463, step 3) ----------

/**
* A step's desk is the window its card's Break it down opens. It rides in the address too
* (`?desk=build`), so a press somewhere else can open the desk and not only the page.
*/
export const DESK_PARAM = 'desk'

const DESKS: ReadonlySet<string> = new Set<StageId>(['market', 'sales', 'build', 'bill', 'collect'])

/** The desk the address names; null for none and for a word that is no step. */
export function deskFromSearch(value: string | null | undefined): StageId | null {
return value && DESKS.has(value) ? (value as StageId) : null
}

/** The Bridge with one step's desk open over it. */
export function bridgeDeskHref(id: StageId): string {
return `${BRIDGE_PATH}?${DESK_PARAM}=${id}`
}

/** The address once a desk is shut: the same, without the desk. */
export function searchWithoutDesk(search: string): string {
const p = new URLSearchParams(search)
p.delete(DESK_PARAM)
return p.toString()
}
9 changes: 6 additions & 3 deletions src/lib/console/consoleChain.routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
import { BIDS_TABS } from '../bids/bidsTabAccess'
import { deskFromSearch } from '../bridge/doors'
import { MATERIALS_TABS } from '../materials/materialsTabs'
import { appRoutePathsFromSource, pathMatchesRoute } from '../twins/appDirectoryCheck'
import { consoleSteps } from './consoleChain'
Expand Down Expand Up @@ -39,9 +40,11 @@ describe('the chain’s doors open pages of the app', () => {
}
})

it('opens the Bridge’s own doors where a desk has no address', () => {
it('opens a step’s desk on the Bridge by its own address, and Soft numbers by its door', () => {
const bridge = doors.filter((d) => d.to.startsWith('/bridge'))
expect(new Set(bridge.map((d) => d.to))).toEqual(new Set(['/bridge?door=flow', '/bridge?door=soft']))
expect(bridge.filter((d) => d.to === '/bridge?door=flow')).toHaveLength(8)
expect(new Set(bridge.map((d) => d.to))).toEqual(new Set(['/bridge?desk=build', '/bridge?desk=bill', '/bridge?desk=collect', '/bridge?door=soft']))
expect(bridge.filter((d) => d.to.startsWith('/bridge?desk='))).toHaveLength(8)
// Every desk a door names is one the Bridge opens from its address.
for (const d of bridge.filter((x) => x.to.includes('desk='))) expect(deskFromSearch(new URL(d.to, 'https://app.example').searchParams.get('desk')), d.key).not.toBeNull()
})
})
11 changes: 5 additions & 6 deletions src/lib/console/consoleChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* the list of what is counted is plain. `reader: null` on a line means the app keeps no count of it yet. The
* side then says so, and step 7 of the card gives each such line its count.
*/
import { DOOR_PARAM } from '../bridge/doors'
import { DOOR_PARAM, bridgeDeskHref } from '../bridge/doors'
import { BID_BOARD_PATH, ESTIMATES_PATH } from '../bridge/sales/salesDesk'
import type { StageId } from '../bridge/stageFlow'
import { CODE_NEEDS_YOU_HREF } from '../contracts/codeNeedsYou'
Expand Down Expand Up @@ -127,11 +127,10 @@ const line = (one: string, many: string, reader: ConsoleReader | null, door: Con
const note = (words: string, reader: ConsoleReader | null = null): Side => ({ kind: 'note', words, reader })
const door = (label: string, to: string): ConsoleDoor => ({ label, to })

/** The Bridge with its *Flow* door open: the nearest address to a desk, which opens from a press there. */
const BRIDGE_FLOW = `${BRIDGE_PATH}?${DOOR_PARAM}=flow`
const BUILD_DESK = door('Open the Bridge, then Build', BRIDGE_FLOW)
const BILL_DESK = door('Open the Bridge, then Bill', BRIDGE_FLOW)
const COLLECT_DESK = door('Open the Bridge, then Collect', BRIDGE_FLOW)
/** A step's desk on the Bridge, which has an address of its own since v2.9280 (`bridgeDeskHref`). */
const BUILD_DESK = door('Open the Build desk', bridgeDeskHref('build'))
const BILL_DESK = door('Open the Bill desk', bridgeDeskHref('bill'))
const COLLECT_DESK = door('Open the Collect desk', bridgeDeskHref('collect'))
const BID_BOARD = door('Open the Bid board', BID_BOARD_PATH)
const ESTIMATES = door('Open Estimates', ESTIMATES_PATH)
const RECEIVABLE = door('Open Accounts receivable', '/accounts-receivable')
Expand Down
69 changes: 51 additions & 18 deletions src/pages/Bridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { carryingDay, carryingSentence, receiptsConfidence } from '../lib/bridge
import { BridgeCashConfidence } from '../components/bridge/BridgeCashConfidence'
import { buildSoftNumbers } from '../lib/bridge/softNumbers'
import { BridgeSoftNumbers } from '../components/bridge/BridgeSoftNumbers'
import { doorFromSearch, searchAfterDoor, type DoorId } from '../lib/bridge/doors'
import { DESK_PARAM, deskFromSearch, doorFromSearch, searchAfterDoor, searchWithoutDesk, type DoorId } from '../lib/bridge/doors'
import { BRIDGE_DOOR_PANEL_ID, BridgeDoors } from '../components/bridge/BridgeDoors'
import { MONEY_LIST_DAYS, laterPress, listWindow } from '../lib/bridge/moneyLists'
import { peopleSummary } from '../lib/bridge/peopleStrip'
Expand Down Expand Up @@ -1418,17 +1418,50 @@ export default function Bridge() {
},
[setSearchParams, softCount],
)
// A desk's address (punch list #463, step 3): a step's desk rides in the address as `?desk=build`, so a press on
// another page can open the desk and not only the Bridge. A press here writes the address and the address opens the
// desk, once its figures are read. A step whose desk cannot be read stays shut. Shutting a desk takes it off the address.
const deskAsked = deskFromSearch(searchParams.get(DESK_PARAM))
const collectReady = fin.data != null
const billReady = billPile != null
const buildReady = buildInputs != null && weeksInputs != null
const demandReady = demand != null
useEffect(() => {
if (!deskAsked) return
setCollectOpen(deskAsked === 'collect' && collectReady)
setBillOpen(deskAsked === 'bill' && billReady)
setBuildOpen(deskAsked === 'build' && buildReady)
setMarketOpen(deskAsked === 'market' && demandReady)
setSalesOpen(deskAsked === 'sales' && demandReady)
}, [deskAsked, collectReady, billReady, buildReady, demandReady])
const askDesk = useCallback(
(id: StageId) => {
setSearchParams(
(prev) => {
const next = new URLSearchParams(prev)
next.set(DESK_PARAM, id)
return next
},
{ replace: true },
)
},
[setSearchParams],
)
const shutDesk = useCallback(
(shut: (open: boolean) => void) => {
shut(false)
setSearchParams((prev) => (prev.has(DESK_PARAM) ? new URLSearchParams(searchWithoutDesk(prev.toString())) : prev), { replace: true })
},
[setSearchParams],
)
// A press on a section of the strip opens that step's desk, the window its card's Break it down opens. A step whose
// desk cannot be read yet opens The flow, where its card says why.
const openStageDesk = useCallback(
(id: StageId) => {
if (id === 'collect' && fin.data) setCollectOpen(true)
else if (id === 'bill' && billPile) setBillOpen(true)
else if (id === 'build' && buildInputs && weeksInputs) setBuildOpen(true)
else if ((id === 'market' || id === 'sales') && demand) (id === 'market' ? setMarketOpen : setSalesOpen)(true)
if (id === 'collect' ? collectReady : id === 'bill' ? billReady : id === 'build' ? buildReady : demandReady) askDesk(id)
else pressDoor('flow', { keepOpen: true })
},
[fin.data, billPile, buildInputs, weeksInputs, demand, pressDoor],
[collectReady, billReady, buildReady, demandReady, askDesk, pressDoor],
)
useEffect(() => {
if (!doorScroll) return
Expand Down Expand Up @@ -1581,11 +1614,11 @@ export default function Bridge() {
onPick={setPickedStage}
onOrder={setOrderFor}
desks={{
...(fin.data ? { collect: { label: 'Break it down', onPress: () => setCollectOpen(true) } } : {}),
...(billPile ? { bill: { label: 'Break it down', onPress: () => setBillOpen(true) } } : {}),
...(buildInputs && weeksInputs ? { build: { label: 'Break it down', onPress: () => setBuildOpen(true) } } : {}),
...(demand ? { market: { label: 'Break it down', onPress: () => setMarketOpen(true) } } : {}),
...(demand ? { sales: { label: 'Break it down', onPress: () => setSalesOpen(true) } } : {}),
...(fin.data ? { collect: { label: 'Break it down', onPress: () => askDesk('collect') } } : {}),
...(billPile ? { bill: { label: 'Break it down', onPress: () => askDesk('bill') } } : {}),
...(buildInputs && weeksInputs ? { build: { label: 'Break it down', onPress: () => askDesk('build') } } : {}),
...(demand ? { market: { label: 'Break it down', onPress: () => askDesk('market') } } : {}),
...(demand ? { sales: { label: 'Break it down', onPress: () => askDesk('sales') } } : {}),
}}
/>
)}
Expand Down Expand Up @@ -1618,7 +1651,7 @@ export default function Bridge() {
link={litLink}
status={deskStatus({ link: litLink, linkId: stageFlow.linkId })}
todayReading={deskReading}
door={litLink === 'collect' && fin.data ? { label: 'Break it down', onPress: () => setCollectOpen(true) } : undefined}
door={litLink === 'collect' && fin.data ? { label: 'Break it down', onPress: () => askDesk('collect') } : undefined}
onGoToCall={() => setDoorScroll((d) => ({ id: 'bridge-week', n: (d?.n ?? 0) + 1 }))}
moves={deskList.moves}
movesFoot={deskList.foot}
Expand Down Expand Up @@ -1966,7 +1999,7 @@ export default function Bridge() {
arDoor={OWED_DOORS.billing}
focusPayerKey={collectFocus}
onClose={() => {
setCollectOpen(false)
shutDesk(setCollectOpen)
setCollectFocus(null)
}}
sheet={collectPlan?.sheet ?? null}
Expand All @@ -1980,7 +2013,7 @@ export default function Bridge() {
}}
/>
) : (
<div onClick={() => setCollectOpen(false)} style={{ position: 'fixed', inset: 0, background: 'rgba(15, 23, 42, 0.45)', zIndex: 750, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 'calc(16px + var(--app-top-chrome, 0px)) 16px 16px' }} data-testid="bridge-collect-desk-loading">
<div onClick={() => shutDesk(setCollectOpen)} style={{ position: 'fixed', inset: 0, background: 'rgba(15, 23, 42, 0.45)', zIndex: 750, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 'calc(16px + var(--app-top-chrome, 0px)) 16px 16px' }} data-testid="bridge-collect-desk-loading">
<div role="dialog" aria-modal="true" aria-label="Collect, broken down" style={{ background: 'var(--surface)', color: 'var(--text)', borderRadius: 12, padding: '1rem 1.4rem', border: '1px solid var(--border)' }}>Reading the pile…</div>
</div>
)
Expand All @@ -1992,7 +2025,7 @@ export default function Bridge() {
error={billReadsError}
isLink={stageFlow?.linkId === 'bill'}
readStamp={`${new Date(`${data.todayYmd}T12:00:00Z`).toLocaleDateString('en-US', { weekday: 'short', timeZone: 'UTC' })}, ${md(data.todayYmd)} · pay week ${formatPayWeekLabel(payWeekContaining(data.todayYmd))}`}
onClose={() => setBillOpen(false)}
onClose={() => shutDesk(setBillOpen)}
/>
)}
{buildOpen && data && buildDesk && (
Expand All @@ -2002,7 +2035,7 @@ export default function Bridge() {
readError={buildReadError}
isLink={stageFlow?.linkId === 'build'}
readStamp={`${new Date(`${data.todayYmd}T12:00:00Z`).toLocaleDateString('en-US', { weekday: 'short', timeZone: 'UTC' })}, ${md(data.todayYmd)} · pay week ${formatPayWeekLabel(payWeekContaining(data.todayYmd))}`}
onClose={() => setBuildOpen(false)}
onClose={() => shutDesk(setBuildOpen)}
onSavePct={savePct}
onWaitsChanged={reloadBuildWaits}
/>
Expand All @@ -2021,7 +2054,7 @@ export default function Bridge() {
estimates={estimatesSent}
todayYmd={data.todayYmd}
readStamp={`${new Date(`${data.todayYmd}T12:00:00Z`).toLocaleDateString('en-US', { weekday: 'short', timeZone: 'UTC' })}, ${md(data.todayYmd)} · pay week ${formatPayWeekLabel(payWeekContaining(data.todayYmd))}`}
onClose={() => setMarketOpen(false)}
onClose={() => shutDesk(setMarketOpen)}
/>
)}
{salesOpen && data && (
Expand All @@ -2035,7 +2068,7 @@ export default function Bridge() {
bidWins={bidWins}
estimateWins={estimateWins}
readStamp={`${new Date(`${data.todayYmd}T12:00:00Z`).toLocaleDateString('en-US', { weekday: 'short', timeZone: 'UTC' })}, ${md(data.todayYmd)} · pay week ${formatPayWeekLabel(payWeekContaining(data.todayYmd))}`}
onClose={() => setSalesOpen(false)}
onClose={() => shutDesk(setSalesOpen)}
/>
)}
{order && <BridgeOrderModal order={order} note={dialMoved && dialReading ? `at the dial’s pace, ${dialReading.valueText}` : 'at today’s pace'} onClose={closeOrder} />}
Expand Down
Loading
Loading