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
2 changes: 1 addition & 1 deletion docs/CLOCK_SURFACES_ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Because they are components, regions are gated by **state/props**, not an `activ
### B6 — Button row + My Time preview

- **Location:** 1670–1852 (`loading` early return 1670–1676, `canClockIn` / `hasOpenSession` / `showMyTimeDayPreview` 1678–1681, `myTimePreviewButton` 1683–1717, `topRowContent` 1755–1841, wrapper 1843–1852).
- **Behavior:** open session → red `formatElapsed(totalSecondsToday) Clock Out` (hidden when `salaryUiActive`; "Checking…" while the tally gate loads) + **Break** (`BreakPress`, offered by `breakOffered` wherever Clock Out is; one press sends the clock out with no window and the row becomes `OnBreakRow` with **Back to work**, **Clock In…** and *Done for the day* until a session opens or the day turns; the rule is `lib/clock/clockBreak.ts`, the two presses `hooks/useClockBreak.ts`, the break in hand one `localStorage` entry by person; since v2.9203 the bar also tells **the break's door** what is true and hands it its three presses (`lib/clock/clockBreakDoor.ts`, `contexts/ClockBreakDoorContext.tsx`, inside the clock's bridge), so the Job Mode card, where this bar is mounted out of sight, draws Break and its *On a break* band itself (`jobModeBreakOffered` in `lib/jobMode/pressBar.ts`, `components/jobMode/JobModeOnBreak.tsx`); since v2.9217 *Done for the day* ends the break and then asks for the day's bids, **Your bids today**, where a clock out would have drawn them (`lib/clock/doneForTheDay.ts`, `components/clock/DoneForTheDayBidDay.tsx`, kept through `save_my_bid_day`)) + blue Update Focus; no session and salaried → only the My Time preview clock icon (it needs `onOpenMyTimeDayEditor`, which Dashboard withholds when `dashboardSelfIsSalary`, so there the row renders nothing); otherwise orange Clock In (`CLOCK_IN_ACCENT_UNDER_WORDS` under `CLOCK_IN_ACCENT_TEXT` — since v2.6186 the deep safety orange `#c75000` under white words in both themes, `lib/orangeUnderWords.ts`; v2.5981 had near-black words on `#ff6600` — as on Complete Clock In, the Job Mode card's and the press bar's orange press, `DAY_PRESS_TEXT`, and the strip's three orange headers) + B7's quick-time door + preview icon when `todaySessions` exist. Clock Out and Update Focus disable on any of `actionLoading || updateFocusLoading || clockOutSaving || clockOutTallyGateLoading`; Clock In on `!canClockIn || actionLoading`. `embedded` drops the wrapper's bottom margin.
- **Behavior:** open session → red `formatElapsed(totalSecondsToday) Clock Out` (hidden when `salaryUiActive`; "Checking…" while the tally gate loads) + **Break** (`BreakPress`, offered by `breakOffered` wherever Clock Out is; one press sends the clock out with no window and the row becomes `OnBreakRow` with **Back to work**, **Clock In…** and *Done for the day* until a session opens or the day turns; the rule is `lib/clock/clockBreak.ts`, the two presses `hooks/useClockBreak.ts`, the break in hand one `localStorage` entry by person; since v2.9203 the bar also tells **the break's door** what is true and hands it its three presses (`lib/clock/clockBreakDoor.ts`, `contexts/ClockBreakDoorContext.tsx`, inside the clock's bridge), so the Job Mode card, where this bar is mounted out of sight, draws Break and its *On a break* band itself (`jobModeBreakOffered` in `lib/jobMode/pressBar.ts`, `components/jobMode/JobModeOnBreak.tsx`); since v2.9217 *Done for the day* ends the break and then asks for the day's bids, **Your bids today**, when the day holds a bid and for no role when it holds none (`lib/clock/doneForTheDay.ts`, `components/clock/DoneForTheDayBidDay.tsx`, kept through `save_my_bid_day`)) + blue Update Focus; no session and salaried → only the My Time preview clock icon (it needs `onOpenMyTimeDayEditor`, which Dashboard withholds when `dashboardSelfIsSalary`, so there the row renders nothing); otherwise orange Clock In (`CLOCK_IN_ACCENT_UNDER_WORDS` under `CLOCK_IN_ACCENT_TEXT` — since v2.6186 the deep safety orange `#c75000` under white words in both themes, `lib/orangeUnderWords.ts`; v2.5981 had near-black words on `#ff6600` — as on Complete Clock In, the Job Mode card's and the press bar's orange press, `DAY_PRESS_TEXT`, and the strip's three orange headers) + B7's quick-time door + preview icon when `todaySessions` exist. Clock Out and Update Focus disable on any of `actionLoading || updateFocusLoading || clockOutSaving || clockOutTallyGateLoading`; Clock In on `!canClockIn || actionLoading`. `embedded` drops the wrapper's bottom margin.
- **Tests:** none (no render smoke for the component).
- **Extraction status:** stays with the parent; it is the component.

