Skip to content
Open
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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

---

## [1.16.12] — 2026-11-02

### Accounts — clearing a name brings the default back
- **The bug:** clearing a name you gave an account in Settings → Accounts removed it from `State.accountLabels`, but the old name kept showing. FinLens had also copied the typed name into the account's own `name` when you renamed it, imported its CSV, reloaded or imported a JSON export (`setAccountName()`, `wireAccountRename()`, `importParsedCsv()`, `DB.loadAll()`, `_applyImportedSettings()`), and `acctName()` fell back to that copy. On the Overview, an empty name kept the old one.
- **An account's `name` is now always its default:** `Bank Checking`, `Bank Savings`, `Bank Credit Card (<file>)`, or the file name for other CSVs. A name you type lives only in `State.accountLabels`. Importing a CSV writes the default back to the browser database. A JSON import no longer copies the imported names into the accounts (the copy loop in `_applyImportedSettings()`, v1.16.6, is gone): `acctName()` shows them from `State.accountLabels`.
- **`acctName()`** shows the name you typed, else the default, which `defaultAccountName()` (core.js) works out from the account's kind and file. So data saved by older versions, where `name` can still hold a cleared name, shows the default too.
- **Both places that rename go through `setAccountName()`:** Settings → Accounts and the Overview cards (double-click, or Enter). An empty name, or the default name itself, removes the label. On the Overview, a name left as it was saves nothing; before, it was saved as a label. Settings says "Using the default name …" when the label goes.
- **Every place that shows a name uses `acctName()`:** the accounts filter and its tooltip, the import log, the Last import card and the account list in the AI summary (`buildFinancialSummary()`). For accounts with no typed name the summary is unchanged, so the AI eval's requests are byte-identical. With a typed name it shows that name, as before.

---

## [1.16.11] — 2026-11-02

### AI Analysis
Expand Down
14 changes: 9 additions & 5 deletions CLAUDE.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> A zero-install, browser-native finance dashboard. Drop in your bank CSVs, get instant clarity on your money.

**Version:** v1.16.11 &nbsp;·&nbsp; **Stack:** Vanilla JS, HTML, CSS &nbsp;·&nbsp; **Install:** None
**Version:** v1.16.12 &nbsp;·&nbsp; **Stack:** Vanilla JS, HTML, CSS &nbsp;·&nbsp; **Install:** None

---

Expand Down Expand Up @@ -104,7 +104,7 @@ FinLens stores all your data — budgets, bills, transaction edits, settings, AI
## Features In Depth

### Overview
Net worth with a trend chart (1M, 3M or all of your history) and the change since the end of last month. The latest month's money in, money out, net and savings rate, next to your 6-month average. A card per account with a balance sparkline (or, for a credit card, how much of the limit you're using). Six months of cash flow with the net for each month, bills due in the next three weeks, and the largest card purchases of the latest month. Double-click an account name to rename it.
Net worth with a trend chart (1M, 3M or all of your history) and the change since the end of last month. The latest month's money in, money out, net and savings rate, next to your 6-month average. A card per account with a balance sparkline (or, for a credit card, how much of the limit you're using). Six months of cash flow with the net for each month, bills due in the next three weeks, and the largest card purchases of the latest month. Double-click an account name to rename it; clear the name to go back to the default.

### Transactions
Filter pills across the top: **All**, **Income**, **Spending**, **Bills**, **Payments** and **Transfers**. All and Payments filter the list; the other four open their own screens. The list has search, a category filter, sorting, an amount filter, bulk edits and 50 rows per page. Click a transaction to edit its description, categories, type, notes and flags (Bill, Recurring, Subscription). Edits are kept separately from the imported row, so re-importing never overwrites them. **Transaction rules** flag matching transactions automatically (e.g. "NETFLIX → Subscription"). A flag you tick or untick yourself wins over the rules; one you leave alone keeps following them. **Payments** lists the payments made to your credit cards.
Expand Down Expand Up @@ -261,4 +261,4 @@ See [CHANGELOG.md](CHANGELOG.md) for the full release history.

---

