Replace blocking alert() with inline validation and warn on imminent Window triggers#240
Merged
Merged
Conversation
…nent Window triggers alert() is silently swallowed by the Tauri desktop webview, so the no-days-selected validation on Edit Alarm never actually reached the user. Replace it with an inline error under the day selector instead, which also reads better for a required-field error than a transient alert would. Window mode's overnight-crossing support (end time <= start time is a deliberate, valid design for windows like 11pm-6am) has no UI indication when it happens, so an accidental Start/End tap can silently schedule a trigger within minutes with zero feedback. Add an inline "crosses midnight" hint while editing, plus a post-save confirmation dialog when the resulting alarm's next trigger is under 30 minutes away, giving the user a chance to go back and adjust instead of finding out when the alarm rings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MM1S4DNyxhwcbkMcx3hDp2
…ndow handling Two issues caught in review of this same change: the save-failure catch block still called alert(), the exact bug this PR otherwise removed, so a failed save (e.g. a zero-length window, which the scheduler rejects outright) was completely silent on desktop. Swapped it for showToast(), now that desktop toasts actually work. Also guard handleSave client-side against windowStart === windowEnd so it never round-trips a request the scheduler will reject, and split the Window-mode hint text so a zero-length window gets its own accurate error instead of being mislabelled as "crosses midnight". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MM1S4DNyxhwcbkMcx3hDp2
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MM1S4DNyxhwcbkMcx3hDp2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
alert()is silently swallowed by the Tauri desktop webview (confirmed via direct timing measurement — the call returns instantly with no dialog ever shown), so Edit Alarm's "select at least one day" validation never actually reached the user on desktop. Replaced with an inline error message under the day selector, which is also just a better pattern for a required-field error than a transient alert/toast.windowEnd <= windowStart, e.g. an 11pm-6am window) is intentional, existing scheduler behaviour, but the UI gives zero indication when it happens — an accidental Start/End mix-up can silently schedule a trigger within minutes with no feedback at all. Added:windowEnd <= windowStart.nextTrigger(already returned byAlarmService.save()— no new Rust command needed) is under 30 minutes away, letting the user go back and adjust before finding out the hard way.Test plan
pnpm --filter threshold exec tsc --noEmitcleanpnpm --filter threshold test— 53 tests passalert(), no crash)🤖 Generated with Claude Code
https://claude.ai/code/session_01MM1S4DNyxhwcbkMcx3hDp2