From f3a603648eae951b0d20617a977643bb91f1496e Mon Sep 17 00:00:00 2001 From: h Date: Fri, 16 Oct 2026 04:14:51 +0000 Subject: [PATCH] fix(budgets,tags,piggy-banks,dashboard): live buttons that answer in place, lucide icons, mobile wrapping --- src/lib/components/accounts/Reconcile.svelte | 23 ++++++-- src/lib/components/dashboard/InfoBoxes.svelte | 18 +++--- .../components/piggy-banks/MoneyEditor.svelte | 9 ++- .../subscriptions/PaidStatus.svelte | 5 +- .../[[start=date]]/[[end=date]]/+page.svelte | 59 +++++++++++++------ src/routes/categories/+page.svelte | 12 ++-- src/routes/piggy-banks/+page.svelte | 24 +------- .../piggy-banks/show/[id=id]/+page.svelte | 1 - src/routes/settings/links/LinkTypeForm.svelte | 10 ++-- src/routes/tags/+page.svelte | 12 ++-- 10 files changed, 102 insertions(+), 71 deletions(-) diff --git a/src/lib/components/accounts/Reconcile.svelte b/src/lib/components/accounts/Reconcile.svelte index eafed91..fd3d264 100644 --- a/src/lib/components/accounts/Reconcile.svelte +++ b/src/lib/components/accounts/Reconcile.svelte @@ -56,6 +56,7 @@ let busy = $state(false); let status = $state(""); let failure = $state(""); + let pressed = $state(false); const account = createQuery(() => ({ queryFn: () => api>(`/v1/accounts/${id}`), @@ -179,6 +180,17 @@ const canCorrect = $derived(Boolean(reconciliationId)); const correcting = $derived(correct && canCorrect && difference !== 0); const ready = $derived(before.isSuccess && after.isSuccess && list.isSuccess); + const hint = $derived.by(() => { + if (!pressed) { + return ""; + } + if (!ready) { + return "Balances are still loading"; + } + return selected.length === 0 && !correcting + ? "Tick the transactions to clear first" + : ""; + }); function setDates(nextStart: string, nextEnd: string) { if (!(nextStart && nextEnd) || nextStart > nextEnd) { @@ -241,7 +253,8 @@ } async function store() { - if (busy || !ready || (selected.length === 0 && !correcting)) { + pressed = true; + if (busy || hint) { return; } busy = true; @@ -525,10 +538,7 @@ {/if}
- @@ -536,6 +546,9 @@ {key} {/each} + {#if hint} + {hint} + {/if}
{#if status}

{status}

diff --git a/src/lib/components/dashboard/InfoBoxes.svelte b/src/lib/components/dashboard/InfoBoxes.svelte index 4b2f796..a64edd9 100644 --- a/src/lib/components/dashboard/InfoBoxes.svelte +++ b/src/lib/components/dashboard/InfoBoxes.svelte @@ -114,7 +114,7 @@ {:else}
{fmt(list[0], abs)}
@@ -142,7 +142,7 @@ {:else} {/if} - {delta.text} than {prevName} @@ -203,18 +203,20 @@ segments={[{ color: "var(--ff-series-3)", value: paidShare.paid }]} /> {/if} -
- Paid: - {paid.length ? paid.map((e) => fmt(e, true)).join(", ") : "0"} +
+ Paid: + {#each paid as e (e.code)} + {fmt(e, true)} + {:else} + 0 + {/each}
{/snippet} {#snippet leftToSpend()} {@render values(left)} {#if left[0]?.sub} -
+
{leftState === "none" ? "" : "Per day: "}{left[0].sub} diff --git a/src/lib/components/piggy-banks/MoneyEditor.svelte b/src/lib/components/piggy-banks/MoneyEditor.svelte index 158fde8..58dbf67 100644 --- a/src/lib/components/piggy-banks/MoneyEditor.svelte +++ b/src/lib/components/piggy-banks/MoneyEditor.svelte @@ -30,6 +30,7 @@ const action = new Action(); const values = $state>({}); + const fields: Record = {}; const links = $derived( (piggy.attributes.accounts ?? []).map((link) => { @@ -50,9 +51,10 @@ } } - function fail(message: string) { + function fail(message: string, id = open[0]?.id ?? "") { action.failed = true; action.message = message; + fields[id]?.focus(); } async function save() { @@ -64,11 +66,11 @@ } const amount = evalAmount(raw); if (amount === null || amount <= 0) { - return fail("Enter an amount above zero"); + return fail("Enter an amount above zero", link.id); } if (amount > link.max + 1e-9) { const max = formatMoney(piggyMoney(piggy.attributes, link.max)); - return fail(`${link.name} allows at most ${max}`); + return fail(`${link.name} allows at most ${max}`, link.id); } deltas[link.id] = mode === "add" ? amount : -amount; } @@ -109,6 +111,7 @@ onkeydown={onEscape} bind:value={values[link.id]} {@attach (node) => { + fields[link.id] = node; if (i === 0) { node.focus(); } diff --git a/src/lib/components/subscriptions/PaidStatus.svelte b/src/lib/components/subscriptions/PaidStatus.svelte index 70f51d2..91469ab 100644 --- a/src/lib/components/subscriptions/PaidStatus.svelte +++ b/src/lib/components/subscriptions/PaidStatus.svelte @@ -1,4 +1,5 @@