*FinLens v1.16.11 — Built for one person's finances, designed to be useful for anyone's.*
*FinLens v1.16.12 — Built for one person's finances, designed to be useful for anyone's.*
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@
<div class="folder-banner-wrap" id="folderBanner" hidden></div>
<div class="content" id="content"></div>
</main>
<footer class="appfoot">v1.16.11 · FinLens</footer>
<footer class="appfoot">v1.16.12 · FinLens</footer>

<!-- side drawer: transaction detail, bill and plan forms (ui.js openDrawer) -->
<div class="drawer-scrim" id="drawerScrim" onclick="closeDrawer()" hidden></div>
Expand Down
37 changes: 24 additions & 13 deletions js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const State = {
csvAutoImportPaused: lsGet('csvAutoImportPaused', false),
fileAssignments: lsGet('fileAssignments', {}), // filename -> kind
accountOrder: lsGet('accountOrder', []), // [accountId, ...] display order
accountLabels: lsGet('accountLabels', {}), // accountId -> custom display name (overrides account.name everywhere)
accountLabels: lsGet('accountLabels', {}), // accountId -> name you typed; acctName() shows it first. An empty name removes it (§18)
txRules: lsGet('txRules', []), // [{contains, flag:'bill'|'subscription'|'recurring'}] — auto-flag rules
transferKeywords: lsGet('transferKeywords', null) || ['transfer','zelle','ach','venmo','paypal','coinbase','savings booster'],
customSchemas: lsGet('customSchemas', []), // user-defined schema objects (same shape as BANK_SCHEMAS entries)
Expand Down Expand Up @@ -666,6 +666,19 @@ function mkTx(o) {
};
}

// The name FinLens gives an account (CLAUDE.md §18), from its kind and the CSV it came
// from: 'Bank Checking', 'Bank Savings', 'Bank Credit Card (<file>)', or the file name.
// A name you type is kept apart, in State.accountLabels; clearing it shows this one again.
// '' when the file name it needs isn't known.
function defaultAccountName(a) {
if (!a) return '';
const file = a.sourceFile || '';
if (a.kind === 'bank_checking') return 'Bank Checking';
if (a.kind === 'bank_savings') return 'Bank Savings';
if (a.kind === 'credit_card') return file ? 'Bank Credit Card (' + file.replace(/\.csv$/i,'') + ')' : '';
return file;
}

