Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2026-11-10 — Minimum monthly budget

- Overview now shows Minimum needed: essential recurring bills at the profile’s share plus active debt instalments, excluding one-off spending.
- Bills support an editable essential flag, included by default, with effective-month and paid-history preservation. Annual bills are provisioned monthly.

## 2026-11-10 — Independent shared-bill confirmations

- Restored the configured bill payer as the common default in both profiles. Existing saved payers and provider-payment history stay intact.
Expand Down
6 changes: 6 additions & 0 deletions docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ Bill paid by uses the configured bill payer (the bill owner when none is set) in
The Bill: Paid button records payment to the provider. Each person also has an independent half-payment confirmation under the bill name. From your profile, click your named button to confirm or undo your own half; switch profiles to confirm the other person’s half. One person’s confirmation never completes the other’s. Existing bills start with no personal confirmations; the app does not infer them from the provider’s paid status. Confirmations are saved per month and sync across both views.

For a bill already paid to the provider, the non-payer’s confirmation records reimbursement and removes that bill from the amount owed. Undoing it restores the reimbursement due. Personal confirmations do not change the original bill-paid status, amounts or budget. Use All halves / My half pending / My half paid to find your unfinished payments. The bulk bill-paid action only marks payments to providers, not either person’s half.

### Minimum needed

Overview shows Minimum needed for the selected month: your share of essential recurring bills plus active monthly debt instalments. Shared bills count at your 50% share, personal bills count fully, and annual bills are spread over 12 months. One-off spending is excluded. New accounts start at zero.

