diff --git a/client/src/components/common/CategoryIcon.tsx b/client/src/components/common/CategoryIcon.tsx
new file mode 100644
index 00000000..dc2f8ff2
--- /dev/null
+++ b/client/src/components/common/CategoryIcon.tsx
@@ -0,0 +1,192 @@
+import type { LucideIcon, LucideProps } from 'lucide-react'
+import {
+ Baby, Banknote, Beer, Bike, BookOpen, Bookmark, Briefcase, Building2, Bus, Cake, Car, CarFront, CarTaxiFront, Cat, ChartColumn, ChartLine, Cherry, CircleDot, Clapperboard, Cloud, Coffee, Coins, CreditCard, CupSoda, Dna, Dog, DollarSign, Drama, Dribbble, Droplet, Droplets, Dumbbell, FileText, Flame, FlaskConical, Flower, Flower2, Footprints, Fuel, Gamepad2, Gift, GlassWater, Glasses, Globe, GraduationCap, Guitar, Hammer, HandCoins, Heart, HeartCrack, HeartPulse, Hospital, Hotel, House, Landmark, Laptop, Library, Lightbulb, Mail, Mailbox, MapPin, Microscope, Music, Navigation, NotebookPen, Package, Palette, PartyPopper, PawPrint, Pencil, PiggyBank, Pill, Pin, Pizza, Plane, PlugZap, Rabbit, Rainbow, Rat, Receipt, RefreshCw, Salad, Sandwich, School, Scissors, Shirt, ShoppingBag, ShoppingCart, ShowerHead, Smartphone, Smile, Soup, Sparkle, Sparkles, Sprout, Star, Stethoscope, Store, Sun, Swords, Syringe, Tag, Target, TestTube, Ticket, ToyBrick, TrainFront, TreePalm, TrendingDown, TrendingUp, Trophy, Tv, UtensilsCrossed, Volleyball, Wrench, Zap,
+} from 'lucide-react'
+
+/**
+ * Categories store an emoji (user-chosen, shared with the API and MCP). The
+ * interface draws each one as a line icon so every category matches the rest
+ * of the app's icon weight; unknown values fall back to a tag.
+ */
+const ICONS: Record = {
+ '💰': PiggyBank,
+ '💵': Banknote,
+ '💳': CreditCard,
+ '💸': HandCoins,
+ '🏦': Landmark,
+ '💼': Briefcase,
+ '📊': ChartColumn,
+ '📈': TrendingUp,
+ '📉': TrendingDown,
+ '💹': ChartLine,
+ '🛒': ShoppingCart,
+ '🍕': Pizza,
+ '🍔': Sandwich,
+ '🍜': Soup,
+ '🥗': Salad,
+ '🍱': UtensilsCrossed,
+ '☕': Coffee,
+ '🍺': Beer,
+ '🥤': CupSoda,
+ '🧃': GlassWater,
+ '🏠': House,
+ '🏢': Building2,
+ '🏪': Store,
+ '🏨': Hotel,
+ '🏥': Hospital,
+ '🏫': School,
+ '⛽': Fuel,
+ '🚗': Car,
+ '🚕': CarTaxiFront,
+ '🚙': CarFront,
+ '✈': Plane,
+ '🚆': TrainFront,
+ '🚌': Bus,
+ '🚲': Bike,
+ '🛴': Navigation,
+ '⚡': Zap,
+ '💡': Lightbulb,
+ '🔌': PlugZap,
+ '📱': Smartphone,
+ '💻': Laptop,
+ '🎮': Gamepad2,
+ '🎬': Clapperboard,
+ '🎵': Music,
+ '🎸': Guitar,
+ '🎨': Palette,
+ '📚': Library,
+ '📖': BookOpen,
+ '✏': Pencil,
+ '📝': NotebookPen,
+ '📦': Package,
+ '🎁': Gift,
+ '🎉': PartyPopper,
+ '🎊': Sparkles,
+ '🎈': Cake,
+ '💐': Flower2,
+ '🌹': Flower,
+ '🌺': Flower2,
+ '🌻': Sun,
+ '🌷': Sprout,
+ '🌸': Cherry,
+ '👕': Shirt,
+ '👔': Shirt,
+ '👗': Shirt,
+ '👠': Footprints,
+ '👟': Footprints,
+ '💄': Sparkles,
+ '💅': Sparkles,
+ '💆': HeartPulse,
+ '💇': Scissors,
+ '🧴': Droplets,
+ '🏋': Dumbbell,
+ '⚽': Volleyball,
+ '🏀': Dribbble,
+ '🎾': Trophy,
+ '🏐': Volleyball,
+ '🏓': Trophy,
+ '🏸': Trophy,
+ '🥊': Swords,
+ '🎯': Target,
+ '🎱': CircleDot,
+ '💊': Pill,
+ '💉': Syringe,
+ '🩺': Stethoscope,
+ '🧬': Dna,
+ '🔬': Microscope,
+ '🧪': FlaskConical,
+ '🧫': TestTube,
+ '🦷': Smile,
+ '👓': Glasses,
+ '🐶': Dog,
+ '🐱': Cat,
+ '🐭': Rat,
+ '🐹': Rabbit,
+ '🐰': Rabbit,
+ '🦊': PawPrint,
+ '🐻': PawPrint,
+ '🐼': PawPrint,
+ '🐨': PawPrint,
+ '🐯': PawPrint,
+ '❤': Heart,
+ '💙': Heart,
+ '💚': Heart,
+ '💛': Heart,
+ '🧡': Heart,
+ '💜': Heart,
+ '🖤': Heart,
+ '🤍': Heart,
+ '🤎': Heart,
+ '💔': HeartCrack,
+ '⭐': Star,
+ '✨': Sparkles,
+ '🌟': Star,
+ '💫': Sparkle,
+ '🔥': Flame,
+ '💥': Zap,
+ '🎆': Sparkles,
+ '🎇': Sparkles,
+ '🌈': Rainbow,
+ '☀': Sun,
+ '📌': Pin,
+ '📍': MapPin,
+ '🔖': Bookmark,
+ '🏷': Tag,
+ '🎫': Ticket,
+ '🎟': Ticket,
+ '📮': Mailbox,
+ '📬': Mail,
+ '📭': Mail,
+ '📪': Mail,
+ '📄': FileText,
+ '🔄': RefreshCw,
+ '🏡': House,
+ '🍽': UtensilsCrossed,
+ '🚇': TrainFront,
+ '🎓': GraduationCap,
+ '🧾': Receipt,
+ '🛍': ShoppingBag,
+ '💲': DollarSign,
+ '🪙': Coins,
+ '🏖': TreePalm,
+ '🧸': ToyBrick,
+ '👶': Baby,
+ '🐾': PawPrint,
+ '🎭': Drama,
+ '📺': Tv,
+ '🔧': Wrench,
+ '🛠': Hammer,
+ '🧹': Sparkles,
+ '🚿': ShowerHead,
+ '🌐': Globe,
+ '☁': Cloud,
+ '💧': Droplet,
+}
+
+const normalize = (value: string) => value.replace(/\uFE0F/g, '').trim()
+
+export function categoryIconFor(value?: string | null): LucideIcon {
+ return (value && ICONS[normalize(value)]) || Tag
+}
+
+/** Readable name for an icon choice, e.g. "Shopping cart". */
+export function categoryIconLabel(value?: string | null): string {
+ const name = categoryIconFor(value).displayName ?? 'Tag'
+ return name.replace(/\d+$/, '').replace(/(? c.toUpperCase()).replace(/ ([A-Z])/g, (_, c: string) => ` ${c.toLowerCase()}`)
+}
+
+/** One emoji per distinct icon, in picker order; the emoji is what gets stored. */
+export function distinctIconOptions(options: readonly string[]): string[] {
+ const seen = new Set()
+ return options.filter(option => {
+ const icon = categoryIconFor(option)
+ if (seen.has(icon)) return false
+ seen.add(icon)
+ return true
+ })
+}
+
+export function CategoryIcon({ icon, className = 'h-4 w-4', ...props }: { icon?: string | null } & LucideProps) {
+ const Icon = categoryIconFor(icon)
+ return
+}
diff --git a/client/src/components/dashboard-module/EditAccountForm.tsx b/client/src/components/dashboard-module/EditAccountForm.tsx
index b7b0ea2f..fdd28140 100644
--- a/client/src/components/dashboard-module/EditAccountForm.tsx
+++ b/client/src/components/dashboard-module/EditAccountForm.tsx
@@ -102,7 +102,7 @@ export function EditAccountForm(props: Props) {
Name update('name', event.target.value)} required className={accountControlClass} />
-
Type update('type', event.target.value as AccountFormData['type'])} className={accountControlClass}>💵 Cash / Bank 📈 Investment
+
Type update('type', event.target.value as AccountFormData['type'])} className={accountControlClass}>Cash / Bank Investment
{(!quantity || value.asset_type === 'manual') &&
Currency update('currency', event.target.value)} className={accountControlClass}>
{[...new Set([...accountCurrencies, value.currency])].map(currency => {currency} )}
}
diff --git a/client/src/components/dashboard-module/RecurringTransactions.tsx b/client/src/components/dashboard-module/RecurringTransactions.tsx
index 5a4068a8..7105ce07 100644
--- a/client/src/components/dashboard-module/RecurringTransactions.tsx
+++ b/client/src/components/dashboard-module/RecurringTransactions.tsx
@@ -13,6 +13,7 @@ import { usePrivacy } from '../../context/PrivacyContext'
import { AmountInput } from '../common/amount-input'
import { formatAmount, parseAmount } from '../../lib/amount'
import { MINUS, formatDate, formatNumber } from '../../lib/format'
+import { CategoryIcon } from '../common/CategoryIcon'
// Helper function to convert Date to local YYYY-MM-DD string (no timezone conversion)
function toLocalDateString(date: Date): string {
@@ -1147,7 +1148,7 @@ export function RecurringTransactions({
Select category
{(formData.transaction_type === 'expense' ? expenseCategories : incomeCategories).map(cat => (
- {cat.icon} {cat.name}
+ {cat.name}
))}
@@ -1374,10 +1375,7 @@ export function RecurringTransactions({
{/* Main row */}
{/* Icon */}
- {category?.icon
- ?
{category.icon}
- :
🔄
- }
+
{/* Info — grows */}
@@ -1551,12 +1549,12 @@ export function RecurringTransactions({
>
{showAsIcon ? (
- {category?.icon || '📝'}
+
) : (
<>
- {category?.icon || ''}
+ {category?.icon && }
{privacyMode === 'hidden' ? '••' : formatNumber(Math.abs(tx.amount), {minimumFractionDigits: 0, maximumFractionDigits: 0})}
- {category?.icon || '📝'}
+
>
)}
diff --git a/client/src/components/dashboard-module/SplitLinesEditor.tsx b/client/src/components/dashboard-module/SplitLinesEditor.tsx
index e124664d..b999de60 100644
--- a/client/src/components/dashboard-module/SplitLinesEditor.tsx
+++ b/client/src/components/dashboard-module/SplitLinesEditor.tsx
@@ -75,7 +75,7 @@ export function SplitLinesEditor({ lines, resolution, currency, categories, disa
className={cn('h-9 text-[13px]', !line.category_id && 'text-muted-foreground')}
>
Category
- {categories.map(category =>
{category.icon} {category.name} )}
+ {categories.map(category =>
{category.name} )}
string
- getCategoryIcon: (id?: string | null) => string
+ getCategoryIcon: (id?: string | null) => React.ReactNode
getAccountName: (id: string) => string
getAccountCurrency: (id: string) => string
convertToMasterCurrency?: (amount: number, accountId: string) => number | null
@@ -339,7 +340,7 @@ function CalendarTransactionRow({
}: {
transaction: CalendarTransaction
nativeAmount: (value: number, accountId: string, compact?: boolean) => string
- getCategoryIcon: (id?: string | null) => string
+ getCategoryIcon: (id?: string | null) => React.ReactNode
}) {
const isTransfer = !!transaction.linked_transaction_id
const isIncome = transaction.amount >= 0 && !isTransfer
@@ -348,7 +349,7 @@ function CalendarTransactionRow({
return (
-
{isTransfer ? : getCategoryIcon(transaction.category_id)}
+
{isTransfer ? : getCategoryIcon(transaction.category_id)}
{sign}{nativeAmount(transaction.amount, transaction.account_id, true)}
)
diff --git a/client/src/components/dashboard-module/TransactionList.tsx b/client/src/components/dashboard-module/TransactionList.tsx
index 26137657..bb7adb08 100644
--- a/client/src/components/dashboard-module/TransactionList.tsx
+++ b/client/src/components/dashboard-module/TransactionList.tsx
@@ -28,6 +28,7 @@ import { getMcpReviewItems, hasPossibleDuplicateFlag, isMcpReviewTransaction } f
import { TransactionCalendar } from './TransactionCalendar'
import { TransferForm, type TransferAccount, type TransferFormData } from './TransferForm'
import { cn } from '../../lib/utils'
+import { CategoryIcon } from '../common/CategoryIcon'
type Transaction = TradeFacts & {
id: string
@@ -1124,11 +1125,7 @@ export function TransactionList({
return cat ? cat.name : 'Unknown'
}
- const getCategoryIcon = (id?: string | null) => {
- if (!id) return '📄'
- const cat = categories.find(c => c.id === id)
- return cat?.icon || '📄'
- }
+ const getCategoryIcon = (id?: string | null) => c.id === id)?.icon ?? '📄' : '📄'} />
const getAccountName = (id: string) => {
const acc = accounts.find(a => a.id === id)
@@ -1530,7 +1527,7 @@ export function TransactionList({
onChange({ category: e.target.value })} className="h-11 w-full min-w-0 sm:h-10 sm:w-auto text-base sm:text-[13px] sm:max-w-44">
All categories
{!['all', 'all-expenses', 'all-income', 'transfer'].includes(selectedCategory) && !categories.some(category => category.id === selectedCategory) && Selected category (unavailable) }
- {(['expense', 'income'] as const).map(type => {categories.filter(c => c.type === type).map(cat => {cat.icon} {cat.name} )} )}
+ {(['expense', 'income'] as const).map(type => {categories.filter(c => c.type === type).map(cat => {cat.name} )} )}
onChange({ account: value })}
label="Transaction account" className="w-full sm:w-52" selectClassName="h-11 text-base sm:h-10 sm:text-sm" />
@@ -1699,7 +1696,7 @@ export function TransactionList({
{categories
.filter(c => c.type === formData.type)
.map(c => (
- {c.icon} {c.name}
+ {c.name}
))}
}
diff --git a/client/src/components/settings-module/components/CategoriesCard.tsx b/client/src/components/settings-module/components/CategoriesCard.tsx
index 51012fae..133e7827 100644
--- a/client/src/components/settings-module/components/CategoriesCard.tsx
+++ b/client/src/components/settings-module/components/CategoriesCard.tsx
@@ -10,6 +10,7 @@ import { EMOJI_OPTIONS } from '../constants'
import type { Category } from '../types'
import { useSettingsMobile } from '../useSettingsMobile'
import { EmojiPicker } from './EmojiPicker'
+import { CategoryIcon, categoryIconLabel, distinctIconOptions } from '../../common/CategoryIcon'
type CategoryType = Category['type']
type Draft = { id?: string; name: string; icon: string; type: CategoryType }
@@ -173,9 +174,8 @@ export function CategoriesCard({
disabled={busy}
aria-expanded={picker === pickerId}
onClick={() => setPicker(picker === pickerId ? null : pickerId)}
- className="text-xl"
>
- {draft.icon}
+
{!inSheet && picker === pickerId && (
update({ ...draft, icon })} onClose={() => setPicker(null)} />
@@ -206,17 +206,17 @@ export function CategoriesCard({
)}
{inSheet && (
- {EMOJI_OPTIONS.map((icon, index) => (
+ {distinctIconOptions(EMOJI_OPTIONS).map((icon, index) => (
update({ ...draft, icon })}
- className={`h-10 rounded-lg text-xl hover:bg-accent ${draft.icon === icon ? 'bg-accent' : ''}`}
+ className={`flex h-10 items-center justify-center rounded-lg hover:bg-accent ${draft.icon === icon ? 'bg-accent text-primary' : ''}`}
>
- {icon}
+
))}
@@ -315,7 +315,7 @@ export function CategoriesCard({
deleteConfirmation
) : (
<>
- {category.icon || '📌'}
+
{category.name}
{!mobile && (
diff --git a/client/src/components/settings-module/components/EmojiPicker.tsx b/client/src/components/settings-module/components/EmojiPicker.tsx
index 4786cd5d..01c568e7 100644
--- a/client/src/components/settings-module/components/EmojiPicker.tsx
+++ b/client/src/components/settings-module/components/EmojiPicker.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef } from 'react'
import { EMOJI_OPTIONS } from '../constants'
+import { CategoryIcon, categoryIconLabel, distinctIconOptions } from '../../common/CategoryIcon'
export function EmojiPicker({
onChange,
@@ -28,7 +29,7 @@ export function EmojiPicker({
style={{ maxHeight: '300px', overflowY: 'auto' }}
>
- {EMOJI_OPTIONS.map((emoji, index) => (
+ {distinctIconOptions(EMOJI_OPTIONS).map((emoji, index) => (
- {emoji}
+
))}
From 7fcf42ae6370ac90d0d0f16824755b611c7f2829 Mon Sep 17 00:00:00 2001
From: 31b4
Date: Sun, 8 Nov 2026 19:49:02 +0100
Subject: [PATCH 5/8] Stack Analytics summary figures as rows on phones
---
.../analytics-module/SummaryCards.tsx | 42 +++++++++++++------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/client/src/components/analytics-module/SummaryCards.tsx b/client/src/components/analytics-module/SummaryCards.tsx
index 7ba897e8..5ebe8f4b 100644
--- a/client/src/components/analytics-module/SummaryCards.tsx
+++ b/client/src/components/analytics-module/SummaryCards.tsx
@@ -1,5 +1,6 @@
import { Card, CardContent } from '../common/card'
import { usePrivacy } from '../../context/PrivacyContext'
+import { useMediaQuery } from '../../hooks/useMediaQuery'
import { MINUS, formatNumber, formatSignedNumber } from '../../lib/format'
type SummaryCardsProps = {
@@ -15,6 +16,7 @@ const WHOLE = { minimumFractionDigits: 0, maximumFractionDigits: 0 }
export function SummaryCards({ totalIncome, totalExpenses, netFlow, masterCurrency }: SummaryCardsProps) {
const { privacyMode } = usePrivacy()
const hidden = privacyMode === 'hidden'
+ const compact = useMediaQuery('(max-width: 639px)')
const cards = [
{ label: 'Income', value: formatSignedNumber(totalIncome, WHOLE), tone: totalIncome > 0 ? 'text-success' : 'text-foreground' },
{ label: 'Expenses', value: `${totalExpenses > 0 ? MINUS : ''}${formatNumber(totalExpenses, WHOLE)}`, tone: totalExpenses > 0 ? 'text-destructive' : 'text-foreground' },
@@ -22,17 +24,33 @@ export function SummaryCards({ totalIncome, totalExpenses, netFlow, masterCurren
]
return (
-
- {cards.map(card => (
-
-
- {card.label}
-
- {hidden ? '••••••' : card.value} {masterCurrency}
-
-
-
- ))}
-
+ compact ? (
+ /* Phone: one grouped card with a row per figure, so long amounts never truncate. */
+
+
+ {cards.map(card => (
+
+
{card.label}
+
+ {hidden ? '••••••' : card.value} {masterCurrency}
+
+
+ ))}
+
+
+ ) : (
+
+ {cards.map(card => (
+
+
+ {card.label}
+
+ {hidden ? '••••••' : card.value} {masterCurrency}
+
+
+
+ ))}
+
+ )
)
}
From fcdca45305104939dc99f8cb25ee5e3471c09e83 Mon Sep 17 00:00:00 2001
From: 31b4
Date: Sun, 8 Nov 2026 19:48:27 +0100
Subject: [PATCH 6/8] Update tests for shared display formatting
---
.../analytics-module/NetWorthTrendChart.test.tsx | 2 +-
.../dashboard-module/AccountList.fx.test.tsx | 6 +++---
.../dashboard-module/AccountList.manage.test.tsx | 10 +++++-----
.../dashboard-module/AccountShortcuts.test.tsx | 6 +++---
.../RecurringTransactions.test.tsx | 14 +++++++-------
.../InvestmentChart.render.test.tsx | 2 +-
.../investments-module/InvestmentDetail.test.tsx | 6 +++---
.../PortfolioHistoryTooltip.test.tsx | 2 +-
.../investments-module/PortfolioSummary.test.tsx | 4 ++--
.../investments-module/TradeEditor.test.tsx | 4 ++--
.../holding-presentation.test.ts | 4 ++--
.../search-module/SearchPalette.test.tsx | 8 ++++----
client/src/lib/format.test.ts | 2 +-
client/src/navigation/routes.test.tsx | 2 +-
14 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/client/src/components/analytics-module/NetWorthTrendChart.test.tsx b/client/src/components/analytics-module/NetWorthTrendChart.test.tsx
index 45f1fa73..fad7d24e 100644
--- a/client/src/components/analytics-module/NetWorthTrendChart.test.tsx
+++ b/client/src/components/analytics-module/NetWorthTrendChart.test.tsx
@@ -106,7 +106,7 @@ describe('Cash Balance Trend comparison', () => {
render( )
toggle()
expect(screen.getByText('Mar 28 vs Feb 28 · latest shared day')).toBeInTheDocument()
- expect(screen.getAllByText('-100 HUF').length).toBeGreaterThan(0)
+ expect(screen.getAllByText('−100 HUF').length).toBeGreaterThan(0)
expect(screen.getByText('The previous month has no matching calendar day.')).toBeInTheDocument()
expect(screen.getByTestId('tooltip')).not.toHaveTextContent('%')
})
diff --git a/client/src/components/dashboard-module/AccountList.fx.test.tsx b/client/src/components/dashboard-module/AccountList.fx.test.tsx
index 4db02b18..ba04eb83 100644
--- a/client/src/components/dashboard-module/AccountList.fx.test.tsx
+++ b/client/src/components/dashboard-module/AccountList.fx.test.tsx
@@ -15,14 +15,14 @@ describe('account allocations with missing FX', () => {
{ id: 'eur', name: 'EUR account', type: 'cash', currency: 'EUR', balance: 100 },
]} onAccountAdded={vi.fn()} />)
expect(await screen.findByRole('alert')).toHaveTextContent('EUR')
- expect(screen.getByText('€100')).toBeInTheDocument()
- expect(screen.getByText('100 000,381 Ft')).toBeInTheDocument()
+ expect(screen.getByText('100 EUR')).toBeInTheDocument()
+ expect(screen.getByText('100 000,381 HUF')).toBeInTheDocument()
expect(screen.getByText('Allocation unavailable')).toBeInTheDocument()
expect(container).not.toHaveTextContent('NaN')
rates = { USD: 1, HUF: 360, EUR: 0.9 }
fireEvent.click(screen.getByRole('button', { name: 'Retry rates' }))
await waitFor(() => expect(screen.queryByRole('alert')).not.toBeInTheDocument())
expect(screen.queryByText('Allocation unavailable')).not.toBeInTheDocument()
- expect(screen.getByText('€100')).toBeInTheDocument()
+ expect(screen.getByText('100 EUR')).toBeInTheDocument()
})
})
diff --git a/client/src/components/dashboard-module/AccountList.manage.test.tsx b/client/src/components/dashboard-module/AccountList.manage.test.tsx
index ecc50d01..1dd23d43 100644
--- a/client/src/components/dashboard-module/AccountList.manage.test.tsx
+++ b/client/src/components/dashboard-module/AccountList.manage.test.tsx
@@ -350,10 +350,10 @@ describe('dedicated account management', () => {
is_locked: 1, exclude_from_net_worth: 1, exclude_from_cash_balance: 0 },
])) as ComponentProps['accounts']
render( )
- expect(screen.getByRole('button', { name: 'Edit Legacy cash' })).toHaveTextContent(/^Legacy cashCash \/ bank · HUF350 FtShare unavailable$/)
+ expect(screen.getByRole('button', { name: 'Edit Legacy cash' })).toHaveTextContent(/^Legacy cashCash \/ bank · HUF350 HUFShare unavailable$/)
const locked = screen.getByRole('button', { name: 'View Locked cash' })
expect(locked).toBeEnabled()
- expect(locked).toHaveTextContent(/^Locked cashCash \/ bank · HUFExcluded from net worth350 FtShare unavailable$/)
+ expect(locked).toHaveTextContent(/^Locked cashCash \/ bank · HUFExcluded from net worth350 HUFShare unavailable$/)
})
it('orders management groups by converted value while displaying native balances', async () => {
@@ -370,8 +370,8 @@ describe('dedicated account management', () => {
const editOrder = (group: typeof cashGroup) => group.getAllByRole('button', { name: /^Edit / }).map(button => button.getAttribute('aria-label'))
await waitFor(() => expect(editOrder(cashGroup)).toEqual(['Edit Euro cash', 'Edit Local cash']))
expect(editOrder(investmentGroup)).toEqual(['Edit Dollar asset', 'Edit Local asset'])
- expect(cashGroup.getByText('€100')).toBeInTheDocument()
- expect(cashGroup.getByText('30 000,381 Ft')).toBeInTheDocument()
+ expect(cashGroup.getByText('100 EUR')).toBeInTheDocument()
+ expect(cashGroup.getByText('30 000,381 HUF')).toBeInTheDocument()
})
it('does not require an archived currency rate for active account totals', async () => {
@@ -386,7 +386,7 @@ describe('dedicated account management', () => {
it('masks native values and never makes an archived account editable', () => {
privacy.hidden = true
open()
- expect(screen.queryByText('0 Ft')).not.toBeInTheDocument()
+ expect(screen.queryByText('0 HUF')).not.toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Old account, archived' }))
expect(screen.getByRole('dialog', { name: 'Edit account' })).toBeInTheDocument()
expect(screen.getByLabelText('Name')).toBeDisabled()
diff --git a/client/src/components/dashboard-module/AccountShortcuts.test.tsx b/client/src/components/dashboard-module/AccountShortcuts.test.tsx
index 421fa819..86154927 100644
--- a/client/src/components/dashboard-module/AccountShortcuts.test.tsx
+++ b/client/src/components/dashboard-module/AccountShortcuts.test.tsx
@@ -27,7 +27,7 @@ describe('compact sidebar account groups', () => {
const investmentGroup = within(screen.getByRole('region', { name: 'Investment account shortcuts' }))
expect(cashGroup.getAllByRole('link')).toHaveLength(7)
expect(investmentGroup.getAllByRole('link')).toHaveLength(4)
- expect(cashGroup.getAllByRole('link')[0]).toHaveTextContent('Cash 11.23M HUF')
+ expect(cashGroup.getAllByRole('link')[0]).toHaveTextContent('Cash 11,23M HUF')
expect(screen.queryByRole('button', { name: /Show all|Show top 3/ })).not.toBeInTheDocument()
expect(screen.getByRole('link', { name: 'Accounts', exact: true })).toHaveAttribute('href', '/accounts')
expect(screen.queryByRole('link', { name: /Manage accounts/ })).not.toBeInTheDocument()
@@ -48,7 +48,7 @@ describe('compact sidebar account groups', () => {
it('shows compact cash and investment money, with exact balances and quantities on hover', () => {
open()
- const cashLink = screen.getByRole('link', { name: 'Cash 1, 1.23M HUF' })
+ const cashLink = screen.getByRole('link', { name: 'Cash 1, 1,23M HUF' })
expect(cashLink).toHaveAttribute('title', expect.stringMatching(/1\s234\s567,89 HUF/))
const investmentLink = screen.getByRole('link', { name: 'Asset 1, 160K HUF' })
expect(investmentLink).toHaveAttribute('title', expect.stringContaining('Value: 160'))
@@ -59,7 +59,7 @@ describe('compact sidebar account groups', () => {
it('masks money and every tooltip quantity in privacy mode', () => {
privacy.hidden = true
const { container } = open()
- expect(container).not.toHaveTextContent('1.23M')
+ expect(container).not.toHaveTextContent('1,23M')
expect(container).not.toHaveTextContent('160K')
const links = within(screen.getByRole('region', { name: 'Cash account shortcuts' })).getAllByRole('link')
expect(links[0]).toHaveAttribute('title', 'Cash 1')
diff --git a/client/src/components/dashboard-module/RecurringTransactions.test.tsx b/client/src/components/dashboard-module/RecurringTransactions.test.tsx
index d8268f3f..45763880 100644
--- a/client/src/components/dashboard-module/RecurringTransactions.test.tsx
+++ b/client/src/components/dashboard-module/RecurringTransactions.test.tsx
@@ -50,15 +50,15 @@ describe('yearly recurring schedules', () => {
})
it.each([
- { month: 6, selected: '6', next: '07.31', expenses: '0', calendarCount: 0 },
- { month: 0, selected: '0', next: '2027.01.31', expenses: '0', calendarCount: 0 },
- { month: null, selected: '2', next: '03.31', expenses: '-25', calendarCount: 1 },
- { month: undefined, selected: '2', next: '03.31', expenses: '-25', calendarCount: 1 },
+ { month: 6, selected: '6', next: 'Jul 31', expenses: '0', calendarCount: 0 },
+ { month: 0, selected: '0', next: 'Jan 31, 2027', expenses: '0', calendarCount: 0 },
+ { month: null, selected: '2', next: 'Mar 31', expenses: '−25', calendarCount: 1 },
+ { month: undefined, selected: '2', next: 'Mar 31', expenses: '−25', calendarCount: 1 },
])('uses month $month for next date, upcoming impact, calendar and edit defaults', async ({ month, selected, next, expenses, calendarCount }) => {
vi.stubGlobal('fetch', vi.fn(async () => Response.json([{ ...yearly, month }])))
render( )
await screen.findByText('Annual bill')
- expect(screen.getByText(new RegExp(next.replaceAll('.', '\\.')))).toBeInTheDocument()
+ expect(screen.getByText(new RegExp(next))).toBeInTheDocument()
const expenseCard = screen.getByText('Next 30 Days Expenses').closest('.rounded-xl') as HTMLElement
expect(within(expenseCard).getByText(expenses)).toBeInTheDocument()
expect(screen.queryAllByTitle('Annual bill - Test cash - 25')).toHaveLength(calendarCount)
@@ -84,7 +84,7 @@ describe('yearly recurring schedules', () => {
fireEvent.click(screen.getByRole('button', { name: 'Update Schedule' }))
await waitFor(() => expect(screen.queryByText('Edit Recurring Schedule')).not.toBeInTheDocument())
expect(stored.month).toBe(0)
- expect(screen.getByText(/2027\.01\.31/)).toBeInTheDocument()
+ expect(screen.getByText(/Jan 31, 2027/)).toBeInTheDocument()
await openEdit()
expect(screen.getByLabelText('Month')).toHaveValue('0')
})
@@ -108,7 +108,7 @@ describe('yearly recurring schedules', () => {
vi.stubGlobal('fetch', vi.fn(async () => Response.json([{ ...yearly, month: 2 }])))
render( )
await screen.findByText('Annual bill')
- expect(screen.getByText(/03\.31/)).toBeInTheDocument()
+ expect(screen.getByText(/Mar 31/)).toBeInTheDocument()
expect(screen.getByTitle('Annual bill - Test cash - ••••')).toBeInTheDocument()
expect(screen.queryByTitle('Annual bill - Test cash - 25')).not.toBeInTheDocument()
})
diff --git a/client/src/components/investments-module/InvestmentChart.render.test.tsx b/client/src/components/investments-module/InvestmentChart.render.test.tsx
index 221b2bdb..c9ef0424 100644
--- a/client/src/components/investments-module/InvestmentChart.render.test.tsx
+++ b/client/src/components/investments-module/InvestmentChart.render.test.tsx
@@ -160,7 +160,7 @@ it('plots a continuous split-only series and adjusts trade dots without rewritin
await waitFor(()=>expect(plot.querySelectorAll('.recharts-scatter-symbol')).toHaveLength(2))
fireEvent.change(screen.getByRole('combobox',{name:'Read instrument history by date'}),{target:{value:'2021-07-19'}})
expect(screen.getByText('60,00 EUR')).toBeVisible()
- expect(screen.getByRole('list',{name:'Executions on 2021-07-19'})).toHaveTextContent('2400 EUR')
+ expect(screen.getByRole('list',{name:'Executions on 2021-07-19'})).toHaveTextContent(/2\s400 EUR/)
expect(JSON.stringify({history,trades})).toBe(original)
})
diff --git a/client/src/components/investments-module/InvestmentDetail.test.tsx b/client/src/components/investments-module/InvestmentDetail.test.tsx
index a839c7ad..a512e7e7 100644
--- a/client/src/components/investments-module/InvestmentDetail.test.tsx
+++ b/client/src/components/investments-module/InvestmentDetail.test.tsx
@@ -26,7 +26,7 @@ it('shows a manual total once, its known cost and last valuation, with Update va
const metrics=holdingMetrics(account,[],'HUF',undefined,(n,s,t)=>s===t?n:null,(n,s,t)=>s===t?n:null,'2026-01-15')
vi.stubGlobal('fetch',vi.fn().mockResolvedValue(Response.json({observations:[],valuation_at:null,next_cursor:null})))
render()
- expect(screen.getByRole('region',{name:'Holding summary'})).toHaveTextContent(/1200\s*HUF/);expect(screen.getByText('Remaining cost').parentElement).toHaveTextContent('1000 HUF')
+ expect(screen.getByRole('region',{name:'Holding summary'})).toHaveTextContent(/1\s200\s*HUF/);expect(screen.getByText('Remaining cost').parentElement).toHaveTextContent(/1\s000 HUF/)
expect(screen.getByRole('button',{name:'Update value'})).toBeEnabled();expect(screen.queryByRole('button',{name:'Buy',exact:true})).not.toBeInTheDocument();expect(screen.queryByRole('button',{name:'Sell',exact:true})).not.toBeInTheDocument()
expect(await screen.findByText(/Last valued 2026-01-10/)).toBeVisible()
})
@@ -80,13 +80,13 @@ it('pairs labeled holding gain with its supported percentage and masks both in p
const {rerender}=render()
const summary=within(screen.getByRole('region',{name:'Holding summary'}))
expect(summary.getByText('Position value')).toBeVisible()
- expect(screen.getByRole('region',{name:'Holding summary'})).toHaveTextContent(/1200\s*HUF/)
+ expect(screen.getByRole('region',{name:'Holding summary'})).toHaveTextContent(/1\s200\s*HUF/)
expect(summary.getByText('total gain')).toBeVisible()
expect(summary.getByText('+200 HUF')).toBeVisible()
expect(summary.getByTitle('Gain on net invested')).toHaveTextContent('+20%')
rerender()
expect(summary.queryByTitle('Gain on net invested')).not.toBeInTheDocument()
rerender( )
- expect(summary.queryByText(/1200 HUF|200 HUF|20%/)).not.toBeInTheDocument()
+ expect(summary.queryByText(/1\s200\s*HUF|200\s*HUF|20%/)).not.toBeInTheDocument()
expect(summary.getByTitle('Gain on net invested')).toHaveTextContent('••••••')
})
diff --git a/client/src/components/investments-module/PortfolioHistoryTooltip.test.tsx b/client/src/components/investments-module/PortfolioHistoryTooltip.test.tsx
index 8b6910b5..bd9fddce 100644
--- a/client/src/components/investments-module/PortfolioHistoryTooltip.test.tsx
+++ b/client/src/components/investments-module/PortfolioHistoryTooltip.test.tsx
@@ -4,7 +4,7 @@ import type {PortfolioHistoryPoint} from '../../../../shared/investment-history-
import {PortfolioHistoryTooltip} from './PortfolioHistoryTooltip'
const point=(value:number|null,invested:number|null):PortfolioHistoryPoint=>({date:'2026-10-03',value,net_invested:invested,contribution:0,withdrawal:0,provisional:false,event:false,coverage:'complete',price_as_of_oldest:'2026-10-02',price_as_of_latest:'2026-10-02',fx_as_of_oldest:'2026-10-02',fx_as_of_latest:'2026-10-02'})
afterEach(cleanup)
-it.each([[1200,1000,'+200 EUR','+20%'],[800,1000,'-200 EUR','-20%'],[1000,1000,'0 EUR','0%']])('shows selected-day total gain and its ratio (%s)',(value,invested,gain,percent)=>{
+it.each([[1200,1000,'+200 EUR','+20%'],[800,1000,'−200 EUR','−20%'],[1000,1000,'0 EUR','0%']])('shows selected-day total gain and its ratio (%s)',(value,invested,gain,percent)=>{
render( )
expect(screen.getByText(gain)).toBeVisible();expect(screen.getByText(percent)).toBeVisible()
expect(document.querySelector('time')).toHaveAttribute('dateTime','2026-10-03')
diff --git a/client/src/components/investments-module/PortfolioSummary.test.tsx b/client/src/components/investments-module/PortfolioSummary.test.tsx
index 2d5e0106..3c55d9fa 100644
--- a/client/src/components/investments-module/PortfolioSummary.test.tsx
+++ b/client/src/components/investments-module/PortfolioSummary.test.tsx
@@ -14,7 +14,7 @@ afterEach(cleanup)
it.each([[-100,-10],[100,10],[0,0]])('shows gain % on net invested without substituting the daily-linked estimate (%s)',(gain,percent)=>{
render( )
- expect(total().getByText(`${percent>0?'+':''}${percent}% · Gain on net invested`)).toBeVisible()
+ expect(total().getByText(`${percent>0?'+':''}${String(percent).replace('-','−')}% · Gain on net invested`)).toBeVisible()
expect(total().queryByText('Estimated return unavailable')).not.toBeInTheDocument()
expect(screen.getByText('+1% estimated')).toBeVisible()
})
@@ -28,7 +28,7 @@ it('recomputes from the selected currency amounts and masks percentage and money
const {rerender}=render( )
expect(total().getByText('+20% · Gain on net invested')).toBeVisible()
rerender( )
- expect(total().getByText('-5% · Gain on net invested')).toBeVisible()
+ expect(total().getByText('−5% · Gain on net invested')).toBeVisible()
rerender( )
expect(total().queryByText(/-5%|-10 USD/)).not.toBeInTheDocument()
expect(total().getByTitle(/Total gain divided by net invested/)).toHaveTextContent('••••')
diff --git a/client/src/components/investments-module/TradeEditor.test.tsx b/client/src/components/investments-module/TradeEditor.test.tsx
index b17105d4..36f386dd 100644
--- a/client/src/components/investments-module/TradeEditor.test.tsx
+++ b/client/src/components/investments-module/TradeEditor.test.tsx
@@ -20,7 +20,7 @@ it('requires actual cross-currency confirmation, previews exact cash, and keeps
render( );fill()
const button=screen.getByRole('button',{name:'Record purchase'})
await waitFor(()=>expect(button).toBeEnabled())
- expect(screen.getByText(/Cash balance after: -1\s?500 HUF/)).toBeVisible()
+ expect(screen.getByText(/Cash balance after: −1\s500 HUF/)).toBeVisible()
expect(screen.getByText(/permits a negative cash balance/)).toBeVisible()
fireEvent.click(button)
await waitFor(()=>expect(saved).toHaveBeenCalledOnce())
@@ -34,7 +34,7 @@ it('shows the read-only review before the final settlement confirmation and keep
for(const [label,value] of [['Quantity','0,123456789012'],['Executed unit price','50'],['Fee (HUF)','400'],['Actual cash paid (HUF)','2500']])fireEvent.change(screen.getByLabelText(label),{target:{value}})
const checkbox=screen.getByRole('checkbox',{name:/actual cash settlement, including fees/})
const save=screen.getByRole('button',{name:'Record purchase'})
- await waitFor(()=>expect(screen.getByText(/Cash balance after: -1\s?500 HUF/)).toBeVisible())
+ await waitFor(()=>expect(screen.getByText(/Cash balance after: −1\s500 HUF/)).toBeVisible())
expect(checkbox).not.toBeChecked();expect(save).toBeDisabled()
expect(screen.getByText('Required before saving')).toBeVisible()
const review=screen.getByRole('region',{name:'Exact trade totals'})
diff --git a/client/src/components/investments-module/holding-presentation.test.ts b/client/src/components/investments-module/holding-presentation.test.ts
index 454e01d1..5162baa8 100644
--- a/client/src/components/investments-module/holding-presentation.test.ts
+++ b/client/src/components/investments-module/holding-presentation.test.ts
@@ -3,8 +3,8 @@ import {holdingSourceTime} from './holding-presentation'
it('formats intraday prices compactly and keeps calendar-day valuations on their original date',()=>{
const now=new Date(2026,9,19,12)
const intraday=new Date(2026,9,19,10,15).toISOString()
- expect(holdingSourceTime(intraday,now)?.short).toBe(new Intl.DateTimeFormat(undefined,{hour:'2-digit',minute:'2-digit'}).format(new Date(intraday)))
- expect(holdingSourceTime('2026-10-16',now)?.short).toBe(new Intl.DateTimeFormat(undefined,{month:'short',day:'numeric'}).format(new Date(2026,9,16,12)))
+ expect(holdingSourceTime(intraday,now)?.short).toBe('10:15')
+ expect(holdingSourceTime('2026-10-16',now)?.short).toBe('Oct 16')
expect(holdingSourceTime(new Date(2025,9,16,10,15).toISOString(),now)?.short).toContain('2025')
expect(holdingSourceTime('invalid',now)).toBeNull();expect(holdingSourceTime(null,now)).toBeNull()
})
diff --git a/client/src/components/search-module/SearchPalette.test.tsx b/client/src/components/search-module/SearchPalette.test.tsx
index 8e470406..0423d3da 100644
--- a/client/src/components/search-module/SearchPalette.test.tsx
+++ b/client/src/components/search-module/SearchPalette.test.tsx
@@ -73,9 +73,9 @@ describe('Search everything palette', () => {
const input = screen.getByRole('combobox')
fireEvent.change(input, { target: { value: 'Netflix' } })
expect(screen.getByRole('option', { name: /View all matching transactions \(9\)/ })).toBeInTheDocument()
- fireEvent.click(screen.getByRole('option', { name: /^Netflix.*2020-01-08/ }))
+ fireEvent.click(screen.getByRole('option', { name: /^Netflix.*Jan 8, 2020/ }))
expect(screen.getByRole('button', { name: 'Back to results' })).toHaveFocus()
- expect(screen.getByText('2020-01-08')).toBeInTheDocument()
+ expect(screen.getByText('Jan 8, 2020')).toBeInTheDocument()
expect(screen.getByText('Posted')).toBeInTheDocument()
expect(screen.queryByRole('button', { name: /Save/ })).not.toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Back to results' }))
@@ -106,11 +106,11 @@ describe('Search everything palette', () => {
open(data)
fireEvent.change(screen.getByRole('combobox'), { target: { value: 'Netflix' } })
expect(screen.queryByText(/2\s*990/)).not.toBeInTheDocument()
- expect(screen.getByRole('option', { name: /^Netflix.*2020-01-08/ })).toHaveTextContent('••••••')
+ expect(screen.getByRole('option', { name: /^Netflix.*Jan 8, 2020/ })).toHaveTextContent('••••••')
fireEvent.click(screen.getByRole('button', { name: 'Retry search data' }))
expect(refresh).toHaveBeenCalledOnce()
expect(await screen.findByRole('button', { name: 'Retry recurring search' })).toBeInTheDocument()
- fireEvent.click(screen.getByRole('option', { name: /^Netflix.*2020-01-08/ }))
+ fireEvent.click(screen.getByRole('option', { name: /^Netflix.*Jan 8, 2020/ }))
expect(screen.getByText('••••••')).toBeInTheDocument()
})
it('does not misrepresent unavailable complete history as an empty search', () => {
diff --git a/client/src/lib/format.test.ts b/client/src/lib/format.test.ts
index 98d09745..4895776f 100644
--- a/client/src/lib/format.test.ts
+++ b/client/src/lib/format.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { formatCompactNumber, formatDate, formatDateTime, formatMoney, formatNumber, formatPercent, formatSignedNumber, formatTime, MINUS } from './format'
-const plain = (value: string) => value.replace(/[ ]/g, ' ')
+const plain = (value: string) => value.replace(/[\u00a0\u202f]/g, ' ')
describe('shared display formatting', () => {
it('groups every value, including four digits, with a decimal comma and a true minus', () => {
diff --git a/client/src/navigation/routes.test.tsx b/client/src/navigation/routes.test.tsx
index b9240006..c30e7a84 100644
--- a/client/src/navigation/routes.test.tsx
+++ b/client/src/navigation/routes.test.tsx
@@ -105,7 +105,7 @@ it('searches older history and carries the query into the all-time transaction w
const { router } = open('/dashboard')
fireEvent.click(screen.getAllByRole('button', { name: 'Search everything' })[0])
fireEvent.change(screen.getByRole('combobox', { name: 'Search everything' }), { target: { value: 'Netflix' } })
- expect(await screen.findByRole('option', { name: /Netflix.*2020-01-05/ })).toBeInTheDocument()
+ expect(await screen.findByRole('option', { name: /Netflix.*Jan 5, 2020/ })).toBeInTheDocument()
fireEvent.click(screen.getByRole('option', { name: 'View all matching transactions (1)' }))
await waitFor(() => expect(href(router)).toBe('/dashboard?range=allTime'))
expect(await screen.findByPlaceholderText('Search transactions...')).toHaveValue('Netflix')
From 18a66af876d915532cf5fada6c968241c96150f2 Mon Sep 17 00:00:00 2001
From: 31b4
Date: Sun, 8 Nov 2026 19:53:01 +0100
Subject: [PATCH 7/8] Format percentages through the shared formatter
---
.../CashBalanceComparisonChart.tsx | 4 ++--
.../analytics-module/CategoryBreakdownChart.tsx | 2 +-
.../components/analytics-module/ExpensesChart.tsx | 8 +++-----
.../analytics-module/IncomeBreakdownChart.tsx | 2 +-
.../components/analytics-module/IncomeChart.tsx | 8 +++-----
.../analytics-module/NetWorthTrendChart.test.tsx | 8 ++++----
client/src/components/common/CategoryIcon.tsx | 5 +++--
.../common/interactive-area-chart.test.tsx | 2 +-
.../components/common/interactive-area-chart.tsx | 4 ++--
.../dashboard-module/AccountList.manage.test.tsx | 8 ++++----
.../components/dashboard-module/AccountList.tsx | 12 ++++++------
.../dashboard-module/AccountShortcuts.test.tsx | 14 +++++++-------
.../dashboard-module/AccountShortcuts.tsx | 4 ++--
.../dashboard-module/TransactionList.test.tsx | 2 +-
.../components/dashboard-module/TransferForm.tsx | 3 ++-
15 files changed, 42 insertions(+), 44 deletions(-)
diff --git a/client/src/components/analytics-module/CashBalanceComparisonChart.tsx b/client/src/components/analytics-module/CashBalanceComparisonChart.tsx
index bbbe26cc..d76fdebe 100644
--- a/client/src/components/analytics-module/CashBalanceComparisonChart.tsx
+++ b/client/src/components/analytics-module/CashBalanceComparisonChart.tsx
@@ -29,7 +29,7 @@ function ComparisonReadout({ point, currency, unit }: { point: CashBalanceCompar
)}
{delta &&
Difference:
- {amount(delta.amount, true)}{!hidden && delta.percentage !== null ? ` (${delta.percentage > 0 ? '+' : ''}${delta.percentage.toFixed(1)}%)` : ''}
+ {amount(delta.amount, true)}{!hidden && delta.percentage !== null ? ` (${delta.percentage > 0 ? '+' : ''}${formatNumber(delta.percentage, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%)` : ''}
}
{point.selected === null && point.previous !== null && Only the previous {unit} has an actual balance on this day.
}
{point.previous === null && point.selected !== null && The previous {unit} has no matching calendar day.
}
@@ -82,7 +82,7 @@ export function CashBalanceComparisonChart({ comparison, currency, title, contro
{/* One line, like the balance readout, so the card height never changes. */}
- {delta && !hidden && delta.percentage !== null && = 0 ? 'easyui-chart-positive' : 'easyui-chart-negative'}>{delta.percentage > 0 ? '+' : ''}{delta.percentage.toFixed(1)}% }
+ {delta && !hidden && delta.percentage !== null && = 0 ? 'easyui-chart-positive' : 'easyui-chart-negative'}>{delta.percentage > 0 ? '+' : ''}{formatNumber(delta.percentage, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}% }
{delta && latestCommon
? `${format(parseISO(latestCommon.selectedDate!), 'MMM d')} vs ${format(parseISO(latestCommon.previousDate!), 'MMM d')} · latest shared day`
: 'No shared day to compare yet'}
diff --git a/client/src/components/analytics-module/CategoryBreakdownChart.tsx b/client/src/components/analytics-module/CategoryBreakdownChart.tsx
index cf88845b..b81916e9 100644
--- a/client/src/components/analytics-module/CategoryBreakdownChart.tsx
+++ b/client/src/components/analytics-module/CategoryBreakdownChart.tsx
@@ -82,7 +82,7 @@ export const CategoryBreakdownChart = memo(function CategoryBreakdownChart({ dat
{privacyMode === 'hidden' ? '••••••' : formatNumber(cat.value, {minimumFractionDigits: 0, maximumFractionDigits: 0})}
- ({privacyMode === 'hidden' ? '••' : cat.percentage.toFixed(1)}%)
+ ({privacyMode === 'hidden' ? '••' : formatNumber(cat.percentage, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%)
diff --git a/client/src/components/analytics-module/ExpensesChart.tsx b/client/src/components/analytics-module/ExpensesChart.tsx
index fd30794a..5f3f8358 100644
--- a/client/src/components/analytics-module/ExpensesChart.tsx
+++ b/client/src/components/analytics-module/ExpensesChart.tsx
@@ -5,7 +5,7 @@ import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContaine
import { usePrivacy } from '../../context/PrivacyContext'
import { CustomSelect } from './CustomSelect'
import type { ChartDataPoint, Category } from './types'
-import { formatNumber } from '../../lib/format'
+import { formatCompactNumber, formatNumber } from '../../lib/format'
type ExpensesChartProps = {
data: ChartDataPoint[]
@@ -69,9 +69,7 @@ export const ExpensesChart = memo(function ExpensesChart({ data, selectedCategor
axisLine={false}
tickFormatter={(value) => {
if (privacyMode === 'hidden') return '••••'
- if (value >= 1000000) return `${(value / 1000000).toFixed(1)}M`
- if (value >= 1000) return `${(value / 1000).toFixed(0)}K`
- return value.toFixed(0)
+ return formatCompactNumber(value, value >= 1000000 ? 1 : 0)
}}
width={50}
/>
@@ -95,7 +93,7 @@ export const ExpensesChart = memo(function ExpensesChart({ data, selectedCategor
{change !== null && changePercent !== null && (
= 0 ? 'text-destructive' : 'text-success'} ${privacyMode === 'hidden' ? 'select-none' : ''}`}>
- {privacyMode === 'hidden' ? '••••' : `${change >= 0 ? '+' : ''}${formatNumber(change, {minimumFractionDigits: 0, maximumFractionDigits: 0})} (${changePercent >= 0 ? '+' : ''}${changePercent.toFixed(1)}%)`}
+ {privacyMode === 'hidden' ? '••••' : `${change >= 0 ? '+' : ''}${formatNumber(change, {minimumFractionDigits: 0, maximumFractionDigits: 0})} (${changePercent >= 0 ? '+' : ''}${formatNumber(changePercent, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%)`}
)}
diff --git a/client/src/components/analytics-module/IncomeBreakdownChart.tsx b/client/src/components/analytics-module/IncomeBreakdownChart.tsx
index cf2b17cd..1da0386c 100644
--- a/client/src/components/analytics-module/IncomeBreakdownChart.tsx
+++ b/client/src/components/analytics-module/IncomeBreakdownChart.tsx
@@ -82,7 +82,7 @@ export const IncomeBreakdownChart = memo(function IncomeBreakdownChart({ data, m
{privacyMode === 'hidden' ? '••••••' : formatNumber(cat.value, {minimumFractionDigits: 0, maximumFractionDigits: 0})}
- ({privacyMode === 'hidden' ? '••' : cat.percentage.toFixed(1)}%)
+ ({privacyMode === 'hidden' ? '••' : formatNumber(cat.percentage, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%)
diff --git a/client/src/components/analytics-module/IncomeChart.tsx b/client/src/components/analytics-module/IncomeChart.tsx
index 880ab210..fc76e6cd 100644
--- a/client/src/components/analytics-module/IncomeChart.tsx
+++ b/client/src/components/analytics-module/IncomeChart.tsx
@@ -5,7 +5,7 @@ import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContaine
import { usePrivacy } from '../../context/PrivacyContext'
import { CustomSelect } from './CustomSelect'
import type { ChartDataPoint, Category } from './types'
-import { formatNumber } from '../../lib/format'
+import { formatCompactNumber, formatNumber } from '../../lib/format'
type IncomeChartProps = {
data: ChartDataPoint[]
@@ -69,9 +69,7 @@ export const IncomeChart = memo(function IncomeChart({ data, selectedCategory, o
axisLine={false}
tickFormatter={(value) => {
if (privacyMode === 'hidden') return '••••'
- if (value >= 1000000) return `${(value / 1000000).toFixed(1)}M`
- if (value >= 1000) return `${(value / 1000).toFixed(0)}K`
- return value.toFixed(0)
+ return formatCompactNumber(value, value >= 1000000 ? 1 : 0)
}}
width={50}
/>
@@ -95,7 +93,7 @@ export const IncomeChart = memo(function IncomeChart({ data, selectedCategory, o
{change !== null && changePercent !== null && (
= 0 ? 'text-success' : 'text-destructive'} ${privacyMode === 'hidden' ? 'select-none' : ''}`}>
- {privacyMode === 'hidden' ? '••••' : `${change >= 0 ? '+' : ''}${formatNumber(change, {minimumFractionDigits: 0, maximumFractionDigits: 0})} (${changePercent >= 0 ? '+' : ''}${changePercent.toFixed(1)}%)`}
+ {privacyMode === 'hidden' ? '••••' : `${change >= 0 ? '+' : ''}${formatNumber(change, {minimumFractionDigits: 0, maximumFractionDigits: 0})} (${changePercent >= 0 ? '+' : ''}${formatNumber(changePercent, { minimumFractionDigits: 1, maximumFractionDigits: 1 })}%)`}