Expand Down
3 changes: 2 additions & 1 deletion docs/GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4556,7 +4556,8 @@ There **Break** is a quiet press beside the quiet Clock out at a desk and a smal
On a break the card draws the bar's own row in a band under its header (`JobModeOnBreak`), and on a phone **Back to work** is the bar's small row.
A phone bar that would hold six presses keeps its two rows, since six do not fit one row at 375 px (`ONE_ROW_MOST`).
The card check and the review come once, at the Clock Out that ends the day.
A day that ends on a break has no review, so since v2.9217 **Done for the day** ends the break and then offers the day's bids in a window, **Your bids today**, where a clock out would have drawn them (`lib/clock/doneForTheDay.ts`, `components/clock/DoneForTheDayBidDay.tsx`).
A day that ends on a break has no review, so since v2.9217 **Done for the day** ends the break and then offers the day's bids in a window, **Your bids today**, when the day holds a bid (`lib/clock/doneForTheDay.ts`, `components/clock/DoneForTheDayBidDay.tsx`).
Since v2.9278 a day with no bid opens no window for any role, an estimator's too, because the window has no note to type and an empty list there is one dead press (finding 866).
The window keeps the list with **Keep my list** through `save_my_bid_day`, and it can be closed without keeping: the day is ended either way.

**Code**: kernel `lib/clock/clockBreak.ts` · `hooks/useClockBreak.ts` · `components/clock/ClockBreakPresses.tsx` · the door `lib/clock/clockBreakDoor.ts`, `contexts/ClockBreakDoorContext.tsx` · Job Mode `lib/jobMode/pressBar.ts`, `components/jobMode/JobModeOnBreak.tsx`
Expand Down
45 changes: 45 additions & 0 deletions docs/recent-features/v2.9278.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# v2.9278 — The clock: Done for the day opens no window on a day with no bid (2026-12-03)

Finding 866, from the walker's look at punch list #473's step 4 (v2.9217) on the live site. Client only. No migration, no function change, nothing owed on prod.

## What was wrong

As the sample estimator, on a day with no bid: **Break**, then *Done for the day*. The bar went back to plain Clock In, and the window **Your bids today** opened all the same. It read *Bids you worked on today 0* and *The app saw no bid today*, its **Keep my list** was dead, and its words said *say what you did below* with nothing below. v2.9217's own look says, at step 8, that no window opens on such a day.

## Why

`DoneForTheDayBidDay` asked `useClockOutBidDay` for `show`, the clock out's rule: the day holds a bid, **or the role is `estimator`**. The clock out draws an estimator an empty list on purpose. Its review is open anyway, and under the list it asks for a typed note. The window at *Done for the day* has no note, so there an empty list is one dead press. The render test's *day with no bid* case ran as the role `helpers`, so it never met the estimator's half of the rule.

## The mend

- `doneListStep` (`src/lib/clock/doneForTheDay.ts`) takes `empty`, the list's own `BidDayList.empty`, in place of `show`. A day with no row opens nothing, for every role.
- `DoneForTheDayBidDay.tsx` hands it `bidDay.list.empty`.
- A bid that was only opened (the *Opened, nothing changed* shelf) still opens the window: it can be ticked onto the list.
- The clock out's review and `useClockOutBidDay` are not changed. An estimator's clock out still draws the empty list beside its note.

## The pick, and the way not picked

**Picked: no window on a day with no bid, for every role.** It is what the kernel's own comment and the look's step 8 already said, and it keeps the promise that the list never stands between a person and the end of their day.

