Skip to content

feat(ui): timer duration editor - #242

Merged
hughobrien merged 10 commits into
mainfrom
feat/timer-duration-editor
May 14, 2026
Merged

hughobrien merged 10 commits into
mainfrom
feat/timer-duration-editor

Conversation

@hughobrien

Copy link
Copy Markdown
Owner

Summary

Re-clicking an active night/turbo timer chip now opens a centred two-input duration editor (hours + minutes) below the countdown line — mirroring the preset-chip pattern. The chip itself no longer has an in-chip deactivate gesture; users stop a timer via any speed chip (preset/manual) or power-off, both of which already clear $specialMode via the existing cascades.

Editing the duration writes param 0x0302 (night) or 0x0303 (turbo). Verified against the office unit at firmware 0.11 during design: a single duration write while the timer is active restarts the running countdown on its own, so the handler is one WriteParams call — no follow-up 0x0007 re-arm needed.

  • New op breezy.SetTimerDuration(ctx, c, mode, hours, minutes) in pkg/breezy/ops.go + unit tests
  • New endpoint POST /ui/devices/{name}/timer-duration (validated; SSE error envelope)
  • New per-device client-only signals $durationEditor and $_durationEdit (NOT in CardSignals — they survive across SSE pushes)
  • Single data-effect on .ctrl-group-timer closes a stale editor when $durationEditor and $specialMode diverge — catches cascade-driven deactivation, power-off, scheduler, and server-pushed mode change with one rule

Design: docs/superpowers/specs/2026-05-14-timer-duration-editor-design.md
Plan: docs/superpowers/plans/2026-05-14-timer-duration-editor.md

Test plan

  • go test ./pkg/breezy/ -run TestOps_SetTimerDuration -v — happy path + range/mode rejection
  • go test ./cmd/breezyd/ -run 'TestUIWriteTimerDuration|TestUIWriteAction_NotFound' -v — handler happy + each validation path + 404
  • go test ./cmd/breezyd/ui/templates/ -run 'TestTimerClickExpr|TestTimerGroupCloseEditorEffect|TestTimerDurationEditor|TestInitialCardSignals' -v — click-expr branches, closure rule, change-expr substrings, signal seeding
  • just test-templ-drift — generated *_templ.go in sync
  • just test-ui — 34/34 Playwright tests, including 6 new timer-duration scenarios (open via re-click, edit posts + countdown snaps, third-click closes, preset/power-off/mode-switch cascades close editor)
  • golangci-lint run ./... — 0 issues
  • go test -race ./... — passed in the prior just ci attempt
  • Live verification on breezy.wg — deferred to post-merge per discussion

🤖 Generated with Claude Code

hughobrien and others added 10 commits May 14, 2026 01:41
Re-click on an active night/turbo chip opens a centred duration
editor (hours + minutes) below the countdown line, mirroring the
preset-chip pattern. Includes the firmware-behaviour probe result
that single-write 0x0302/0x0303 restarts the running countdown by
itself — so the server-side handler is one ParamWrite.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Eight-task plan with TDD steps, exact file refs, and code blocks.
Tasks 0-1 are server-side (ops + handler); 2-5 are templ/CSS
(signals, click-expr, editor component, styling); 6 is Playwright;
7 is pre-push gates + live verification on breezy.wg.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Six scenarios: first-click activates, re-click opens editor, editing
posts new duration body, third-click closes editor, preset/power-off
cascade closes editor, and night→turbo switch closes night editor.
Adds withDuration(name, mode, hours, minutes) fixture helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hughobrien
hughobrien enabled auto-merge (squash) May 14, 2026 15:05
@hughobrien
hughobrien merged commit 8700113 into main May 14, 2026
6 checks passed
@hughobrien
hughobrien deleted the feat/timer-duration-editor branch May 14, 2026 15:08
hughobrien added a commit that referenced this pull request Jun 29, 2026
* docs: timer-duration editor design

Re-click on an active night/turbo chip opens a centred duration
editor (hours + minutes) below the countdown line, mirroring the
preset-chip pattern. Includes the firmware-behaviour probe result
that single-write 0x0302/0x0303 restarts the running countdown by
itself — so the server-side handler is one ParamWrite.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* docs: timer-duration editor implementation plan

Eight-task plan with TDD steps, exact file refs, and code blocks.
Tasks 0-1 are server-side (ops + handler); 2-5 are templ/CSS
(signals, click-expr, editor component, styling); 6 is Playwright;
7 is pre-push gates + live verification on breezy.wg.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(breezy): SetTimerDuration op for night/turbo (0x0302/0x0303)

* feat(ui): POST /ui/devices/{name}/timer-duration handler

* feat(ui): seed $durationEditor + $_durationEdit signals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(ui): timer chip re-click toggles duration editor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* style: gofmt alignment in render_test.go

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(ui): timer duration editor component + change-handler

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(ui): timer-duration-editor centred-row CSS

* test(ui): playwright coverage for timer duration editor

Six scenarios: first-click activates, re-click opens editor, editing
posts new duration body, third-click closes editor, preset/power-off
cascade closes editor, and night→turbo switch closes night editor.
Adds withDuration(name, mode, hours, minutes) fixture helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant