fix(goal): never drop an unreadable goal by accident, and let the count be retyped

Review found three ordinary actions that deleted a goal this build could
not read: "It repeats daily", pressing an already-pressed Off, and "not
daily" without saying so. Only "not daily" clears a goal now, and its
warning keys off what is stored, not what parses.

The count field was bound straight to the goal, so emptying it snapped
the old number back and typing appended to it. It now keeps a draft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-13 13:24:41 +02:00
1 parent d5ffad38c5
commit 064cea25fd
8 files changed
+177 -44

No files matched your search

+10 -3
View File
@@ -38,6 +38,7 @@ export function EventDetail({
detectedDaily,
dailyDays,
goal,
hasStoredGoal,
onDaily,
onGoal,
onToggleDay,
@@ -64,7 +65,13 @@ export function EventDetail({
dailyDays: string[];
/** The reader's check-in goal, already read through `readGoal`. */
goal: Goal | undefined;
onDaily: (id: string, daily: boolean | undefined) => void;
/**
* Whether anything is stored under the goal at all, readable or not. A goal
* of a newer shape reads as none, and "not daily" would still remove it, so
* the warning keys off this rather than off `goal`.
*/
hasStoredGoal: boolean;
onDaily: (id: string, daily: boolean | undefined, clearsGoal?: boolean) => void;
onGoal: (id: string, goal: Goal | undefined) => void;
onToggleDay: (id: string, day: string) => void;
onIgnore: (id: string) => void;
@@ -246,10 +253,10 @@ export function EventDetail({
)}
<button
type="button"
onClick={() => onDaily(event.id, dailyOverride(false, detectedDaily))}
onClick={() => onDaily(event.id, dailyOverride(false, detectedDaily), true)}
className="mt-2 block text-xs text-faint transition-colors hover:text-muted"
>
{goal === undefined
{!hasStoredGoal
? "This isn't a daily event"
: "This isn't a daily event — removes the goal"}
</button>