Existing bills are included by default as a conservative starting point. Edit a bill and uncheck Essential to exclude optional costs from this figure; it remains in Bills & living and the normal budget. Essential labels appear on recurring/shared bill rows. The flag belongs to the shared bill, so changing it applies to both profiles from the selected month forward, while paid history keeps its saved terms. This is a planning total based on your records, not an estimate of food or other costs you have not entered.
5 changes: 5 additions & 0 deletions src/BillsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ export default function BillsPanel({
: ''}{' '}
· due {+billDueDate(b, month, profile).slice(-2)}
</span>
<span className="essential-label">
{b.essential === false
? 'Optional · excluded from minimum'
: 'Essential · included in minimum'}
</span>
<span className="split-label">
{b.shared
? `50/50 with ${state.profiles.find((p) => p.id === partner)?.name || 'partner'}`
Expand Down
21 changes: 20 additions & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ function App() {
)}
{page === 'Overview' && (
<>
<div className="stats-grid">
<div className="stats-grid overview-stats">
<Stat
title="Monthly income"
value={t.income}
Expand Down Expand Up @@ -923,6 +923,15 @@ function App() {
onClick={() => setPage('Debts & goals')}
actionLabel="Manage debts"
/>
<Stat
title="Minimum needed"
value={t.minimum}
icon={ShieldCheck}
color="orange"
note={`${money(t.essentialBills)} zł essential bills + ${money(t.debt)} zł debt instalments`}
onClick={() => setPage('Recurring bills')}
actionLabel="Choose essential bills"
/>
<Stat
title="Left to live & save"
value={t.remaining}
Expand Down Expand Up @@ -1911,6 +1920,7 @@ function App() {
Object.assign(record, {
amount: +data.amount,
day: +data.day,
essential: data.essential === 'on',
shared: data.shared === 'on',
paid: r?.paid || {},
owner: r?.owner || pid,
Expand Down Expand Up @@ -2222,6 +2232,15 @@ function Editor({ modal, person, profiles, debts, month, busy, onSave, onDelete
))}
</select>
</label>
<label className="checkbox">
<input type="checkbox" name="essential" defaultChecked={r.essential !== false} />
Essential · include in minimum needed
</label>
<p className="field-help">
Minimum needed includes your share of essential bills and active debt instalments. Mark
optional expenses unchecked. One-off spending is excluded; annual bills are spread over
12 months.
</p>
<label className="checkbox">
<input
type="checkbox"
Expand Down
12 changes: 12 additions & 0 deletions src/model.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ export function totals(state, profile, month) {
0,
),
);
const essentialBills = roundMoney(
bills
.filter((b) => b.essential !== false)
.reduce(
(sum, b) => sum + billShare(state, b, profile) / (b.frequency === 'Yearly' ? 12 : 1),
0,
),
);
const debts = state.debts.filter((d) => d.owner === profile);
const debt = roundMoney(debts.reduce((sum, d) => sum + (d.balance > 0 ? d.monthly : 0), 0));
const income = incomeForMonth(
Expand All @@ -208,6 +216,8 @@ export function totals(state, profile, month) {
return {
income,
living,
essentialBills,
minimum: roundMoney(essentialBills + debt),
debt,
expenses,
remaining: roundMoney(income - living - debt - expenses),
Expand Down Expand Up @@ -380,6 +390,7 @@ export function validState(state) {
Number.isInteger(b.day) &&
b.day >= 1 &&
b.day <= 31 &&
(b.essential === undefined || typeof b.essential === 'boolean') &&
(b.dueDays === undefined ||
(obj(b.dueDays) &&
Object.entries(b.dueDays).every(
Expand Down Expand Up @@ -717,6 +728,7 @@ export function setMonthlyIncome(profile, month, value) {
const termKeys = [
'name',
'amount',
'essential',
'day',
'dueDays',
'shared',
Expand Down
18 changes: 18 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3566,3 +3566,21 @@ nav em {
.share-confirmation b {
font-size: 10px;
}

@media (min-width: 1201px) {
.stats-grid.overview-stats {
grid-template-columns: repeat(5, minmax(0, 1fr));
}
}
@media (max-width: 1200px) {
.stats-grid.overview-stats {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.overview-stats > .stat:last-child {
grid-column: 1/-1;
}
}
.payment-name > .essential-label {
color: var(--text-muted);
font-size: 11px;
}
62 changes: 62 additions & 0 deletions tests/minimum-budget.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
seed,
emptyState,
totals,
validState,
editBillForMonth,
setBillPaid,
} from '../src/model.mjs';

test('minimum includes half of shared essentials, full personal essentials and active debt payments', () => {
const s = seed(),
t = totals(s, 'alex', '2026-11');
assert.equal(t.essentialBills, t.living);
assert.equal(t.minimum, t.living + t.debt);
s.expenses.push({
id: 'one-off',
name: 'Extra purchase',
owner: 'alex',
month: '2026-11',
amount: 999,
category: 'Life',
});
assert.equal(totals(s, 'alex', '2026-11').minimum, t.minimum);
s.debts[0].balance = 0;
assert.equal(totals(s, 'alex', '2026-11').minimum, t.minimum - s.debts[0].monthly);
const partner = totals(s, 'sam', '2026-11');
assert.equal(partner.minimum, partner.living);
});
test('optional bills remain in the budget but leave minimum, with annual costs provisioned monthly', () => {
const s = seed(),
bill = s.bills.find((b) => b.shared);
s.bills = [bill];
s.debts = [];
bill.amount = 1200;
bill.frequency = 'Yearly';
bill.dueMonth = 1;
assert.equal(totals(s, 'alex', '2026-11').minimum, 50);
bill.essential = false;
assert.equal(totals(s, 'alex', '2026-11').minimum, 0);
assert.equal(totals(s, 'alex', '2026-11').living, 50);
assert.ok(validState(s));
});
test('essential flags respect effective months and paid history; new accounts start at zero', () => {
const s = seed(),
bill = s.bills.find((b) => b.shared);
s.bills = [bill];
s.debts = [];
bill.amount = 100;
bill.paid = {};
setBillPaid(s, bill.id, '2026-10', true);
editBillForMonth(s, bill.id, { ...bill, essential: false }, '2026-11');
assert.equal(totals(s, 'alex', '2026-10').minimum, 50);
assert.equal(totals(s, 'alex', '2026-11').minimum, 0);
assert.equal(totals(s, 'alex', '2026-12').minimum, 0);
assert.ok(validState(s));
bill.essential = 'false';
assert.equal(validState(s), false);
const empty = emptyState('New');
assert.equal(totals(empty, empty.profiles[0].id, '2026-11').minimum, 0);
});
Loading