Commit Graph
2 Commits
Author SHA1 Message Date
Tim SmartandNgoc Pham 8ca9b7a923 [AI] Add the automatic "For next month" UI
Desktop and mobile share one hook and one menu. `useFutureBufferMode`
reads `__global!future-buffer-start` and the month's `frozen` cell
through sheet bindings, so a mode change from another device shows up
without a reload, and `isManagedMonth` is a pure rule.

- To Budget menu item "For next month: Automatic…" / "Manual…" opening
  the mode modal. Shown with the experimental flag, and always once the
  mode is on.
- Mode modal with the Manual and Automatic choices, the start month, and
  the consequences of switching either way.
- Managed months hide Hold, Reset, Disable current auto hold, the income
  auto-hold toggle and the rollover arrow, explain "For next month" in a
  tooltip, and say how much is held for future months under
  "Overbudgeted". Frozen months keep Hold and Reset and lose the
  auto-hold controls.
- The budget-type switch says automatic mode is turned off first.
- `useSheetValue` observes the sheet a binding names, which the global
  cell needs.
- `month` reaches `ToBudgetAmount`, `TotalsList` and `BudgetSummary`,
  `TotalsList` provides its own sheet, and `monthFromSheet` maps a sheet
  back to its month.

Co-authored-by: Ngoc Pham <ngocphamm@fastmail.fm>
2026-11-06 10:33:34 +00:00
Tim Smart 2a61058bfd [AI] Compute the "For next month" buffer from future months
Adds a frozen column to zero_budget_months and a frozen cell per month,
loaded with the stored buffer. buffered-computed holds what the months
after a month need from it: next month's budgeted amount, less its
income, plus overspending that reaches it, plus its own need.

__global!future-buffer-start holds the futureBufferMode preference. It's
read on every budget open, after the months are created, and updated
when the preference row changes locally or through sync.
buffered-selected uses the computed buffer in managed months, the stored
buffer in frozen months, and today's rule otherwise.

setBuffer takes an optional frozen flag and only writes the columns
that change. envelope-budget-month also emits frozen and
buffered-selected.
2026-11-06 10:33:34 +00:00