**Not picked: the window for an estimator whose board holds a bid to add, with empty words of its own.** The board is a second read, so the window would have to wait on it or pop late. My time's **Your bids today** already offers the board's bids for a bid the app missed, for today and yesterday.

## Tests

- `doneForTheDay.test.ts`: the rule takes no role, and a day with no bid answers `none`.
- `DoneForTheDayBidDay.render.test.tsx`, three new cases: an estimator's empty day draws nothing and ends the ask (red before the mend), the same with a bid on the board, and a day whose bid was only opened still draws the window.

## Words

The guide `take-a-break-from-the-clock` says no window opens on a day with no bid. The glossary's Break entry and the clock map say the rule. The card `to-dos/clock-break/README.md` holds the finding and its look.

## The look owed

On the live site after the deploy, as the sample estimator by View as, with the live-write slot. View as keeps no bid trace, so the day holds no bid. It makes two short sessions on a ZZ Test bid.

1. Clock in on a ZZ Test bid. Press **Break**, then *Done for the day*.
2. The bar goes back to plain Clock In at once. **No window opens.**
3. Do the same on Job Mode at 375 wide: no window opens there either.
4. Open the Dashboard's My Time and press *Your bids today*: the block still opens with its empty list, as before.
5. Delete the ZZ Test sessions, or name them in the note.

