Skip to content

feat(temp): shared notice banners and toasts, and an away card state - #796

Merged
ng merged 3 commits into
devfrom
feat/temp-notices
Oct 9, 2026
Merged

ng merged 3 commits into
devfrom
feat/temp-notices

Conversation

@ng

@ng ng commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replaces the one-off notices on the Temperature screen with a small shared system: banners for things that are ongoing or need action, and toasts for confirmations. The Cards view and the Stage both use it.

New pieces

  • ds/notice.tsx: NoticeBanner and NoticeStack. Kinds are progress, action, success and info. Tones are cool, ok, warn and danger. The stack sorts danger, then warn, then cool. Danger banners use role="alert" and the rest use role="status".
  • ds/toast.tsx: ToastProvider is mounted in AppShell, and useToast().show(notice) shows a toast.
    • One toast is shown at a time; later toasts wait in a queue, and a toast with the same id replaces the visible one.
    • A toast lasts 4s and pauses on hover or focus. A 2px bar along the bottom counts down.
    • It enters and leaves with a 250ms rise. Under prefers-reduced-motion it only fades.
    • On desktop it is centered on the content column. On a phone it sits above the TabBar.
  • TempScreen/useTempNotices.tsx: derives notices from device status and fires the prime-complete toast.

Notices

  • Pump stall, per side: an action banner in danger. It has Re-enable and a dismiss X, and blocks that side.
  • Alarm active: an action banner in warn, with Snooze 5m and Stop.
  • Alarm snoozed: a progress banner in warn, showing {n}M remaining and a Cancel action. The existing side-targeting logic is kept.
  • Priming: a progress banner in cool that blocks both sides. It no longer pulses. The device reports only isPriming, so the banner has no progress bar or ETA.
  • Priming complete: a toast, after which dismissPrimeNotification is called right away.
    • A completion older than 1 hour is dismissed without a toast.
    • A completion is toasted at most once, even if the cards and the Stage are both mounted.
  • Priming failed: the device has no failure state, so the hook only carries a TODO for it.

Blocked sides. While a notice blocks a side, its SideCard renders at 40% opacity with pointer events off and reads PAUSED. In the Stage, the side's label reads PAUSED and its keys, drag and power are ignored.

Away (separate commit). An away side now shows on its card: a dashed border, a mono AWAY label with a plane icon, and, when the side is off, "Off" with a Turn on button.

Removed: DeviceAlerts, AlarmBanner, PumpStallNotification, PrimingIndicator and PrimeCompleteNotification. Their tests moved into useTempNotices.test.tsx.

Behavior notes

  • WaterLevelCard's "last primed" line reads the same server flag, which is now cleared as soon as the toast shows, so that line disappears sooner than before.
  • useDeviceStatus wraps the WebSocket's unix-seconds primeCompletedNotification.timestamp in a Date as if it were milliseconds. primeCompletedAtMs reads either form back correctly. The underlying conversion is not fixed in this PR.

Test plan

  • tsc --noEmit clean
  • eslint clean on changed files
  • vitest run over TempScreen, Stage, ds, AppShell and app: 31 files, 301 passed
  • Demo build with priming forced on and one side away:
    • The Priming banner shows on both Cards and Stage.
    • Both cards read PAUSED.
    • When priming ends, the "Priming complete. Your pod is ready." toast appears and dismisses itself.
    • On a 390px phone, the toast sits above the TabBar.
    • The away card is dashed with an AWAY label.
  • On the pod, start a prime from System. Controls pause during priming, and exactly one toast shows when it finishes.
  • On the pod, trigger an alarm. Snooze 5m and Stop work, and the snoozed banner counts down and can be cancelled.

🤖 Generated with Claude Code

🛏️ Beam this PR onto a sleepypod ✨

Pick the snippet that matches your pod. Already-installed pods can't use the curl bootstraps below — sleepypod's egress firewall DROPs github.com, and the script that knows how to unblock WAN is the very file curl is trying to fetch. Use sp-update instead; it's on disk and opens WAN as its first step.

🔄 Already on a sleepypod (most common — review a PR on a running pod):

sudo sp-update feat/temp-notices

🚀 Fresh pod / first install — bootstraps from GitHub, rebuilds every push:

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/feat/temp-notices/scripts/install \
  | sudo bash -s -- --branch feat/temp-notices

🎯 Pin to this exact build (run 37864492321 · 87f768d) — fresh-pod path, locked to one CI artifact for reproducible review:

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/87f768d5a7ca0410f100611436583345e6f5bb33/scripts/install \
  | sudo bash -s -- \
      --branch feat/temp-notices \
      --artifact-url 'https://nightly.link/sleepypod/core/actions/runs/37864492321/sleepypod-core.zip'

🧊 Artifact: sleepypod-core · self-destructs in 30 days 💥

