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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x
This commit is contained in:
parent
c12fd64f09
commit
b3b57c156e
17 changed files with 275 additions and 65 deletions
|
|
@ -3,8 +3,7 @@ import { settings } from './settings.svelte.ts';
|
|||
|
||||
const cache = new Map<string, Intl.NumberFormat>();
|
||||
|
||||
/** Format minor units as money in the current locale ("1 234,50 Kč"). */
|
||||
export function money(minor: number, currency: string, opts: { sign?: boolean } = {}): string {
|
||||
function formatter(currency: string, opts: { sign?: boolean }): Intl.NumberFormat {
|
||||
const key = `${settings.locale}|${currency}|${opts.sign ? 1 : 0}`;
|
||||
let f = cache.get(key);
|
||||
if (!f) {
|
||||
|
|
@ -19,7 +18,30 @@ export function money(minor: number, currency: string, opts: { sign?: boolean }
|
|||
}
|
||||
cache.set(key, f);
|
||||
}
|
||||
return f.format(minor / 10 ** exponent(currency));
|
||||
return f;
|
||||
}
|
||||
|
||||
/** Format minor units as money in the current locale ("1 234,50 Kč"). */
|
||||
export function money(minor: number, currency: string, opts: { sign?: boolean } = {}): string {
|
||||
return formatter(currency, opts).format(minor / 10 ** exponent(currency));
|
||||
}
|
||||
|
||||
/**
|
||||
* The same text as money(), split so the whole number can be emphasised:
|
||||
* `before` (sign, currency), `whole` ("1 234"), `frac` (",50"), `after` (" Kč").
|
||||
*/
|
||||
export function moneyParts(minor: number, currency: string, opts: { sign?: boolean } = {}) {
|
||||
const out = { before: '', whole: '', frac: '', after: '' };
|
||||
let seenNumber = false;
|
||||
for (const p of formatter(currency, opts).formatToParts(minor / 10 ** exponent(currency))) {
|
||||
if (p.type === 'integer' || p.type === 'group') {
|
||||
out.whole += p.value;
|
||||
seenNumber = true;
|
||||
} else if (p.type === 'decimal' || p.type === 'fraction') out.frac += p.value;
|
||||
else if (seenNumber) out.after += p.value;
|
||||
else out.before += p.value;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Editable amount text for an input, in the user's decimal style. */
|
||||
|
|
@ -63,6 +85,13 @@ export function currencyName(code: string): string {
|
|||
}
|
||||
}
|
||||
|
||||
/** A hue per category, used to tint its round icon background. */
|
||||
export const CATEGORY_COLORS: Record<string, string> = {
|
||||
food: '#ff8f6b', groceries: '#3ddc97', transport: '#ffc85a', accommodation: '#7aa7ff', entertainment: '#e879a6',
|
||||
shopping: '#c084fc', utilities: '#facc15', rent: '#4fd1c5', travel: '#60a5fa', gifts: '#f472b6', health: '#f87171',
|
||||
other: '#9ca3af', transfer: '#3ddc97',
|
||||
};
|
||||
|
||||
export const CATEGORY_ICONS: Record<string, string> = {
|
||||
food: '🍽️', groceries: '🛒', transport: '🚕', accommodation: '🏨', entertainment: '🎟️',
|
||||
shopping: '🛍️', utilities: '💡', rent: '🏠', travel: '✈️', gifts: '🎁', health: '💊',
|
||||
|
|
|
|||
|
|
@ -64,6 +64,15 @@ const cs: Messages = {
|
|||
add_expense: 'Přidat výdaj',
|
||||
no_expenses: 'Zatím žádné výdaje. Klepněte na + a přidejte první.',
|
||||
total_spent: 'Celkem utraceno',
|
||||
summary: 'Přehled',
|
||||
hero_owed: 'Dluží vám',
|
||||
hero_owe: 'Dlužíte',
|
||||
hero_settled: 'Máte vyrovnáno',
|
||||
quick_actions: 'Rychlé akce',
|
||||
add: 'Přidat',
|
||||
share_short: 'Sdílet',
|
||||
payment_short: 'Platba',
|
||||
add_payment: 'Zaznamenat platbu',
|
||||
paid_by: 'Platil(a) {name}',
|
||||
paid_by_many: 'Platilo {n} lidí',
|
||||
your_share: 'váš podíl {amount}',
|
||||
|
|
@ -97,6 +106,8 @@ const cs: Messages = {
|
|||
title: 'Za co?',
|
||||
title_ph: 'Večeře',
|
||||
category: 'Kategorie',
|
||||
default_category: 'Výchozí kategorie',
|
||||
default_category_hint: 'Nové výdaje začnou v této kategorii.',
|
||||
date: 'Datum',
|
||||
currency: 'Měna',
|
||||
rate: 'Směnný kurz',
|
||||
|
|
@ -179,10 +190,10 @@ const cs: Messages = {
|
|||
changed_fields: 'Změněno: {fields}',
|
||||
no_activity: 'Zatím žádná aktivita.',
|
||||
|
||||
range_all: 'Celé období',
|
||||
range_all: 'Vše',
|
||||
range_month: 'Tento měsíc',
|
||||
range_30: 'Posledních 30 dní',
|
||||
range_year: 'Tento rok',
|
||||
range_30: '30 dní',
|
||||
range_year: 'Letos',
|
||||
by_category: 'Podle kategorie',
|
||||
by_month: 'Podle měsíce',
|
||||
per_member: 'Zaplaceno vs. podíl',
|
||||
|
|
|
|||
|
|
@ -70,6 +70,15 @@ const en = {
|
|||
add_expense: 'Add expense',
|
||||
no_expenses: 'No expenses yet. Tap + to add the first one.',
|
||||
total_spent: 'Total spent',
|
||||
summary: 'Summary',
|
||||
hero_owed: 'You’re owed',
|
||||
hero_owe: 'You owe',
|
||||
hero_settled: 'You’re settled up',
|
||||
quick_actions: 'Quick actions',
|
||||
add: 'Add',
|
||||
share_short: 'Share',
|
||||
payment_short: 'Payment',
|
||||
add_payment: 'Record a payment',
|
||||
paid_by: 'Paid by {name}',
|
||||
paid_by_many: 'Paid by {n} people',
|
||||
your_share: 'your share {amount}',
|
||||
|
|
@ -105,6 +114,8 @@ const en = {
|
|||
title: 'What was it for?',
|
||||
title_ph: 'Dinner',
|
||||
category: 'Category',
|
||||
default_category: 'Default category',
|
||||
default_category_hint: 'New expenses start in this category.',
|
||||
date: 'Date',
|
||||
currency: 'Currency',
|
||||
rate: 'Exchange rate',
|
||||
|
|
@ -190,9 +201,9 @@ const en = {
|
|||
no_activity: 'No activity yet.',
|
||||
|
||||
// stats
|
||||
range_all: 'All time',
|
||||
range_all: 'All',
|
||||
range_month: 'This month',
|
||||
range_30: 'Last 30 days',
|
||||
range_30: '30 days',
|
||||
range_year: 'This year',
|
||||
by_category: 'By category',
|
||||
by_month: 'By month',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue