Couple daily can and spend limits via usual can size

Link daily caps through the user's chosen standard can size (250/355/473ml)
and built-in prices. Onboarding asks for size and can ceiling with derived
spend preview. Settings syncs cans and spend bidirectionally. Forecast lock
button sets both limits together.

Co-authored-by: nh9961 <hello@nedhalksworth.com>
This commit is contained in:
Cursor Agent
2026-07-01 14:45:45 +00:00
parent 7f56274e65
commit 7a461af9ee
7 changed files with 229 additions and 148 deletions
+5
View File
@@ -94,6 +94,7 @@ import { createExcelExport, downloadBlob, parseExcelImport } from "./lib/excel";
import {
caffeineFor,
caffeinePerCan,
canLimitFromSpend,
currency,
currentStreak,
daysSinceLast,
@@ -656,6 +657,7 @@ function App() {
onThemeChange={setThemeId}
onSave={saveOnboarding}
onClose={() => setSetupOpen(false)}
initialLimits={userLimits}
/>
)}
<input
@@ -1753,9 +1755,12 @@ function SpendForecastCard({
const saveLowerLimit = () => {
if (!onSaveLimits) return;
const lowerDailyLimit = Math.round(stats.avgDailySpend * 0.8 * 100) / 100;
const size = userLimits.limitCanSizeMl ?? 250;
onSaveLimits({
...userLimits,
limitCanSizeMl: size,
dailySpendLimit: lowerDailyLimit,
dailyCanLimit: canLimitFromSpend(lowerDailyLimit, size),
});
};