add icons to lists and solve money tracker bugs
All checks were successful
Test and deploy staging / staging (push) Successful in 2m30s

This commit is contained in:
2026-09-24 19:24:09 +00:00
parent a10585a4d2
commit c757d0882a
18 changed files with 1358 additions and 731 deletions

View File

@@ -117,19 +117,24 @@ export const actions: Actions = {
const name = textField(form, 'name', 80);
const openingBalanceCents = cents(form.get('openingBalance'));
const kind = String(form.get('kind') ?? 'spendable');
const colorRaw = String(form.get('color') ?? '').trim();
const color = colorRaw ? colorRaw.toLowerCase() : null;
if (!name || openingBalanceCents == null || !['spendable', 'investment'].includes(kind))
return invalid('Enter an account name and a valid opening balance.');
if (color && !/^#[0-9a-f]{6}$/.test(color)) return invalid('Choose a valid account color.');
const id = recordId(form);
try {
if (id) {
const [row] = await db
.update(moneyAccounts)
.set({ name, openingBalanceCents, kind })
.set({ name, openingBalanceCents, kind, color })
.where(and(eq(moneyAccounts.id, id), eq(moneyAccounts.userId, user.id)))
.returning({ id: moneyAccounts.id });
if (!row) error(404, 'Account not found');
} else
await db.insert(moneyAccounts).values({ userId: user.id, name, openingBalanceCents, kind });
await db
.insert(moneyAccounts)
.values({ userId: user.id, name, openingBalanceCents, kind, color });
} catch (cause) {
if (typeof cause === 'object' && cause && 'code' in cause && cause.code === '23505')
return invalid('An account with that name already exists.');

File diff suppressed because it is too large Load Diff

View File

@@ -40,7 +40,6 @@
}
.money-app .button.secondary:hover,
.money-dialog .button.secondary:hover,
.money-app .tabs button:hover,
.money-app .subtabs button:hover {
background: var(--site-hover);
}
@@ -55,8 +54,7 @@
align-items: end;
justify-content: space-between;
gap: 24px;
border-bottom: 1px solid var(--site-border);
padding-bottom: 30px;
margin-bottom: 20px;
}
.money-app h1 {
margin: 2px 0 8px;
@@ -70,84 +68,43 @@
flex-wrap: wrap;
gap: 8px;
}
.money-app .tabs {
display: flex;
gap: 2px;
overflow-x: auto;
border-bottom: 1px solid var(--site-border);
margin-bottom: 32px;
}
.money-app .tabs button {
border-bottom: 2px solid transparent;
color: var(--site-muted);
white-space: nowrap;
padding: 14px 16px 12px;
font-size: 13px;
}
.money-app .tabs button.current {
color: var(--site-text);
border-color: var(--site-text);
font-weight: 600;
}
.money-app .overview-grid {
display: grid;
grid-template-columns: minmax(0, 1.6fr) minmax(250px, 0.8fr);
border: 1px solid var(--site-border);
border-radius: 10px;
overflow: hidden;
margin-bottom: 28px;
}
.money-app .net-worth {
padding: 32px;
min-width: 0;
}
.money-app .net-value {
font-size: clamp(2.5rem, 6vw, 4rem);
line-height: 1.2;
font-weight: 600;
letter-spacing: -0.055em;
overflow-wrap: anywhere;
margin: 8px 0;
}
.money-app .overview-side {
border-left: 1px solid var(--site-border);
display: grid;
grid-template-rows: 1fr 1fr;
}
.money-app .overview-side > div {
padding: 22px 26px;
}
.money-app .overview-side > div + div {
border-top: 1px solid var(--site-border);
}
.money-app .side-value {
font-size: 1.5rem;
font-weight: 600;
letter-spacing: -0.04em;
margin-top: 7px;
}
.money-app .projection-note {
margin-top: 14px;
line-height: 1.5;
}
.money-app .projection-totals {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
margin-top: 18px;
}
.money-app .projection-totals > div {
display: grid;
gap: 4px;
padding: 12px 14px;
border: 1px solid var(--site-border);
border-radius: 7px;
}
.money-app .projection-totals strong {
font-size: 16px;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.money-app .wish-tier-grid {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
border: 1px solid var(--site-border);
border-radius: 8px;
overflow: hidden;
grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
gap: 6px;
}
.money-app .wish-tier-grid > div {
display: grid;
gap: 5px;
padding: 15px;
gap: 3px;
padding: 9px 11px;
min-width: 0;
}
.money-app .wish-tier-grid > div + div {
border-left: 1px solid var(--site-border);
border: 1px solid var(--site-border);
border-radius: 7px;
}
.money-app .wish-tier-grid strong {
font-size: 17px;
font-size: 14px;
font-weight: 600;
overflow-wrap: anywhere;
}
@@ -167,21 +124,20 @@
font-size: 13px;
}
.money-app .panel {
margin-bottom: 28px;
border: 1px solid var(--site-border);
border-radius: 10px;
padding: 24px;
padding: 20px;
min-width: 0;
}
.money-app .panel-heading {
display: flex;
align-items: start;
justify-content: space-between;
gap: 20px;
margin-bottom: 22px;
gap: 16px;
margin-bottom: 16px;
}
.money-app .panel-heading h2 {
font-size: 20px;
font-size: 17px;
font-weight: 600;
letter-spacing: -0.035em;
}
@@ -196,32 +152,12 @@
text-underline-offset: 3px;
white-space: nowrap;
}
.money-app .two-columns {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 28px;
}
.money-app .summary-list li {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
border-top: 1px solid var(--site-border);
padding: 12px 0;
font-size: 13px;
}
.money-app .summary-list strong {
font-weight: 500;
}
.money-app .summary-list small {
display: block;
color: var(--site-muted);
font-size: 11px;
margin-top: 2px;
}
.money-app .negative {
color: #e5484d;
}
.money-app .positive {
color: #46a758;
}
.money-app .empty {
color: var(--site-muted);
font-size: 13px;
@@ -262,12 +198,12 @@
text-align: left;
font-weight: 500;
border-bottom: 1px solid var(--site-border);
padding: 10px 12px;
padding: 8px 10px;
white-space: nowrap;
}
.money-app td {
border-bottom: 1px solid var(--site-border);
padding: 11px 12px;
padding: 8px 10px;
vertical-align: top;
}
.money-app tbody tr:hover {
@@ -314,35 +250,11 @@
display: flex;
gap: 8px;
}
.money-app .planning-intro {
display: flex;
align-items: end;
justify-content: space-between;
gap: 32px;
border-bottom: 1px solid var(--site-border);
padding: 8px 0 30px;
margin-bottom: 28px;
}
.money-app .planning-intro > p {
max-width: 370px;
}
.money-app .large-value {
font-size: clamp(1.6rem, 4vw, 2.5rem);
font-weight: 600;
letter-spacing: -0.05em;
margin: 6px 0;
}
.money-app .large-value span {
font-size: 16px;
color: var(--site-muted);
font-weight: 400;
letter-spacing: 0;
}
.money-app .subtabs {
display: flex;
gap: 6px;
flex-wrap: wrap;
margin-bottom: 24px;
margin-bottom: 16px;
}
.money-app .subtabs button {
border: 1px solid var(--site-border);
@@ -356,20 +268,223 @@
color: var(--site-bg);
border-color: var(--site-text);
}
.money-app .utility-top {
.money-app .stat-strip {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
padding-bottom: 16px;
}
.money-app .utility-note {
grid-template-columns: repeat(6, minmax(0, 1fr));
border: 1px solid var(--site-border);
border-radius: 10px;
overflow: hidden;
margin-bottom: 16px;
}
.money-app .utility-actions {
.money-app .stat {
padding: 16px 18px;
min-width: 0;
}
.money-app .stat + .stat {
border-left: 1px solid var(--site-border);
}
.money-app .stat-value {
margin-top: 4px;
font-size: 1.35rem;
font-weight: 600;
letter-spacing: -0.04em;
font-variant-numeric: tabular-nums;
overflow-wrap: anywhere;
}
.money-app .stat.net .stat-value {
font-size: 1.75rem;
}
.money-app .dashboard {
display: grid;
grid-template-columns: repeat(12, minmax(0, 1fr));
gap: 16px;
align-items: start;
}
.money-app .span-8 {
grid-column: span 8;
}
.money-app .span-4 {
grid-column: span 4;
}
.money-app .stack {
display: grid;
gap: 16px;
min-width: 0;
}
.money-app .swatch {
display: inline-block;
flex: none;
width: 10px;
height: 10px;
border-radius: 50%;
box-shadow: 0 0 0 1px var(--site-border);
}
.money-app .account-cell {
display: inline-flex;
align-items: center;
gap: 7px;
}
.money-app .nowrap {
white-space: nowrap;
}
.money-app tr.future {
color: var(--site-muted);
}
.money-app .chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 12px;
}
.money-app .chips button {
display: inline-flex;
align-items: center;
gap: 7px;
border: 1px solid var(--site-border);
border-radius: 999px;
padding: 5px 11px;
color: var(--site-muted);
font-size: 12px;
}
.money-app .chips button:hover {
background: var(--site-hover);
}
.money-app .chips button.current {
color: var(--site-text);
border-color: var(--site-text);
background: var(--site-surface);
}
.money-app .item-list li {
display: flex;
align-items: center;
gap: 10px;
border-top: 1px solid var(--site-border);
padding: 8px 0;
font-size: 13px;
}
.money-app .item-list.scroll {
max-height: 360px;
overflow-y: auto;
}
.money-app .item-list li.selected {
background: var(--site-surface);
box-shadow: inset 2px 0 0 var(--site-text);
}
.money-app .item-main {
display: flex;
align-items: center;
gap: 9px;
flex: 1;
min-width: 0;
text-align: left;
padding-left: 4px;
}
.money-app .item-main > span:last-child {
min-width: 0;
}
.money-app .item-main strong {
display: block;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.money-app .item-main small {
display: block;
color: var(--site-muted);
font-size: 11px;
margin-top: 1px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.money-app .item-amount {
font-weight: 500;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.money-app .item-list .actions button {
width: 26px;
height: 26px;
}
.money-app .tier {
display: inline-flex;
align-items: center;
justify-content: center;
flex: none;
width: 20px;
height: 20px;
border: 1px solid var(--site-border);
border-radius: 5px;
color: var(--site-muted);
font-size: 11px;
}
.money-app .mini-stats {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
padding-top: 16px;
margin-bottom: 12px;
}
.money-app .mini-stats > div {
display: grid;
gap: 3px;
min-width: 0;
}
.money-app .mini-stats strong {
font-size: 15px;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.money-app .mini-stats small {
color: var(--site-muted);
font-weight: 400;
}
.money-app .utility-settings {
display: block;
margin: 10px 0 6px;
}
.money-app .utility-note {
margin-top: 12px;
font-size: 12px;
}
@media (max-width: 1180px) {
.money-app .span-8,
.money-app .span-4 {
grid-column: span 12;
}
.money-app .dashboard > .span-4:nth-last-child(-n + 3) {
grid-column: span 6;
}
.money-app .dashboard > .span-4:last-child {
grid-column: span 12;
}
.money-app .stat-strip {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.money-app .stat:nth-child(4) {
border-left: 0;
}
.money-app .stat:nth-child(n + 4) {
border-top: 1px solid var(--site-border);
}
}
@media (max-width: 760px) {
.money-app .dashboard > .span-4:nth-last-child(-n + 3) {
grid-column: span 12;
}
.money-app .stat-strip {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.money-app .stat.net {
grid-column: span 2;
}
.money-app .stat + .stat {
border-left: 0;
border-top: 1px solid var(--site-border);
}
.money-app .stat:nth-child(odd):not(.net) {
border-left: 1px solid var(--site-border);
}
}
.money-dialog {
width: min(440px, calc(100% - 28px));
@@ -452,49 +567,13 @@
color: #e5484d;
font-size: 13px;
}
@media (max-width: 760px) {
.money-app .overview-grid,
.money-app .two-columns {
grid-template-columns: 1fr;
}
.money-app .overview-side {
border-left: 0;
border-top: 1px solid var(--site-border);
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
}
.money-app .overview-side > div + div {
border-top: 0;
border-left: 1px solid var(--site-border);
}
.money-app .utility-top {
grid-template-columns: 1fr;
gap: 8px;
}
.money-app .wish-tier-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.money-app .wish-tier-grid > div {
border-left: 0 !important;
border-top: 1px solid var(--site-border);
}
.money-app .planning-intro {
display: block;
}
.money-app .planning-intro > p {
margin-top: 16px;
}
}
@media (max-width: 520px) {
.money-app .projection-totals {
grid-template-columns: 1fr;
}
.money-app .panel {
padding: 16px;
}
.money-app .net-worth {
padding: 22px;
}
.money-app .overview-side > div {
padding: 16px;
}
.money-app .filters {
flex-direction: column;
}