From 769b76857aac58081d150ff435457ff57499a232 Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 6 Nov 2026 19:55:42 +0000 Subject: [PATCH 1/7] Neutral dark, black and light themes with a modern look Replace the green-tinted palette with neutral near-black (Dark), true black (Black, new, opt-in) and light grey (Light); green is the accent only. System (default) follows the OS between Dark and Light. All text colours keep >= 4.5:1 contrast on every surface. Stylesheet-only restyle to match the approved mock: hairline card borders (--line, separate from control --border), 20px corners, pill buttons and segmented controls, round icon buttons and FAB, floating pill tab bar. Browser theme-color follows the effective theme. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x --- SPEC.md | 31 ++++-- apps/web/index.html | 2 +- apps/web/public/manifest.webmanifest | 4 +- apps/web/src/app.css | 123 ++++++++++++--------- apps/web/src/components/AppSettings.svelte | 1 + apps/web/src/lib/locales/cs.ts | 1 + apps/web/src/lib/locales/en.ts | 1 + apps/web/src/lib/settings.svelte.ts | 13 ++- 8 files changed, 103 insertions(+), 73 deletions(-) diff --git a/SPEC.md b/SPEC.md index e476394..9c41991 100644 --- a/SPEC.md +++ b/SPEC.md @@ -454,19 +454,26 @@ which group ids exist. ### 10.4 Theme -Dark and light, following the system setting by default with a manual -override. Starting palette (to be validated for WCAG AA contrast): +Three themes, chosen per device in app settings: **System** (default: +follows the OS between soft dark and light), **Dark** (soft near-black), +**Black** (true black, for OLED screens) and **Light**. Neutral backgrounds; +green is the accent only. Tokens live in `apps/web/src/app.css`: -| Token | Dark | Light | -|---|---|---| -| background | `#0B2E22` | `#F2F7F4` | -| surface | `#123D2E` | `#FFFFFF` | -| surface-raised | `#1A4D3A` | `#E4EFE9` | -| text | `#E8F3EC` | `#0B2E22` | -| text-muted | `#9FBFAE` | `#4A6B5B` | -| accent / you are owed | `#3DDC97` | `#16865A` | -| you owe | `#F2A65A` | `#B5541C` | -| highlight (sparingly) | `#D4AF37` | `#9A7B12` | +| Token | Dark | Black | Light | +|---|---|---|---| +| background | `#0A0B0D` | `#000000` | `#F2F3F5` | +| surface | `#16181C` | `#121316` | `#FFFFFF` | +| surface-raised | `#1F2227` | `#1B1D21` | `#E9EBEE` | +| text | `#F5F6F7` | same as Dark | `#0D0F12` | +| text-muted | `#8B9099` | same as Dark | `#5F6670` | +| accent / you are owed | `#3DDC97` | same as Dark | `#0B7549` | +| you owe | `#FF9466` | same as Dark | `#B53C0A` | +| highlight (sparingly) | `#D4AF37` | same as Dark | `#9A7B12` | + +Text, muted, accent, owe and danger colours have at least 4.5:1 contrast on +every background and surface in each theme. Cards and lists are separated by +shade with hairline dividers; controls are pill-shaped; the phone tab bar +floats as a pill above the content. Positive/negative amounts also differ by sign and icon, never by colour alone. diff --git a/apps/web/index.html b/apps/web/index.html index 79f2dd9..7584991 100644 --- a/apps/web/index.html +++ b/apps/web/index.html @@ -3,7 +3,7 @@ - + OweMe diff --git a/apps/web/public/manifest.webmanifest b/apps/web/public/manifest.webmanifest index 4b616eb..c9a26ed 100644 --- a/apps/web/public/manifest.webmanifest +++ b/apps/web/public/manifest.webmanifest @@ -5,8 +5,8 @@ "start_url": "/", "scope": "/", "display": "standalone", - "background_color": "#0B2E22", - "theme_color": "#0B2E22", + "background_color": "#0a0b0d", + "theme_color": "#0a0b0d", "icons": [ { "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml" }, { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" }, diff --git a/apps/web/src/app.css b/apps/web/src/app.css index c13151f..1d00059 100644 --- a/apps/web/src/app.css +++ b/apps/web/src/app.css @@ -1,59 +1,71 @@ -/* OweMe theme: dark & light "money green" (SPEC.md §10.4). */ +/* OweMe theme (SPEC.md §10.4): soft dark (default), black and light. + "System" follows the OS between soft dark and light; black is opt-in. + Contrast of text, muted, accent, owe and danger against bg, surface and + surface-2 is ≥ 4.5:1 in every theme. */ :root { - --bg: #0b2e22; - --surface: #123d2e; - --surface-2: #1a4d3a; - --border: #255c46; - --text: #e8f3ec; - --muted: #9fbfae; + --bg: #0a0b0d; + --surface: #16181c; + --surface-2: #1f2227; + --border: #3a3e45; /* controls: inputs, buttons */ + --line: #ffffff0f; /* quiet dividers: cards, lists */ + --text: #f5f6f7; + --muted: #8b9099; --accent: #3ddc97; - --accent-ink: #062016; - --owe: #f2a65a; + --accent-ink: #04140d; + --owe: #ff9466; --danger: #f87171; --gold: #d4af37; /* chart series, validated for CVD separation on --surface */ --chart-1: #22a66e; --chart-2: #4a8fd0; - --shadow: 0 8px 30px rgb(0 0 0 / 0.35); - --radius: 14px; + --shadow: 0 10px 30px rgb(0 0 0 / 0.45); + --radius: 20px; --gutter: 16px; color-scheme: dark; } +:root[data-theme='black'] { + --bg: #000000; + --surface: #121316; + --surface-2: #1b1d21; + --border: #363a40; +} @media (prefers-color-scheme: light) { - :root:not([data-theme='dark']) { - --bg: #f2f7f4; + :root:not([data-theme]) { + --bg: #f2f3f5; --surface: #ffffff; - --surface-2: #e4efe9; - --border: #cfe0d6; - --text: #0b2e22; - --muted: #4a6b5b; - --accent: #16865a; + --surface-2: #e9ebee; + --border: #c9cdd3; + --line: #0000000f; + --text: #0d0f12; + --muted: #5f6670; + --accent: #0b7549; --accent-ink: #ffffff; - --owe: #b5541c; + --owe: #b53c0a; --danger: #c0392b; --gold: #9a7b12; --chart-1: #16865a; --chart-2: #2f6fb0; - --shadow: 0 8px 30px rgb(11 46 34 / 0.12); + --shadow: 0 8px 24px rgb(13 15 18 / 0.08); color-scheme: light; } } :root[data-theme='light'] { - --bg: #f2f7f4; + --bg: #f2f3f5; --surface: #ffffff; - --surface-2: #e4efe9; - --border: #cfe0d6; - --text: #0b2e22; - --muted: #4a6b5b; - --accent: #16865a; + --surface-2: #e9ebee; + --border: #c9cdd3; + --line: #0000000f; + --text: #0d0f12; + --muted: #5f6670; + --accent: #0b7549; --accent-ink: #ffffff; - --owe: #b5541c; + --owe: #b53c0a; --danger: #c0392b; --gold: #9a7b12; --chart-1: #16865a; --chart-2: #2f6fb0; - --shadow: 0 8px 30px rgb(11 46 34 / 0.12); + --shadow: 0 8px 24px rgb(13 15 18 / 0.08); color-scheme: light; } @@ -101,12 +113,12 @@ p { margin: 0; } .card { background: var(--surface); - border: 1px solid var(--border); + border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; } -.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; } -.list > * + * { border-top: 1px solid var(--border); } +.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; } +.list > * + * { border-top: 1px solid var(--line); } .item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; text-decoration: none; @@ -124,7 +136,7 @@ button, .btn { } .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; - min-height: 44px; padding: 0 16px; border-radius: 12px; + min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; white-space: nowrap; } @@ -133,19 +145,19 @@ button, .btn { .btn.primary:hover { filter: brightness(1.08); } .btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); } .btn.ghost { background: transparent; border-color: transparent; } -.btn.small { min-height: 34px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; } +.btn.small { min-height: 34px; padding: 0 14px; font-size: 0.9rem; } .btn.block { width: 100%; } .btn:disabled { opacity: 0.5; cursor: not-allowed; } .icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; - border-radius: 12px; border: 0; background: transparent; color: var(--text); + border-radius: 50%; border: 0; background: transparent; color: var(--text); } .icon-btn:hover { background: var(--surface-2); } label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); } input, select, textarea { font: inherit; color: var(--text); background: var(--surface); width: 100%; - border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; + border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-height: 44px; } textarea { min-height: 80px; resize: vertical; } input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .item:focus-visible, .chip:focus-visible { @@ -154,16 +166,16 @@ input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-vi input[type='checkbox'] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; } input[type='date'] { min-width: 0; } -.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; } +.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 3px; } .seg button { - flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding: 0 8px; + flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding: 0 8px; } .seg button[aria-pressed='true'] { background: var(--surface-2); color: var(--text); } .chips { display: flex; flex-wrap: wrap; gap: 8px; } .chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; - border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.9rem; + border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 0.9rem; } .chip[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); } @@ -174,34 +186,37 @@ input[type='date'] { min-width: 0; } } .cat-icon { display: inline-grid; place-items: center; flex-shrink: 0; - width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-size: 1.2rem; + width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); font-size: 1.2rem; } -.banner { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); } +.banner { padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--line); } .banner.warn { border-color: color-mix(in srgb, var(--owe) 60%, var(--border)); } .banner.danger { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); } .fab { - position: fixed; right: max(var(--gutter), calc(50% - 360px + var(--gutter))); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 30; - width: 60px; height: 60px; border-radius: 20px; border: 0; + position: fixed; right: max(var(--gutter), calc(50% - 360px + var(--gutter))); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30; + width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); display: grid; place-items: center; } +/* floating pill tab bar */ .tabbar { - position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; - display: flex; justify-content: center; - background: color-mix(in srgb, var(--surface) 94%, transparent); - backdrop-filter: blur(10px); - -webkit-backdrop-filter: blur(10px); - border-top: 1px solid var(--border); - padding-bottom: env(safe-area-inset-bottom); + position: fixed; z-index: 25; + left: var(--gutter); right: var(--gutter); bottom: calc(12px + env(safe-area-inset-bottom)); + max-width: 560px; margin: 0 auto; + display: flex; justify-content: center; padding: 5px; border-radius: 999px; + background: color-mix(in srgb, var(--surface-2) 90%, transparent); + backdrop-filter: blur(16px); + -webkit-backdrop-filter: blur(16px); + border: 1px solid var(--line); + box-shadow: var(--shadow); } .tabbar a { - flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 2px; - padding: 8px 4px; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; + flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 999px; + padding: 7px 4px; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600; } -.tabbar a[aria-current='page'] { color: var(--accent); } +.tabbar a[aria-current='page'] { color: var(--text); background: var(--surface); } /* dialogs: full-screen sheet on phones, centered on desktop */ dialog.sheet { @@ -212,7 +227,7 @@ dialog.sheet::backdrop { background: rgb(0 0 0 / 0.5); } @media (min-width: 760px) { dialog.sheet { width: min(640px, calc(100% - 48px)); height: auto; max-height: calc(100dvh - 64px); - margin: auto; border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); + margin: auto; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow); } } .sheet-body { padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom)); } @@ -233,7 +248,7 @@ dialog.sheet::backdrop { background: rgb(0 0 0 / 0.5); } /* desktop: group page with a side column */ @media (min-width: 960px) { - .tabbar { position: static; justify-content: flex-start; gap: 4px; background: none; border: 0; backdrop-filter: none; padding: 0; } + .tabbar { position: static; justify-content: flex-start; gap: 4px; background: none; border: 0; box-shadow: none; backdrop-filter: none; padding: 0; margin: 0; max-width: none; } .tabbar a { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: 0.95rem; padding: 10px 14px; border-radius: 10px; } .tabbar a[aria-current='page'] { background: var(--surface); } .fab { bottom: 32px; right: max(32px, calc(50% - 560px + 32px)); } diff --git a/apps/web/src/components/AppSettings.svelte b/apps/web/src/components/AppSettings.svelte index 86643e1..f2b729e 100644 --- a/apps/web/src/components/AppSettings.svelte +++ b/apps/web/src/components/AppSettings.svelte @@ -23,6 +23,7 @@
+
diff --git a/apps/web/src/lib/locales/cs.ts b/apps/web/src/lib/locales/cs.ts index 367e4b2..5187d63 100644 --- a/apps/web/src/lib/locales/cs.ts +++ b/apps/web/src/lib/locales/cs.ts @@ -26,6 +26,7 @@ const cs: Messages = { theme: 'Vzhled', theme_system: 'Podle systému', theme_dark: 'Tmavý', + theme_black: 'Černý', theme_light: 'Světlý', create_group: 'Vytvořit skupinu', diff --git a/apps/web/src/lib/locales/en.ts b/apps/web/src/lib/locales/en.ts index 7db3eb5..4ff4cca 100644 --- a/apps/web/src/lib/locales/en.ts +++ b/apps/web/src/lib/locales/en.ts @@ -28,6 +28,7 @@ const en = { theme: 'Theme', theme_system: 'System', theme_dark: 'Dark', + theme_black: 'Black', theme_light: 'Light', // new group diff --git a/apps/web/src/lib/settings.svelte.ts b/apps/web/src/lib/settings.svelte.ts index c48eec9..dfc8277 100644 --- a/apps/web/src/lib/settings.svelte.ts +++ b/apps/web/src/lib/settings.svelte.ts @@ -4,7 +4,10 @@ import { detectLang, localeOf, translate, type Lang, type MsgKey } from './i18n. import { kvSet } from './idb.ts'; type LangPref = 'auto' | Lang; -type ThemePref = 'system' | 'dark' | 'light'; +type ThemePref = 'system' | 'dark' | 'black' | 'light'; + +/** Browser/OS chrome colour per theme; matches --bg in app.css. */ +const THEME_COLOR = { dark: '#0a0b0d', black: '#000000', light: '#f2f3f5' } as const; function load(key: string, allowed: readonly T[], def: T): T { try { @@ -22,7 +25,7 @@ function save(key: string, v: string) { class Settings { langPref = $state(load('oweme.lang', ['auto', 'en', 'cs'], 'auto')); - themePref = $state(load('oweme.theme', ['system', 'dark', 'light'], 'system')); + themePref = $state(load('oweme.theme', ['system', 'dark', 'black', 'light'], 'system')); lang = $derived(this.langPref === 'auto' ? detectLang() : this.langPref); locale = $derived(localeOf(this.lang)); @@ -45,8 +48,10 @@ class Settings { const root = document.documentElement; if (this.themePref === 'system') delete root.dataset.theme; else root.dataset.theme = this.themePref; - const dark = this.themePref === 'dark' || (this.themePref === 'system' && matchMedia('(prefers-color-scheme: dark)').matches); - document.querySelector('meta[name=theme-color]')?.setAttribute('content', dark ? '#0B2E22' : '#F2F7F4'); + // "System" follows the OS between soft dark and light. + const effective = this.themePref !== 'system' ? this.themePref + : matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'; + document.querySelector('meta[name=theme-color]')?.setAttribute('content', THEME_COLOR[effective]); } } From c12fd64f0942920605fb501fe9cfbd97292ec466 Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 6 Nov 2026 20:36:33 +0000 Subject: [PATCH 2/7] Core: per-group default category (group.updated defaultCategory) SPEC listed defaultCategory on group.updated but nothing implemented it. Replay accepts one of CATEGORIES and ignores the whole event otherwise, validating before any field is applied. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x --- packages/core/src/replay.ts | 8 +++++++- packages/core/src/types.ts | 2 ++ packages/core/test/core.test.ts | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/core/src/replay.ts b/packages/core/src/replay.ts index a7bd259..d1552c1 100644 --- a/packages/core/src/replay.ts +++ b/packages/core/src/replay.ts @@ -4,7 +4,9 @@ // after its target event; nothing is ever erased from the log. See SPEC.md §6. import { validateExpense } from './expense.ts'; import { isCurrencyCode } from './money.ts'; -import type { Activity, GroupEvent, GroupState, Recurring } from './types.ts'; +import { CATEGORIES, type Activity, type GroupEvent, type GroupState, type Recurring } from './types.ts'; + +const isCategory = (c: unknown): c is (typeof CATEGORIES)[number] => (CATEGORIES as readonly unknown[]).includes(c); export function emptyState(): GroupState { return { group: null, members: [], expenses: {}, comments: {}, recurring: {} }; @@ -40,18 +42,22 @@ function apply(s: GroupState, ev: GroupEvent, snapshots: Map const d = ev.data; if (s.group || !str(d?.name, 100) || !isCurrencyCode(d.baseCurrency)) return ignore(); s.group = { name: d.name, baseCurrency: d.baseCurrency, icon: typeof d.icon === 'string' ? d.icon.slice(0, 16) : '' }; + if (isCategory(d.defaultCategory)) s.group.defaultCategory = d.defaultCategory; act.after = { ...s.group }; break; } case 'group.updated': { if (!s.group) return ignore(); const d = ev.data ?? {}; + // Validate before changing anything, so an invalid event has no effect. + if (d.defaultCategory !== undefined && !isCategory(d.defaultCategory)) return ignore(); act.before = { ...s.group }; if (d.name !== undefined) { if (!str(d.name, 100)) return ignore(); s.group.name = d.name; } if (typeof d.icon === 'string') s.group.icon = d.icon.slice(0, 16); + if (d.defaultCategory !== undefined) s.group.defaultCategory = d.defaultCategory; if (d.baseCurrency !== undefined && d.baseCurrency !== s.group.baseCurrency) { // Locked once the group has any expense (SPEC §7.1). if (hasExpenses || !isCurrencyCode(d.baseCurrency)) return ignore(); diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index ae550d7..4bec556 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -81,6 +81,8 @@ export interface GroupInfo { name: string; baseCurrency: string; icon: string; + /** category new expenses start with; absent = 'other' */ + defaultCategory?: (typeof CATEGORIES)[number]; } export type EventBody = diff --git a/packages/core/test/core.test.ts b/packages/core/test/core.test.ts index 8d8e003..a24f498 100644 --- a/packages/core/test/core.test.ts +++ b/packages/core/test/core.test.ts @@ -149,6 +149,15 @@ describe('replay', () => { expect(replay(locked).state.group!.baseCurrency).toBe('CZK'); }); + it('sets a default category and ignores invalid ones', () => { + const set = [...baseGroup(), ev({ type: 'group.updated', data: { defaultCategory: 'travel' } })]; + expect(replay(set).state.group!.defaultCategory).toBe('travel'); + const bad = [...set, ev({ type: 'group.updated', data: { defaultCategory: 'transfer' as never, name: 'Renamed' } })]; + const g = replay(bad).state.group!; + expect(g.defaultCategory).toBe('travel'); + expect(g.name).not.toBe('Renamed'); // the whole invalid event is ignored + }); + it('revert restores an earlier state, and can itself be reverted', () => { const evs = [...baseGroup(), ev({ type: 'expense.created', data: expense() }, 'a', 'keep')]; evs.push(ev({ type: 'expense.updated', data: expense({ amount: 99900, payers: [{ member: 'a', amount: 99900 }] }) }, 'b', 'vandal')); From b3b57c156ef3c283d73618f32e4933612fd95ec7 Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 6 Nov 2026 20:36:33 +0000 Subject: [PATCH 3/7] Group page redesign and visual bug fixes Layout, from the approved mock: - Group header on Expenses/Balances: my balance as the headline number (Money component de-emphasises currency and decimals), total spent, and round quick actions Add / Payment / Settle up / Share. The floating + shows only once those scroll off screen. - Expense rows on two lines (title | amount, payer | my part) with round icons tinted per category; sentence-case section headings. - Balances: larger avatars, paired avatars on settle-up rows, tinted button. Bugs found in a screenshot pass (phone 320/390, desktop 1280; dark, black, light; English and Czech): - A long title or member name widened the group page past the screen and phones zoomed out (grid tracks without minmax(0, ...)); same in Stats. - Long titles were clipped mid-word with no ellipsis. - Category emoji nearly invisible on its grey circle in the light theme. - Stats period labels wrapped (en) or ran off screen (cs); shortened. - Icons next to wrapping text were squashed (lock on Home/App settings). - Dialogs opened with a focus ring on the close button after a tap. - New expenses always defaulted to Food & drink; now the group's default category (settable in group settings), else Other. e2e: the Balances check now targets the Settle up heading, which the new quick action shares its text with. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x --- SPEC.md | 18 +++-- apps/web/src/app.css | 22 +++++- apps/web/src/components/Balances.svelte | 19 +++-- apps/web/src/components/ExpenseDetail.svelte | 4 +- apps/web/src/components/ExpenseEditor.svelte | 2 +- apps/web/src/components/ExpenseList.svelte | 66 +++++++++-------- apps/web/src/components/GroupHeader.svelte | 74 ++++++++++++++++++++ apps/web/src/components/GroupPage.svelte | 22 +++++- apps/web/src/components/GroupSettings.svelte | 21 ++++-- apps/web/src/components/Icon.svelte | 1 + apps/web/src/components/Money.svelte | 10 +++ apps/web/src/components/Sheet.svelte | 5 ++ apps/web/src/components/Stats.svelte | 7 +- apps/web/src/lib/format.ts | 35 ++++++++- apps/web/src/lib/locales/cs.ts | 17 ++++- apps/web/src/lib/locales/en.ts | 15 +++- e2e/app.spec.ts | 2 +- 17 files changed, 275 insertions(+), 65 deletions(-) create mode 100644 apps/web/src/components/GroupHeader.svelte create mode 100644 apps/web/src/components/Money.svelte diff --git a/SPEC.md b/SPEC.md index 9c41991..1851532 100644 --- a/SPEC.md +++ b/SPEC.md @@ -262,8 +262,8 @@ the minimum in practice, and is easy to reason about. - Create group: name, base currency (default by locale: CZK for Czech, EUR otherwise), icon/emoji, initial members. - Share: copy link, native share sheet, QR code. -- Settings: rename, members, "who am I", remove from device, export, delete - group (see 8.3). +- Settings: rename, members, "who am I", default category, remove from + device, export, delete group (see 8.3). - **Base currency is locked once the group has any expense or transfer.** It can be changed freely while the group is empty; afterwards the setting is read-only with a short explanation. Clients enforce this during replay too: @@ -288,6 +288,12 @@ Fixed v1 set with icons: food & drink, groceries, transport, accommodation, entertainment, shopping, utilities, rent, travel, gifts, health, other. Transfers have their own implicit category. +Each group has a **default category** (`group.updated` → `defaultCategory`, +one of the set above; absent means "other") that new expenses start with. +Replay ignores a `group.updated` whose `defaultCategory` isn't in the set, +without applying any other field of that event. Each category has an icon +colour (`CATEGORY_COLORS` in `apps/web/src/lib/format.ts`). + ### 7.4 Recurring expenses - A template (expense object + rule: weekly / monthly / yearly, interval, @@ -435,8 +441,12 @@ which group ids exist. 1. **Home**: groups saved on this device, each showing my balance. "New group", "Open link/scan QR". -2. **Group**: tabs: Expenses · Balances (settle up) · Stats · Activity. - Floating "+" button for a new expense. +2. **Group**: on Expenses and Balances, a header with my balance as the + headline number ("You're owed / You owe / settled up"; the group total if + "who am I" isn't set), the group's total spent, and round quick actions: + Add · Payment · Settle up · Share. Tabs: Expenses · Balances (settle up) · + Stats · Activity. A floating "+" appears only once the quick actions have + scrolled off screen. 3. **Expense editor** (sheet on mobile, dialog on desktop). 4. **Expense detail**: photo, split breakdown, comments, history. 5. **Group settings**. diff --git a/apps/web/src/app.css b/apps/web/src/app.css index 1d00059..b3484a8 100644 --- a/apps/web/src/app.css +++ b/apps/web/src/app.css @@ -70,6 +70,7 @@ } * { box-sizing: border-box; } +svg { flex-shrink: 0; } /* icons beside wrapping text must not be squashed */ html { -webkit-text-size-adjust: 100%; } body { margin: 0; @@ -82,7 +83,8 @@ body { h1, h2, h3 { line-height: 1.2; margin: 0; } h1 { font-size: 1.35rem; } h2 { font-size: 1.05rem; } -h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; } +h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; } +h3.day { font-size: 0.85rem; font-weight: 600; letter-spacing: 0; color: var(--muted); padding-left: 4px; } a { color: var(--accent); } p { margin: 0; } .muted { color: var(--muted); } @@ -145,6 +147,8 @@ button, .btn { .btn.primary:hover { filter: brightness(1.08); } .btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); } .btn.ghost { background: transparent; border-color: transparent; } +.btn.tint { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); border-color: transparent; color: var(--accent); } +.btn.tint:hover { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); } .btn.small { min-height: 34px; padding: 0 14px; font-size: 0.9rem; } .btn.block { width: 100%; } .btn:disabled { opacity: 0.5; cursor: not-allowed; } @@ -166,9 +170,13 @@ input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-vi input[type='checkbox'] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; } input[type='date'] { min-width: 0; } -.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 3px; } +.seg { + display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 3px; + overflow-x: auto; scrollbar-width: none; /* very narrow screens scroll rather than wrap */ +} +.seg::-webkit-scrollbar { display: none; } .seg button { - flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding: 0 8px; + flex: 1 0 auto; white-space: nowrap; min-height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding: 0 8px; } .seg button[aria-pressed='true'] { background: var(--surface-2); color: var(--text); } @@ -223,6 +231,7 @@ dialog.sheet { padding: 0; border: 0; color: var(--text); background: var(--bg); width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; } +dialog.sheet:focus { outline: none; } dialog.sheet::backdrop { background: rgb(0 0 0 / 0.5); } @media (min-width: 760px) { dialog.sheet { @@ -254,3 +263,10 @@ dialog.sheet::backdrop { background: rgb(0 0 0 / 0.5); } .fab { bottom: 32px; right: max(32px, calc(50% - 560px + 32px)); } .page { padding-bottom: 48px; } } + +/* round category icon tinted with its category colour (set --cat inline) */ +.cat-icon { background: color-mix(in srgb, var(--cat, var(--muted)) 24%, var(--surface-2)); } + +/* money with the whole number emphasised (see moneyParts) */ +.money .cur, .money .frac { color: var(--muted); font-size: 0.82em; font-weight: inherit; } +.pos .money .cur, .pos .money .frac, .neg .money .cur, .neg .money .frac { color: inherit; opacity: 0.8; } diff --git a/apps/web/src/components/Balances.svelte b/apps/web/src/components/Balances.svelte index a07095b..563eeb0 100644 --- a/apps/web/src/components/Balances.svelte +++ b/apps/web/src/components/Balances.svelte @@ -42,14 +42,14 @@
{#each members as { m, i, bal } (m.id)}
- + {m.name}{m.id === session.me ? ` (${t('you')})` : ''} - + {bal === 0 ? t('settled') : (bal > 0 ? '+' : '−') + conv(Math.abs(bal))}
@@ -62,12 +62,18 @@ {:else}
{#each transfers as tr} + {@const from = session.state.members.findIndex((m) => m.id === tr.from)} + {@const to = session.state.members.findIndex((m) => m.id === tr.to)}
+ {session.memberName(tr.from)} → {session.memberName(tr.to)} - {conv(tr.amount)} + {conv(tr.amount)} - +
{/each}
@@ -85,7 +91,10 @@
diff --git a/apps/web/src/components/GroupHeader.svelte b/apps/web/src/components/GroupHeader.svelte new file mode 100644 index 0000000..c27d346 --- /dev/null +++ b/apps/web/src/components/GroupHeader.svelte @@ -0,0 +1,74 @@ + + +
+ {#if mine === null} +
{t('total_spent')}
+
+ {:else} +
{mine > 0 ? t('hero_owed') : mine < 0 ? t('hero_owe') : t('hero_settled')}
+
+
{t('total_spent')}
+ {/if} +
+ + + + diff --git a/apps/web/src/components/GroupPage.svelte b/apps/web/src/components/GroupPage.svelte index 5ecd727..4115412 100644 --- a/apps/web/src/components/GroupPage.svelte +++ b/apps/web/src/components/GroupPage.svelte @@ -9,6 +9,7 @@ import ExpenseDetail from './ExpenseDetail.svelte'; import ExpenseEditor from './ExpenseEditor.svelte'; import ExpenseList from './ExpenseList.svelte'; + import GroupHeader from './GroupHeader.svelte'; import GroupSettings from './GroupSettings.svelte'; import Icon from './Icon.svelte'; import IdentityPicker from './IdentityPicker.svelte'; @@ -19,12 +20,16 @@ const id = untrack(() => props.id); let session = $state(undefined); let skippedIdentity = $state(false); + // The floating Add button only appears once the header's actions scroll away. + // Starts true so the button doesn't flash before the observer reports. + let actionsVisible = $state(true); openSession(id).then((s) => (session = s)); onDestroy(() => closeSession(id)); const route = $derived(router.route); const tab = $derived(route.name === 'group' ? route.tab : 'expenses'); + const withHeader = $derived(tab === 'expenses' || tab === 'balances'); const base = `/g/${id}`; const tabs = [ { key: 'expenses', path: base, icon: 'list', label: 'expenses' }, @@ -62,7 +67,8 @@ {@const s = session}
-

{s.state.group?.name ?? s.local.name}

+ {#if s.state.group?.icon}{/if} +

{s.state.group?.name ?? s.local.name}

nav(e, `${base}/settings`)} aria-label={t('group_settings')}>
@@ -80,6 +86,10 @@ {/if} {#if s.rollback}{/if} + {#if withHeader && s.status !== 'gone'} + (actionsVisible = v)} /> + {/if} +