fix(routines): test the copy, name what Yes agrees to, and true up the docs

Make it mine's copying was inline in App and untested; it is now a pure
function with a test, so a change to either store can't make the copy
silently arrive empty. The question's buttons now say what they answer
when heard out of context. The prefs block and the spec now match what
shipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-13 14:19:16 +02:00
co-authored by Claude Opus 5.5
parent f7ba86e6e5
commit 1c7df637a4
7 changed files with 65 additions and 10 deletions
+10 -5
View File
@@ -35,7 +35,13 @@ import { clockFor, formatRemaining } from "../shared/time.ts";
import { dailySummary, isDaily, resolveDaily } from "../shared/daily.ts";
import { goalStatus, readGoal, type GoalStatus } from "../shared/goal.ts";
import { taskStatus, type TaskShape } from "../shared/task.ts";
import { activeRoutines, mineFrom, routineToAsk, type Routine } from "../shared/routines.ts";
import {
activeRoutines,
copyRoutineState,
mineFrom,
routineToAsk,
type Routine,
} from "../shared/routines.ts";
import { strandedOccurrences } from "../shared/recurrence.ts";
import { orderGames } from "./state/gameOrder.ts";
import { GameMetaProvider, type MetaResolver } from "./state/gameMeta.tsx";
@@ -212,10 +218,9 @@ export function App() {
const makeItMine = (routine: Routine) => {
if (tasks.tasks.some((t) => t.from === routine.id)) return;
const id = tasks.addTask(mineFrom(routine));
const log = daily.logs[routine.id];
if (log !== undefined) daily.merge({ [id]: log });
const numbers = amounts.amounts[routine.id];
if (numbers !== undefined) amounts.merge({ [id]: numbers });
const copy = copyRoutineState(daily.logs, amounts.amounts, routine.id, id);
daily.merge(copy.daily);
amounts.merge(copy.amounts);
};
const taskStatusOf = (task: TaskShape): GoalStatus =>
+2
View File
@@ -384,6 +384,7 @@ export function Dailies({
<button
type="button"
onClick={() => ask.onAnswer(true)}
aria-label={`Yes, track ${gameMeta(ask.game).name}'s built-in weekly tasks`}
className="font-medium text-near transition-colors hover:text-ink"
>
Yes
@@ -391,6 +392,7 @@ export function Dailies({
<button
type="button"
onClick={() => ask.onAnswer(false)}
aria-label={`No thanks to ${gameMeta(ask.game).name}'s built-in weekly tasks`}
className="text-faint transition-colors hover:text-muted"
>
No thanks