diff --git a/README.md b/README.md index 6a770a6..b0038dd 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ Settle Up clone that runs in any browser and installs as an app. - Groups you open via a link; the key travels in the `#fragment` and never reaches the server - Equal, shares, exact-amount and percent splits; several payers; any member can be left out -- Multiple currencies with daily rates — ECB, plus ExchangeRate-API for the - rest (stored per expense, editable) +- Multiple currencies with ECB daily rates (stored per expense, editable) - One receipt photo per expense (resized, location data stripped, encrypted) - Who-pays-whom settle-up suggestions, with "record payment" - Full history: restore any version, or rewind the whole group (and undo that) diff --git a/SPEC.md b/SPEC.md index e9767ae..499517b 100644 --- a/SPEC.md +++ b/SPEC.md @@ -156,7 +156,7 @@ entity fully defines it. Conflicts resolve **last-writer-wins by server "currency": "EUR", "amount": 12050, // 120.50 EUR "rate": "25.214", // decimal string: 1 EUR = 25.214 base; "1" if same currency - "rateSource": "ecb:2026-10-08", // or "xr:", "manual" (see 8.2) + "rateSource": "ecb:2026-10-08", // or "manual" "payers": [ { "member": "m1", "amount": 12050 } ], // sums to amount "split": { "mode": "equal", // equal | shares | exact | percent @@ -180,11 +180,8 @@ Split `value` meaning per mode: | `exact` | amount in minor units | sum == amount | | `percent` | basis points (100 % = 10000) | sum == 10000 | -Multiple payers are supported (`payers` list) — e.g. several people chipping -in for a car. The editor shows a single payer by default; choosing "Several -people" in *Paid by* lists every member with an amount box. Empty boxes show -the unassigned remainder as a placeholder, a live line reads "Remaining" / -"Over by" / "Adds up to the total", and the expense list shows "N payers". +Multiple payers are supported (`payers` list); the default UI shows a single +payer with an "add payer" option. --- @@ -265,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", default category, remove from - device, export, delete group (see 8.3). +- Settings: rename, members, "who am I", 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: @@ -281,18 +278,6 @@ the minimum in practice, and is easy to reason about. the daily rate for the expense date and is editable. - Split editor: equal / shares / exact / percent tabs; tap to exclude people; live "remaining to assign" indicator for exact and percent modes. -- The add sheet fits one phone screen (390×844, three members): currency as a - pill beside the amount; categories as 12 equal icon tiles (6 × 2 on phones, - one row of 12 when wider) with the chosen name beside the label; date and - payer side by side ("Several people" is the last payer option); photo, note - and repeat stay folded behind small buttons; Save is pinned to the bottom. -- Touch gestures on the group page (shortcuts; every action also has a - button): pull up past the end of the Expenses or Balances tab to add an - expense (a "Pull up to add expense" pill rises from behind the tab bar and - reads "Release to add" once far enough; at the bottom so the browser's - pull-to-refresh still works), and swipe left/right to move between the - Expenses, Balances, Stats and Activity tabs. Swipes starting within 24px - of the screen edge are left to the OS back gesture. - **One photo per expense** (receipt), see 9. - Category, date, note. - Comments thread on each expense. @@ -303,12 +288,6 @@ 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, @@ -391,27 +370,9 @@ which group ids exist. ECB's own XML feed) every 6 hours and caches them in SQLite. The first run loads the full history (back to 1999) for back-dated expenses; later runs fetch the last 90 days. -- For currencies the ECB doesn't publish (e.g. ALL), the server also fetches - a **supplementary EUR-based feed** on the same schedule: ExchangeRate-API's - free endpoint (`RATES_EXTRA_URL`, default - `https://open.er-api.com/v6/latest/EUR`; empty turns it off). It has no - history, so its daily snapshots accumulate from when the server starts - fetching them; one older than a week before the requested date is not - used. It is stored apart from the ECB rates, and **the ECB rate always wins** - for a currency both publish. `GET /api/rates` merges the two and returns - `sources: { CODE: "xr:" }` for every supplementary rate. -- An expense's `rateSource` is `ecb:`, or `xr:` when either side - of the conversion came from the supplementary feed. The editor labels `xr:` - rates with a link to exchangerate-api.com (the free tier's attribution - requirement). - Clients fetch from our server only, so third parties don't learn users' IPs or currency usage. Clients cache rates offline. -- The currency picker offers only **ISO 4217 currencies in circulation** - (`ACTIVE_CURRENCIES` in `packages/core/src/currencies.ts`, hand-maintained; - browsers' `Intl.supportedValuesOf('currency')` includes long-gone codes). - Those with a daily rate come first; the rest can be used with a manually - entered rate. A group or recent currency that has since been withdrawn - stays selectable. +- Currencies outside the ECB set can be used with a manually entered rate. - Behind an interface so a paid intraday provider can be swapped in later. ### 8.3 Storage and limits @@ -456,22 +417,11 @@ which group ids exist. 1. **Home**: groups saved on this device, each showing my balance. "New group", "Open link/scan QR". -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. Touch gestures: pull up at the end of the page to - add, swipe sideways to change tab (see 7.2). +2. **Group**: tabs: Expenses · Balances (settle up) · Stats · Activity. + Floating "+" button for a new expense. 3. **Expense editor** (sheet on mobile, dialog on desktop). 4. **Expense detail**: photo, split breakdown, comments, history. -5. **Group settings**, kept short: Share (copy link, native share, QR), - Group (icon, name, main currency and default category side by side; Save - appears only when something changed), Members ("You are" picker on top; - rename/archive as icon buttons; add member as the last row), - Notifications (one switch; hidden where push isn't available), Repeating - expenses (only when there are any), Export, Danger zone (delete asks for - the group name only after it is tapped). +5. **Group settings**. 6. **App settings**: language, theme, notifications. ### 10.3 Language @@ -486,26 +436,19 @@ which group ids exist. ### 10.4 Theme -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`: +Dark and light, following the system setting by default with a manual +override. Starting palette (to be validated for WCAG AA contrast): -| 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. +| 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` | Positive/negative amounts also differ by sign and icon, never by colour alone. diff --git a/apps/server/src/app.ts b/apps/server/src/app.ts index 67e156b..8d673a0 100644 --- a/apps/server/src/app.ts +++ b/apps/server/src/app.ts @@ -292,7 +292,7 @@ export function createApp(cfg: Config, store: Store) { function rates(res: ServerResponse, url: URL) { const date = url.searchParams.get('date') ?? new Date().toISOString().slice(0, 10); - if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || Number.isNaN(Date.parse(date))) throw new HttpError(400, 'bad date'); + if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) throw new HttpError(400, 'bad date'); const r = store.ratesOn(date); if (!r) throw new HttpError(404, 'no rates'); // Past dates never change; today's may still be published later. diff --git a/apps/server/src/config.ts b/apps/server/src/config.ts index 3d3b04b..c9f0f9c 100644 --- a/apps/server/src/config.ts +++ b/apps/server/src/config.ts @@ -26,8 +26,6 @@ export interface Config { pushEnabled: boolean; ratesEnabled: boolean; ratesBaseUrl: string; - /** supplementary EUR-based rates for currencies the ECB doesn't publish; empty = off */ - ratesExtraUrl: string; } export function loadConfig(env = process.env): Config { @@ -47,7 +45,5 @@ export function loadConfig(env = process.env): Config { pushEnabled: env.PUSH_DISABLED !== '1', ratesEnabled: env.RATES_DISABLED !== '1', ratesBaseUrl: env.RATES_BASE_URL || 'https://www.ecb.europa.eu/stats/eurofxref', - // `??`, not `||`: an explicitly empty value turns the extra source off. - ratesExtraUrl: env.RATES_EXTRA_URL ?? 'https://open.er-api.com/v6/latest/EUR', }; } diff --git a/apps/server/src/db.ts b/apps/server/src/db.ts index c23b618..c550794 100644 --- a/apps/server/src/db.ts +++ b/apps/server/src/db.ts @@ -19,12 +19,6 @@ export interface PushSub { deviceId: string; } -export interface RatesDay { - date: string; - rates: Record; - sources: Record; -} - export class Store { readonly db: DatabaseSync; @@ -71,13 +65,6 @@ export class Store { date TEXT PRIMARY KEY, json TEXT NOT NULL ); - -- Supplementary rates (see rates.ts), kept apart so ECB refreshes never - -- overwrite them and ECB always wins for currencies both publish. - CREATE TABLE IF NOT EXISTS rates_extra ( - date TEXT PRIMARY KEY, - source TEXT NOT NULL, - json TEXT NOT NULL - ); `); } @@ -173,37 +160,12 @@ export class Store { this.db.prepare('INSERT OR REPLACE INTO rates (date, json) VALUES (?, ?)').run(date, JSON.stringify(rates)); } - saveExtraRates(date: string, source: string, rates: Record): void { - this.db - .prepare('INSERT OR REPLACE INTO rates_extra (date, source, json) VALUES (?, ?, ?)') - .run(date, source, JSON.stringify(rates)); - } - - /** - * ECB rates for the latest published date on or before `date`, plus - * supplementary rates for currencies the ECB doesn't publish. `sources` - * names the origin of each supplementary rate (":"). - * Supplementary rates older than a week before `date` are not used. - */ - ratesOn(date: string): RatesDay | undefined { + /** Rates for the latest published date on or before `date`. */ + ratesOn(date: string): { date: string; rates: Record } | undefined { const r = this.db.prepare('SELECT date, json FROM rates WHERE date <= ? ORDER BY date DESC LIMIT 1').get(date) as | { date: string; json: string } | undefined; - if (!r) return undefined; - const rates: Record = JSON.parse(r.json); - const sources: Record = {}; - const weekBefore = new Date(Date.parse(date) - 7 * 86400_000).toISOString().slice(0, 10); - const x = this.db - .prepare('SELECT date, source, json FROM rates_extra WHERE date <= ? AND date >= ? ORDER BY date DESC LIMIT 1') - .get(date, weekBefore) as { date: string; source: string; json: string } | undefined; - if (x) { - for (const [code, rate] of Object.entries(JSON.parse(x.json) as Record)) { - if (code in rates) continue; - rates[code] = rate; - sources[code] = `${x.source}:${x.date}`; - } - } - return { date: r.date, rates, sources }; + return r && { date: r.date, rates: JSON.parse(r.json) }; } latestRatesDate(): string | undefined { diff --git a/apps/server/src/main.ts b/apps/server/src/main.ts index e2fdbe1..3a43c48 100644 --- a/apps/server/src/main.ts +++ b/apps/server/src/main.ts @@ -11,7 +11,7 @@ const server = createServer(createApp(cfg, store)); server.requestTimeout = 0; server.headersTimeout = 30_000; -const rates = new RatesService(store, cfg.ratesBaseUrl, cfg.ratesExtraUrl); +const rates = new RatesService(store, cfg.ratesBaseUrl); if (cfg.ratesEnabled) rates.start(); server.listen(cfg.port, cfg.host, () => { diff --git a/apps/server/src/rates.ts b/apps/server/src/rates.ts index 792ead0..e0bc450 100644 --- a/apps/server/src/rates.ts +++ b/apps/server/src/rates.ts @@ -1,35 +1,7 @@ -// Exchange rates, fetched by the server so that clients never contact a -// third party (SPEC.md §8.2): -// - ECB daily reference rates (EUR-based, ~30 currencies, history to 1999); -// - a supplementary EUR-based feed for everything else (e.g. ALL), in the -// format of ExchangeRate-API's free endpoint. It has no history, so its -// daily snapshots accumulate from the day the server starts fetching. +// ECB daily reference rates (EUR-based). Fetched by the server so that +// clients never contact a third party (SPEC.md §8.2). import type { Store } from './db.ts'; -/** Short name stored with supplementary rates; the client labels it. */ -export const EXTRA_SOURCE = 'xr'; - -const DECIMAL_RE = /^\d{1,12}(?:\.\d{1,12})?$/; - -/** - * Parse an ExchangeRate-API style response - * (`{ result, base_code, time_last_update_unix, rates: { CODE: number } }`) - * into its UTC date and decimal-string rates. - */ -export function parseExtraRates(json: unknown): { date: string; rates: Record } { - const d = json as { result?: unknown; base_code?: unknown; time_last_update_unix?: unknown; rates?: unknown }; - if (d?.result !== 'success' || d.base_code !== 'EUR') throw new Error('not a successful EUR-based response'); - if (typeof d.time_last_update_unix !== 'number' || typeof d.rates !== 'object' || !d.rates) throw new Error('malformed response'); - const rates: Record = {}; - for (const [code, value] of Object.entries(d.rates as Record)) { - if (!/^[A-Z]{3}$/.test(code) || typeof value !== 'number' || !(value > 0)) continue; - const str = String(value); // e.g. 1e-7 would not be a valid rate string; skip it - if (DECIMAL_RE.test(str)) rates[code] = str; - } - if (Object.keys(rates).length === 0) throw new Error('no rates parsed'); - return { date: new Date(d.time_last_update_unix * 1000).toISOString().slice(0, 10), rates }; -} - /** Parse the ECB eurofxref XML into date → { currency: rate }. EUR = "1". */ export function parseEcbXml(xml: string): Map> { const out = new Map>(); @@ -47,12 +19,10 @@ export class RatesService { private timer: NodeJS.Timeout | undefined; private readonly store: Store; private readonly baseUrl: string; - private readonly extraUrl: string; - constructor(store: Store, baseUrl: string, extraUrl = '') { + constructor(store: Store, baseUrl: string) { this.store = store; this.baseUrl = baseUrl; - this.extraUrl = extraUrl; } async refresh(): Promise { @@ -68,20 +38,9 @@ export class RatesService { console.log(`rates: stored ${days.size} days from ${file}, latest ${this.store.latestRatesDate()}`); } - async refreshExtra(): Promise { - const res = await fetch(this.extraUrl, { signal: AbortSignal.timeout(60_000) }); - if (!res.ok) throw new Error(`extra rates: HTTP ${res.status}`); - const { date, rates } = parseExtraRates(await res.json()); - this.store.saveExtraRates(date, EXTRA_SOURCE, rates); - console.log(`rates: stored ${Object.keys(rates).length} extra rates for ${date}`); - } - /** Refresh now and then every 6 hours (ECB publishes once a day ~16:00 CET). */ start(): void { - const run = () => { - this.refresh().catch((e) => console.error(`rates: ${e.message}`)); - if (this.extraUrl) this.refreshExtra().catch((e) => console.error(`rates: ${e.message}`)); - }; + const run = () => this.refresh().catch((e) => console.error(`rates: ${e.message}`)); void run(); this.timer = setInterval(run, 6 * 3600_000); this.timer.unref(); diff --git a/apps/server/test/server.test.ts b/apps/server/test/server.test.ts index 5f27381..5728658 100644 --- a/apps/server/test/server.test.ts +++ b/apps/server/test/server.test.ts @@ -9,7 +9,7 @@ import { createApp } from '../src/app.ts'; import { loadConfig } from '../src/config.ts'; import { Store } from '../src/db.ts'; import { encryptPayload, isAllowedEndpoint, loadVapidKeys } from '../src/push.ts'; -import { parseEcbXml, parseExtraRates } from '../src/rates.ts'; +import { parseEcbXml } from '../src/rates.ts'; const b64u = (b: Buffer) => b.toString('base64url'); const newGroup = () => { @@ -35,7 +35,6 @@ before(async () => { }); store = new Store(cfg.dataDir); store.saveRates('2026-10-08', { EUR: '1', CZK: '24.4', USD: '1.12' }); - store.saveExtraRates('2026-10-09', 'xr', { EUR: '1', CZK: '24.9', ALL: '98.38' }); server = createServer(createApp(cfg, store)); await new Promise((r) => server.listen(0, '127.0.0.1', r)); const addr = server.address() as { port: number }; @@ -143,27 +142,6 @@ describe('rates and static', () => { assert.equal((await api('GET', '/api/rates?date=2020-01-01')).status, 404); }); - it('fills in currencies the ECB lacks from the extra source, ECB first', async () => { - const r = await api('GET', '/api/rates?date=2026-10-11'); - assert.equal(r.data.rates.ALL, '98.38'); - assert.equal(r.data.rates.CZK, '24.4'); - assert.deepEqual(r.data.sources, { ALL: 'xr:2026-10-09' }); - // A snapshot more than a week old is not used; ECB rates still are. - const late = await api('GET', '/api/rates?date=2026-10-20'); - assert.equal(late.data.rates.ALL, undefined); - assert.equal(late.data.rates.CZK, '24.4'); - assert.equal((await api('GET', '/api/rates?date=2026-02-30x')).status, 400); - assert.equal((await api('GET', '/api/rates?date=2026-13-45')).status, 400); - }); - - it('parses the extra rates feed', () => { - const t = Date.UTC(2026, 10, 6, 0, 2) / 1000; - const p = parseExtraRates({ result: 'success', base_code: 'EUR', time_last_update_unix: t, rates: { EUR: 1, ALL: 98.38, BAD: -1, XYZ: 1e-9, lower: 2 } }); - assert.deepEqual(p, { date: '2026-11-06', rates: { EUR: '1', ALL: '98.38' } }); - assert.throws(() => parseExtraRates({ result: 'error' })); - assert.throws(() => parseExtraRates({ result: 'success', base_code: 'USD', time_last_update_unix: t, rates: { EUR: 1 } })); - }); - it('parses ECB XML', () => { const xml = ''; assert.deepEqual(parseEcbXml(xml).get('2026-10-09'), { EUR: '1', USD: '1.1206', CZK: '24.369' }); diff --git a/apps/web/index.html b/apps/web/index.html index 7584991..79f2dd9 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 c9a26ed..4b616eb 100644 --- a/apps/web/public/manifest.webmanifest +++ b/apps/web/public/manifest.webmanifest @@ -5,8 +5,8 @@ "start_url": "/", "scope": "/", "display": "standalone", - "background_color": "#0a0b0d", - "theme_color": "#0a0b0d", + "background_color": "#0B2E22", + "theme_color": "#0B2E22", "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 16f2eb7..c13151f 100644 --- a/apps/web/src/app.css +++ b/apps/web/src/app.css @@ -1,76 +1,63 @@ -/* 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. */ +/* OweMe theme: dark & light "money green" (SPEC.md §10.4). */ :root { - --bg: #0a0b0d; - --surface: #16181c; - --surface-2: #1f2227; - --border: #3a3e45; /* controls: inputs, buttons */ - --line: #ffffff0f; /* quiet dividers: cards, lists */ - --text: #f5f6f7; - --muted: #8b9099; + --bg: #0b2e22; + --surface: #123d2e; + --surface-2: #1a4d3a; + --border: #255c46; + --text: #e8f3ec; + --muted: #9fbfae; --accent: #3ddc97; - --accent-ink: #04140d; - --owe: #ff9466; + --accent-ink: #062016; + --owe: #f2a65a; --danger: #f87171; --gold: #d4af37; /* chart series, validated for CVD separation on --surface */ --chart-1: #22a66e; --chart-2: #4a8fd0; - --shadow: 0 10px 30px rgb(0 0 0 / 0.45); - --radius: 20px; + --shadow: 0 8px 30px rgb(0 0 0 / 0.35); + --radius: 14px; --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]) { - --bg: #f2f3f5; + :root:not([data-theme='dark']) { + --bg: #f2f7f4; --surface: #ffffff; - --surface-2: #e9ebee; - --border: #c9cdd3; - --line: #0000000f; - --text: #0d0f12; - --muted: #5f6670; - --accent: #0b7549; + --surface-2: #e4efe9; + --border: #cfe0d6; + --text: #0b2e22; + --muted: #4a6b5b; + --accent: #16865a; --accent-ink: #ffffff; - --owe: #b53c0a; + --owe: #b5541c; --danger: #c0392b; --gold: #9a7b12; --chart-1: #16865a; --chart-2: #2f6fb0; - --shadow: 0 8px 24px rgb(13 15 18 / 0.08); + --shadow: 0 8px 30px rgb(11 46 34 / 0.12); color-scheme: light; } } :root[data-theme='light'] { - --bg: #f2f3f5; + --bg: #f2f7f4; --surface: #ffffff; - --surface-2: #e9ebee; - --border: #c9cdd3; - --line: #0000000f; - --text: #0d0f12; - --muted: #5f6670; - --accent: #0b7549; + --surface-2: #e4efe9; + --border: #cfe0d6; + --text: #0b2e22; + --muted: #4a6b5b; + --accent: #16865a; --accent-ink: #ffffff; - --owe: #b53c0a; + --owe: #b5541c; --danger: #c0392b; --gold: #9a7b12; --chart-1: #16865a; --chart-2: #2f6fb0; - --shadow: 0 8px 24px rgb(13 15 18 / 0.08); + --shadow: 0 8px 30px rgb(11 46 34 / 0.12); color-scheme: light; } * { 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; @@ -83,8 +70,7 @@ body { h1, h2, h3 { line-height: 1.2; margin: 0; } h1 { font-size: 1.35rem; } h2 { font-size: 1.05rem; } -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; } +h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; } a { color: var(--accent); } p { margin: 0; } .muted { color: var(--muted); } @@ -115,12 +101,12 @@ p { margin: 0; } .card { background: var(--surface); - border: 1px solid var(--line); + border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; } -.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; } -.list > * + * { border-top: 1px solid var(--line); } +.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; } +.list > * + * { border-top: 1px solid var(--border); } .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; @@ -138,7 +124,7 @@ button, .btn { } .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; - min-height: 44px; padding: 0 18px; border-radius: 999px; + min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; white-space: nowrap; } @@ -147,21 +133,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.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.small { min-height: 34px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; } .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: 50%; border: 0; background: transparent; color: var(--text); + border-radius: 12px; 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: 12px; padding: 10px 12px; min-height: 44px; + border: 1px solid var(--border); border-radius: 10px; 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 { @@ -170,20 +154,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(--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 { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; } .seg button { - 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; + 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; } .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(--line); background: var(--surface); color: var(--text); font-size: 0.9rem; + border-radius: 999px; border: 1px solid var(--border); 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)); } @@ -194,53 +174,45 @@ input[type='date'] { min-width: 0; } } .cat-icon { display: inline-grid; place-items: center; flex-shrink: 0; - width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); font-size: 1.2rem; + width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-size: 1.2rem; } -.banner { padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--line); } +.banner { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); } .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(96px + env(safe-area-inset-bottom)); z-index: 30; - width: 60px; height: 60px; border-radius: 50%; border: 0; + 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; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); display: grid; place-items: center; } -/* floating pill tab bar */ .tabbar { - 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); + 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); } .tabbar a { - 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; + 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; } -.tabbar a[aria-current='page'] { color: var(--text); background: var(--surface); } +.tabbar a[aria-current='page'] { color: var(--accent); } /* dialogs: full-screen sheet on phones, centered on desktop */ 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; } -/* Sheets scroll under an opaque header (and, in the editor, a pinned Save bar): - keep focused fields clear of both. */ -dialog.sheet { scroll-padding: 72px 0 96px; } -dialog.sheet .topbar { background: var(--bg); } 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: 24px; border: 1px solid var(--line); box-shadow: var(--shadow); + margin: auto; border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); } } .sheet-body { padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom)); } @@ -261,16 +233,9 @@ 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; box-shadow: none; backdrop-filter: none; padding: 0; margin: 0; max-width: none; } + .tabbar { position: static; justify-content: flex-start; gap: 4px; background: none; border: 0; backdrop-filter: none; padding: 0; } .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)); } .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/AppSettings.svelte b/apps/web/src/components/AppSettings.svelte index f2b729e..86643e1 100644 --- a/apps/web/src/components/AppSettings.svelte +++ b/apps/web/src/components/AppSettings.svelte @@ -23,7 +23,6 @@
-
diff --git a/apps/web/src/components/Balances.svelte b/apps/web/src/components/Balances.svelte index 563eeb0..a07095b 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,18 +62,12 @@ {: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}
@@ -91,10 +85,7 @@
diff --git a/apps/web/src/components/ExpenseList.svelte b/apps/web/src/components/ExpenseList.svelte index f866bc4..0f12c94 100644 --- a/apps/web/src/components/ExpenseList.svelte +++ b/apps/web/src/components/ExpenseList.svelte @@ -1,11 +1,10 @@ - - diff --git a/apps/web/src/components/GroupGestures.svelte b/apps/web/src/components/GroupGestures.svelte deleted file mode 100644 index 57ebce3..0000000 --- a/apps/web/src/components/GroupGestures.svelte +++ /dev/null @@ -1,215 +0,0 @@ - - - - - diff --git a/apps/web/src/components/GroupHeader.svelte b/apps/web/src/components/GroupHeader.svelte deleted file mode 100644 index c27d346..0000000 --- a/apps/web/src/components/GroupHeader.svelte +++ /dev/null @@ -1,74 +0,0 @@ - - -
- {#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 7170c2d..5ecd727 100644 --- a/apps/web/src/components/GroupPage.svelte +++ b/apps/web/src/components/GroupPage.svelte @@ -1,5 +1,5 @@ - -{money(minor, currency, { sign })} diff --git a/apps/web/src/components/Sheet.svelte b/apps/web/src/components/Sheet.svelte index dadbe07..88522d5 100644 --- a/apps/web/src/components/Sheet.svelte +++ b/apps/web/src/components/Sheet.svelte @@ -10,17 +10,12 @@ $effect(() => { dialog.showModal(); - // showModal() focuses the first control (the close button), which shows a - // focus ring even after a tap. Focus the dialog itself instead, unless a - // field asked for focus with autofocus. Tab still reaches every control. - if (!dialog.querySelector('[autofocus]')) dialog.focus(); return () => dialog.close(); }); { e.preventDefault(); onclose(); }} diff --git a/apps/web/src/components/Stats.svelte b/apps/web/src/components/Stats.svelte index 6e061ea..6137fb6 100644 --- a/apps/web/src/components/Stats.svelte +++ b/apps/web/src/components/Stats.svelte @@ -31,7 +31,7 @@
-
+
{#each [['all', 'range_all'], ['year', 'range_year'], ['month', 'range_month'], ['30', 'range_30']] as const as [r, label]} {/each} @@ -118,20 +118,19 @@