@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sleepypod-demo Ignored Ignored Preview Oct 9, 2026 12:23am UTC

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8520ce65-1609-4ee6-84d7-59e54b7d185a
📥 Commits

Reviewing files that changed from the base of the PR and between 0d8ae98 and 87f768d.

📒 Files selected for processing (24)
  • app/globals.css
  • src/components/AppShell/AppShell.tsx
  • src/components/Stage/StagePanel.tsx
  • src/components/Stage/TempStage.tsx
  • src/components/Stage/tests/TempStage.test.tsx
  • src/components/TempScreen/AlarmBanner.tsx
  • src/components/TempScreen/DeviceAlerts.tsx
  • src/components/TempScreen/PrimeCompleteNotification.tsx
  • src/components/TempScreen/PrimingIndicator.tsx
  • src/components/TempScreen/PumpStallNotification.tsx
  • src/components/TempScreen/SideCard.tsx
  • src/components/TempScreen/TempScreen.tsx
  • src/components/TempScreen/TemperatureHoldControls.tsx
  • src/components/TempScreen/tests/AlarmBanner.test.tsx
  • src/components/TempScreen/tests/PumpStallNotification.test.tsx
  • src/components/TempScreen/tests/TempScreen.test.tsx
  • src/components/TempScreen/tests/useTempNotices.test.tsx
  • src/components/TempScreen/useSideTemperature.ts
  • src/components/TempScreen/useTempNotices.tsx
  • src/components/ds/index.ts
  • src/components/ds/notice.tsx
  • src/components/ds/tests/notice.test.tsx
  • src/components/ds/tests/toast.test.tsx
  • src/components/ds/toast.tsx
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

@ng

ng commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Adversarial review (Sonnet + Codex, standard depth)

Fixed in the review-fix commit (rebased onto dev after #795), each with a regression test that fails on the pre-fix code:

  • 🟡 Pump-stall actions shared one mutation observer across sides, and TanStack tracks only the latest call. Re-enabling left, then right, made left look idle while its request was still in flight, which undid the f8c7d19 lockout. Each side now has its own observers. (Codex repro + Sonnet)
  • 🟡 Stage Link (button or L) copied power and temperature onto a paused side. The copy is skipped while either side is paused; the link itself still toggles.
  • 🟡 The Stage panel's Resume and dial stayed live while paused. HoldStatus takes disabled, and the controls under it are inert while paused. PAUSED stays readable.
  • 🟡 A −/+ step queued in the 500ms window still sent after a notice paused the side. It's now cancelled and the preview discarded.
  • 🟢 A paused side, when linked, still moved its partner on drag or keys. A paused side now drives nothing.

Left for the author (Minor): the snooze countdown can be stale for up to 15s after a snooze starts; a failed prime dismissal is never retried; the toast isn't keyboard-reachable and hover and focus share one pause flag; the toast exit animation doesn't restart (same keyframes reversed); inert on the whole SideCard hides its readouts from assistive tech; the Cards and Stage hook instances don't share pending state.

Pre-existing: Stage's global Space shortcut fires on focused notice buttons; a closed StagePanel is still keyboard-focusable; WaterLevelCard reads Unix seconds as milliseconds.

@ng
ng force-pushed the feat/temp-notices branch from 58036c2 to 87f768d Compare October 9, 2026 00:23
@ng
ng enabled auto-merge October 9, 2026 00:23
@ng
ng added this pull request to the merge queue Oct 9, 2026
Merged via the queue into dev with commit 8b52e84 Oct 9, 2026
9 checks passed
@ng
ng deleted the feat/temp-notices branch October 9, 2026 00:33
ng added a commit that referenced this pull request Oct 9, 2026
…rves, and shared notices (#797)

Promote `dev` at `8b52e84a01d6f5dbe2d64559d324c052a6912f1a` to `main`.

- **Stage is the Temperature default** (#793): the 3D Stage opens first, with tones and per-side activity on its timeline.
- **Curves get their own URLs** (#794): `/schedule/<days>?side=` deep-links straight into a curve's editor; curves draw as a smooth line with a tone-tinted fill; set points inside a flat hold are dropped on save (the first row after midnight and any row that would open a >12h gap are kept).
- **Shared notices** (#796): pump stall, priming and alarm banners plus a priming-complete toast, shared by the cards and the Stage; a notice that blocks a side pauses all of that side's controls (link, resume, dial, queued steps); away shows on the side card itself.
- **Stage panel** (#795): says Off once instead of twice.

## Test plan
- [x] dev CI: lint, typecheck, unit tests, build green on each merged PR
- [x] Adversarial review (Sonnet + Codex) on #794 and #796; Major findings fixed with regression tests
- [ ] After release: `sudo sp-update main` on a pod; Temperature opens on the Stage; a curve link opens its editor; priming shows the banner and pauses controls

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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