// Reads one CSV file and turns its rows into transactions. It changes nothing: no State,
// browser storage or IndexedDB writes (v1.16.2). loadFiles() reads every file this way
// first and imports (importParsedCsv()) only when at least one transaction was read.
Expand Down Expand Up @@ -713,19 +726,18 @@ function parseCsvFile(file, forcedKind) {

const kind = schema.id;

// Build accountId and display name (migrate.js maps the ids older versions used)
let accountId, accountName;
// Build accountId and default name (migrate.js maps the ids older versions used)
let accountId;
if (kind === 'credit_card') {
accountId = 'card_' + file.name.replace(/\.csv$/i,'').toLowerCase().replace(/[^a-z0-9]+/g,'_');
accountName = 'Bank Credit Card (' + file.name.replace(/\.csv$/i,'') + ')';
} else if (kind === 'bank_savings') {
accountId = 'bank_savings'; accountName = 'Bank Savings';
accountId = 'bank_savings';
} else if (kind === 'bank_checking') {
accountId = 'bank_checking'; accountName = 'Bank Checking';
accountId = 'bank_checking';
} else {
accountId = 'acct_' + file.name.replace(/\.csv$/i,'').replace(/[^a-z0-9]+/g,'_');
accountName = file.name;
}
const accountName = defaultAccountName({ kind, sourceFile: file.name });

// Normalize all rows. Truly identical rows (same hash inputs) are counted within
// this file: the 2nd copy gets an _2 suffix, the 3rd _3, and so on. Counting per
Expand Down Expand Up @@ -768,15 +780,14 @@ function parseCsvFile(file, forcedKind) {
// import carries on, so the transactions still reach memory and finlens-state.json.
async function importParsedCsv(p) {
const { file, schema, kind, accountId, accountName, txs } = p;
// Initialise account in State (in-memory)
// Initialise account in State (in-memory). Its name is always the default: a name
// you typed stays in State.accountLabels, and acctName() shows that first. (Older
// versions copied the typed name in here; this puts the default back.)
State.accounts[accountId] = State.accounts[accountId] || {
id: accountId, name: accountName, kind, balance: null, limit: null, sourceFile: file.name
};
State.accounts[accountId].sourceFile = file.name;
// Restore persisted custom label if any
if (State.accountLabels && State.accountLabels[accountId]) {
State.accounts[accountId].name = State.accountLabels[accountId];
}
State.accounts[accountId].name = accountName;

// Persist to IndexedDB (if DB is ready)
let importResult = null;
Expand Down Expand Up @@ -1108,7 +1119,7 @@ function buildAccountFilter() {
}
const all=State.selectedAccounts==='all';
list.innerHTML = accts.length
? accts.map(a=>`<label class="chk"><input type="checkbox" data-acct="${escapeAttr(a.id)}" ${all||State.selectedAccounts.includes(a.id)?'checked':''}><span>${escapeHtml(State.accountLabels?.[a.id]||a.name)}</span></label>`).join('')
? accts.map(a=>`<label class="chk"><input type="checkbox" data-acct="${escapeAttr(a.id)}" ${all||State.selectedAccounts.includes(a.id)?'checked':''}><span>${escapeHtml(acctName(a.id))}</span></label>`).join('')
: '<div class="muted" style="padding:6px 10px;font-size:13px">No accounts yet. Import CSVs in Settings → Import.</div>';
if (typeof updateAcctUI==='function') updateAcctUI();
}
Expand Down
7 changes: 2 additions & 5 deletions js/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,11 @@ const DB = {

// ── 2. Load accounts ──
const dbAccounts = await this.getAccounts();
// Merge DB accounts into State.accounts (preserving any in-memory ones)
// Merge DB accounts into State.accounts (preserving any in-memory ones). A name you
// typed stays in State.accountLabels: acctName() shows it, so it isn't copied in here.
for (const a of dbAccounts) {
const existing = State.accounts[a.id];
State.accounts[a.id] = { ...(existing || {}), ...a };
// Apply any persisted custom label
if (State.accountLabels && State.accountLabels[a.id]) {
State.accounts[a.id].name = State.accountLabels[a.id];
}
}

// ── 3. Load transactions + apply overrides ──
Expand Down
15 changes: 9 additions & 6 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function updateAcctUI() {
const all = State.selectedAccounts === 'all';
const names = all ? 'All accounts' : orderedAccounts()
.filter(a => State.selectedAccounts.includes(a.id))
.map(a => State.accountLabels?.[a.id] || a.name).join(', ');
.map(a => acctName(a.id)).join(', ');
const label = 'Accounts: ' + (names || 'All accounts');
const btn = $('#acctBtn'); if (btn) { btn.setAttribute('aria-label', label); btn.title = label; btn.classList.toggle('on', !all); }
const dot = $('#acctDot'); if (dot) dot.hidden = all;
Expand Down Expand Up @@ -228,10 +228,14 @@ function fmtShort(v) {
return s+'$'+Math.round(a);
}
const ordinal=(n)=>n+(n%10===1&&n!==11?'st':n%10===2&&n!==12?'nd':n%10===3&&n!==13?'rd':'th');
// Display name of an account (custom label first).
// Display name of an account: the name you typed (State.accountLabels), else its default
// name (defaultAccountName() in core.js). The default is worked out rather than read from
// account.name: older versions copied the typed name in there, so data they saved can
// still hold a name you've since cleared.
function acctName(id) {
if (!id) return 'Outside FinLens';
return State.accountLabels?.[id]||State.accounts[id]?.name||id;
const a=State.accounts[id];
return State.accountLabels?.[id]||defaultAccountName(a)||a?.name||id;
}

/* ---------- INLINE SVG CHARTS (v1.14.0) ---------- */
Expand Down Expand Up @@ -852,10 +856,9 @@ function importJsonFile(ev) {
// Imported settings take effect now, without a reload. Most keys only need the render
// that follows. Category rules apply to the next import (or Re-categorize all), "Read as"
// choices to the next CSV read, and transaction edits once the page reloads, as before.
// Imported account names need no copying: acctName() reads State.accountLabels, and an
// account's own name stays its default (v1.16.12).
function _applyImportedSettings(changed) {
if (changed.has('accountLabels')) {
for (const [id,name] of Object.entries(State.accountLabels)) if (State.accounts[id]&&name) State.accounts[id].name=name;
}
if (changed.has('accountLabels')||changed.has('accountOrder')) buildAccountFilter();
if (changed.has('txRules')) applyTxRulesToAll();
if (changed.has('transferKeywords')) reapplyTransferKeywords(); // views-main.js; re-runs transfer detection
Expand Down
2 changes: 1 addition & 1 deletion js/views-ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function buildFinancialSummary() {
const expense=sumExpense(txs);
const lines=[];
lines.push(`Period: ${describeRange()}${summarySpan(txs)}`);
lines.push(`Accounts${asOf?` at the end of the period (${asOfText})`:''}: ${Object.values(State.accounts).map(a=>`${a.name} (${fmt(balances[a.id])})`).join(', ')}`);
lines.push(`Accounts${asOf?` at the end of the period (${asOfText})`:''}: ${Object.values(State.accounts).map(a=>`${acctName(a.id)} (${fmt(balances[a.id])})`).join(', ')}`);
lines.push(`Total Cash: ${fmt(cash)}, Total Debt: ${fmt(debt)}, Net Worth: ${fmt(cash-debt)}${asOf?` (all on ${asOfText})`:''}`);
lines.push(`Period Income: ${fmt(income)}, Spending: ${fmt(expense)}, Savings Rate: ${pct(income>0?(income-expense)/income:0)}`);
lines.push(''); lines.push('Top spending categories:');
Expand Down
21 changes: 11 additions & 10 deletions js/views-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ registerView('import','Import',(root)=>{
appendHtml(root,`<section class="panel" aria-labelledby="resH">
<div class="panel-head"><h2 id="resH">Last import</h2>${State.lastRefresh?`<span class="aside">${escapeHtml(whenText(State.lastRefresh))}</span>`:''}</div>
<div class="rows">${_lastImportResults.map(r=>{
const ir=r.importResult;
const ir=r.importResult, nm=r.accountId&&State.accounts[r.accountId]?acctName(r.accountId):r.account;
if (r.problem) return `<div class="r"><div class="t">${escapeHtml(r.filename)}<span class="s2">Not imported: ${escapeHtml(r.problem)}</span></div></div>`;
if (!ir) return `<div class="r"><div class="t">${escapeHtml(r.account)}<span class="s2">${escapeHtml(r.filename)} · imported (the browser database wasn't ready, so no counts)</span></div></div>`;
if (!ir) return `<div class="r"><div class="t">${escapeHtml(nm)}<span class="s2">${escapeHtml(r.filename)} · imported (the browser database wasn't ready, so no counts)</span></div></div>`;
const cov=_coverageCache[r.accountId];
const next=ir.dateRangeMax?dayjs(ir.dateRangeMax).add(1,'day').format('MMM D, YYYY'):'—';
return `<div class="r wrap"><div class="t">${escapeHtml(r.account)}
return `<div class="r wrap"><div class="t">${escapeHtml(nm)}
<span class="s2">${escapeHtml(r.filename)} · covers ${fmtD(ir.dateRangeMin)} – ${fmtD(ir.dateRangeMax)}${cov?` · ${cov.count.toLocaleString()} in FinLens`:''} · start the next export on ${next}</span></div>
<span class="d"><b class="c-good">${ir.inserted.toLocaleString()} new</b> · ${ir.skipped.toLocaleString()} already imported${ir.removed?` · <b class="c-warn">${ir.removed.toLocaleString()} leftover duplicate cop${ir.removed!==1?'ies':'y'} removed</b>`:''}</span>
${ir.gapWarning?callout('warn',`No data for <strong>${fmtD(ir.gapWarning.from)}</strong> – <strong>${fmtD(ir.gapWarning.to)}</strong>. Import a file that covers those dates to fill the gap.`):''}</div>`;
Expand Down Expand Up @@ -249,7 +249,7 @@ function renderImportLog(container) {
const fmtD=d=>d?dayjs(d).format('MMM D, YYYY'):'—';
const rows=_importLogCache.map(e=>{
const acct=State.accounts[e.accountId];
const name=acct?(State.accountLabels?.[e.accountId]||acct.name):e.accountId;
const name=acct?acctName(e.accountId):e.accountId;
return `<tr>
<td class="muted" style="font-size:11.5px">${dayjs(e.timestamp).format('MMM D h:mm A')}</td>
<td>${escapeHtml(e.filename||'')}</td>
Expand Down Expand Up @@ -286,14 +286,15 @@ function moveAccount(accountId, direction) {
}

/* ---- Account and card fields (Settings → Accounts, Credit cards): saved as you leave each one ---- */
// The name you type is kept in State.accountLabels, which wins over the CSV's default
// name everywhere (as renaming on the Overview does). An empty name goes back to it.
// The name you type is kept in State.accountLabels, which wins over the account's default
// name everywhere (acctName()). Renaming on the Overview saves through here too. An empty
// name, or the default name itself, removes the label, so the default shows again. The
// account's own name isn't changed: it stays the default (defaultAccountName()).
function setAccountName(id, raw) {
const a=State.accounts[id]; if (!a) return '';
const name=String(raw||'').trim();
if (!State.accountLabels) State.accountLabels={};
if (name) State.accountLabels[id]=name; else delete State.accountLabels[id];
a.name=name||a.name;
if (name&&name!==defaultAccountName(a)) State.accountLabels[id]=name; else delete State.accountLabels[id];
lsSet('accountLabels',State.accountLabels);
buildAccountFilter();
return acctName(id);
Expand Down Expand Up @@ -735,9 +736,9 @@ registerView('accounts','Accounts',(root)=>{
(same&&!same.disabled?same:other)?.focus();
});
$$('[data-acct-name]',root).forEach(inp=>inp.addEventListener('change',()=>{
const shown=setAccountName(inp.dataset.acctName, inp.value);
const id=inp.dataset.acctName, shown=setAccountName(id, inp.value);
inp.value=shown;
say('good',`Saved the name “${shown}”.`);
say('good',State.accountLabels[id]?`Saved the name “${shown}”.`:`Using the default name “${shown}”.`);
}));
$$('[data-acct-money]',root).forEach(inp=>inp.addEventListener('change',()=>{
if (!setAccountMoney(inp.dataset.acctMoney, inp.dataset.field, inp.value)) {
Expand Down
11 changes: 4 additions & 7 deletions js/views-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ function accountCardShell(a,name,sub,tile,balHtml,middle,foot) {
</div>`;
}
// Double-click an account name (or focus it and press Enter) to rename it. The name is
// saved in State.accountLabels and used everywhere.
// saved in State.accountLabels and used everywhere (setAccountName() in views-data.js, as
// Settings → Accounts does): an empty name brings the default name back, and a name left
// as it was saves nothing.
function wireAccountRename(scope) {
$$('.acct-name',scope).forEach(el=>{
const start=()=>{
Expand All @@ -399,12 +401,7 @@ function wireAccountRename(scope) {
let done=false;
const save=()=>{
if (done) return; done=true;
const newName=inp.value.trim()||cur;
if (!State.accountLabels) State.accountLabels={};
State.accountLabels[id]=newName;
if (State.accounts[id]) State.accounts[id].name=newName;
lsSet('accountLabels',State.accountLabels);
buildAccountFilter();
if (inp.value.trim()!==cur) setAccountName(id,inp.value);
renderActive();
};
inp.addEventListener('blur',save);
Expand Down
2 changes: 1 addition & 1 deletion js/views-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function _renderGeneralSettings(root) {
/* ---- About (the Theme row is gone: light only for now) ---- */
appendHtml(root,`<section class="panel" aria-labelledby="dispH">
<h2 id="dispH">About</h2>
<div class="set-row"><span class="t">Version</span><span class="v">FinLens v1.16.11</span></div>
<div class="set-row"><span class="t">Version</span><span class="v">FinLens v1.16.12</span></div>
</section>`);

/* ---- Anthropic API key ---- */
Expand Down