The window on a day that holds a bid is steps 3 to 7 of v2.9217's look, and those need a real sign-in as a ZZ Test person who works on bids.
2 changes: 1 addition & 1 deletion src/components/ClockInOutButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -732,10 +732,10 @@
}
})()
return () => {
assignedJobsFetchGenRef.current++

Check warning on line 735 in src/components/ClockInOutButton.tsx

View workflow job for this annotation

GitHub Actions / typecheck, lint and the checks

The ref value 'assignedJobsFetchGenRef.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy 'assignedJobsFetchGenRef.current' to a variable inside the effect, and use that variable in the cleanup function
}
// showToast via ref only — including showToast here caused a loop when any toast updated ToastProvider and gave consumers a new reference chain in some builds.
}, [

Check warning on line 738 in src/components/ClockInOutButton.tsx

View workflow job for this annotation

GitHub Actions / typecheck, lint and the checks

React Hook useEffect has a missing dependency: 'openSession'. Either include it or remove the dependency array
clockInModalOpen,
updateFocusModalOpen,
clockOutReviewOpen,
Expand Down Expand Up @@ -801,7 +801,7 @@
}
})()
return () => {
missingReportsFetchGenRef.current++

Check warning on line 804 in src/components/ClockInOutButton.tsx

View workflow job for this annotation

GitHub Actions / typecheck, lint and the checks

The ref value 'missingReportsFetchGenRef.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy 'missingReportsFetchGenRef.current' to a variable inside the effect, and use that variable in the cleanup function
}
}, [
clockOutReviewOpen,
Expand Down Expand Up @@ -1093,7 +1093,7 @@
return () => {
cancelled = true
}
}, [

Check warning on line 1096 in src/components/ClockInOutButton.tsx

View workflow job for this annotation

GitHub Actions / typecheck, lint and the checks

React Hook useEffect has a missing dependency: 'openSession'. Either include it or remove the dependency array
clockOutReviewOpen,
updateFocusModalOpen,
openSession?.id,
Expand Down Expand Up @@ -1144,7 +1144,7 @@
clockBreakRef.current = clockBreak

// Done for the day (punch list #473, step 4): the break ends first, at once. Then the person's own day is read,
// and where a clock out would have drawn the list of the day's bids the same list is offered, to keep with one press.
// and where the day holds a bid the clock out's list is offered, to keep with one press (no bid, no window: finding 866).
const [doneListAsked, setDoneListAsked] = useState(false)
const ownClock = authUser?.id != null && authUser.id === userId
const doneForTheDay = useCallback(() => {
Expand Down
30 changes: 28 additions & 2 deletions src/components/clock/DoneForTheDayBidDay.render.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { renderWithProviders, SMOKE_AUTH_USER_ID } from '../../test/renderSmokeM
import { todayYmdInAppTz } from '../../utils/dateUtils'
import { DoneForTheDayBidDay } from './DoneForTheDayBidDay'

const h = vi.hoisted(() => ({ fetchDay: vi.fn(), saveDay: vi.fn() }))
const h = vi.hoisted(() => ({ fetchDay: vi.fn(), saveDay: vi.fn(), boardPicks: [] as Array<{ id: string; bid_number: string; project_name: string }> }))

vi.mock('../../lib/clock/bidDayIo', () => ({ fetchMyBidDay: h.fetchDay, saveMyBidDay: h.saveDay }))
vi.mock('../../lib/bids/bidJobsOpenedIo', () => ({ loadJobsOpenedFromBids: async () => [] }))
vi.mock('../../lib/fetchWorkingBoardClockBidPicks', () => ({ fetchWorkingBoardClockBidPicks: async () => [] }))
vi.mock('../../lib/fetchWorkingBoardClockBidPicks', () => ({ fetchWorkingBoardClockBidPicks: async () => h.boardPicks }))

const B412 = '0b1d0000-0000-4000-8000-00000000b412'
const clockIn = new Date(Date.now() - 3 * 60 * 60 * 1000)
Expand Down Expand Up @@ -47,6 +47,7 @@ afterEach(() => {
cleanup()
h.fetchDay.mockReset()
h.saveDay.mockReset()
h.boardPicks = []
})

describe('DoneForTheDayBidDay', () => {
Expand Down Expand Up @@ -107,6 +108,31 @@ describe('DoneForTheDayBidDay', () => {
expect(screen.queryByRole('dialog')).toBeNull()
})

// Finding 866: the clock out draws an estimator its list on an empty day, beside the note it asks for. This window
// has no note, so an empty list here is a dead press and nothing else.
it('draws nothing for an estimator whose day holds no bid', async () => {
h.fetchDay.mockResolvedValue(emptyDay)
const onClose = draw({ role: 'estimator' })
await waitFor(() => expect(onClose).toHaveBeenCalled())
expect(screen.queryByRole('dialog')).toBeNull()
})

it('draws nothing for that day with a bid on the board either: My time adds a bid the app missed', async () => {
h.fetchDay.mockResolvedValue(emptyDay)
h.boardPicks = [{ id: B412, bid_number: '412', project_name: 'ZZ Test Ridgeway Clinic' }]
const onClose = draw({ role: 'estimator' })
await waitFor(() => expect(onClose).toHaveBeenCalled())
expect(screen.queryByRole('dialog')).toBeNull()
})

it('draws the window for a bid that was only opened, so it can be ticked onto the list', async () => {
h.fetchDay.mockResolvedValue({ ...day, changes: [] })
const onClose = draw({ role: 'helpers' })
const win = await screen.findByRole('dialog', { name: 'Your bids today' })
expect(win.textContent).toContain('Opened, nothing changed')
expect(onClose).not.toHaveBeenCalled()
})

it('draws nothing and ends the ask when the day cannot be read', async () => {
h.fetchDay.mockRejectedValue(new Error('offline'))
const onClose = draw()
Expand Down
6 changes: 3 additions & 3 deletions src/components/clock/DoneForTheDayBidDay.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* The day's list of bids at *Done for the day* (punch list #473, step 4). The break is already over when this is
* asked: the bar ends it first. This reads the person's day and, where the clock out would have drawn the list of
* the day's bids, draws the same list in a window with one press that keeps it. A day with no bid, a read that
* asked: the bar ends it first. This reads the person's day and, where the day holds a bid, draws the clock out's
* list in a window with one press that keeps it. A day with no bid (an estimator's too, finding 866), a read that
* fails and a window closed unkept all end the ask with nothing drawn. The rule and the words are
* `lib/clock/doneForTheDay.ts`; the list itself is the clock out's own (`ClockOutBidDay`, `useClockOutBidDay`).
*/
Expand Down Expand Up @@ -76,7 +76,7 @@ export function DoneForTheDayBidDay({ userId, role, prefixMap, asked, onClose }:
}
}, [asked, userId])

const step = doneListStep({ asked, failed: bidDay.failed, read: bidDay.workDate !== '', show: bidDay.show })
const step = doneListStep({ asked, failed: bidDay.failed, read: bidDay.workDate !== '', empty: bidDay.list.empty })

// Nothing to draw: the day could not be read, or it holds no bid. The day is ended already, so the ask just ends.
useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/content/help/take-a-break-from-the-clock.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Nothing is lost from your hours. The questions at clock out are not asked that d
If you worked on bids today, **Done for the day** opens a window named Your bids today. The window lists the bids of your day, as clock out does. Press {{button:green|Keep my list}} to keep the list for the office.

You can press {{button:outline|Close without keeping}} instead. Your day is ended either way.

No window opens on a day with no bid.
:::

## On Job Mode
Expand Down
15 changes: 15 additions & 0 deletions src/content/releaseNotes/v2.9278.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { ReleaseNote } from '../../lib/releaseNotes'

const note: ReleaseNote = {
version: 'v2.9278',
date: '2026-12-03',
title: 'The clock: Done for the day opens no window on a day with no bid',
kind: 'fix',
highlights: [
'An estimator who ended a break with Done for the day got the Your bids today window even on a day with no bid. It held an empty list and a Keep my list press that did nothing.',
'Now the window opens only when your day holds a bid. On a day with none, Done for the day ends your break and nothing else happens.',
'You can still add a bid the app missed on My time, under Your bids today. Clock out is not changed.',
],
}

export default note
13 changes: 7 additions & 6 deletions src/lib/clock/doneForTheDay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@ import { describe, expect, it } from 'vitest'
import { doneListKeepLabel, doneListKeptToast, doneListLaterWords, doneListStep } from './doneForTheDay'

describe('doneListStep', () => {
const read = { asked: true, failed: false, read: true, show: true }
const read = { asked: true, failed: false, read: true, empty: false }

it('is idle until Done for the day is pressed', () => {
expect(doneListStep({ ...read, asked: false })).toBe('idle')
})

it('reads the day, then draws the list where the clock out would have', () => {
expect(doneListStep({ ...read, read: false, show: false })).toBe('reading')
it('reads the day, then draws the list of a day that holds a bid', () => {
expect(doneListStep({ ...read, read: false, empty: true })).toBe('reading')
expect(doneListStep(read)).toBe('list')
})

it('draws nothing for a day with no bid', () => {
expect(doneListStep({ ...read, show: false })).toBe('none')
// Finding 866: the rule takes no role, so an estimator's empty day opens no window either.
it('draws nothing for a day with no bid, whoever the person is', () => {
expect(doneListStep({ ...read, empty: true })).toBe('none')
})

it('draws nothing when the day cannot be read, read or not', () => {
expect(doneListStep({ ...read, failed: true })).toBe('none')
expect(doneListStep({ asked: true, failed: true, read: false, show: false })).toBe('none')
expect(doneListStep({ asked: true, failed: true, read: false, empty: true })).toBe('none')
})
})

Expand Down
12 changes: 8 additions & 4 deletions src/lib/clock/doneForTheDay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ import { bidDayPressLabel, worksOnBids } from './bidDay'
* stopped at **Break**, so that day kept no list and People → Hours drew no bid labels for it.
*
* *Done for the day* ends the break first, at once and whatever happens next. Then it reads the person's day, and
* where the clock out would have drawn the list it draws the same list in a window with one press that keeps it.
* where the day holds a bid it draws the clock out's list in a window with one press that keeps it.
* The list never stands between a person and the end of their day: a read that fails, a day with no bid and a
* window closed unkept all leave the day ended.
*
* The window's rule is its own, and narrower than the clock out's (finding 866). The clock out draws an estimator
* the list on an empty day too, because its review is open anyway and asks for a typed note under the list. This
* window has no note, so an empty list here is one dead press. A day with no bid opens nothing, for every role.
*/

/** Where the ask stands: nothing asked, the day being read, the list to draw, or nothing to draw. */
Expand All @@ -21,13 +25,13 @@ export function doneListStep(input: {
failed: boolean
/** The day is read. */
read: boolean
/** The clock out's own rule: the day holds a bid, or the person is an estimator. */
show: boolean
/** The day's list has no row: no bid worked on and none opened (`BidDayList.empty`). */
empty: boolean
}): DoneListStep {
if (!input.asked) return 'idle'
if (input.failed) return 'none'
if (!input.read) return 'reading'
return input.show ? 'list' : 'none'
return input.empty ? 'none' : 'list'
}

export const DONE_LIST_TITLE = 'Your bids today'
Expand Down
Loading
Loading