Skip to content

Commit 146ceb5

Browse files
author
root
committed
fix(web): resolve build regressions
1 parent e13490f commit 146ceb5

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

apps/web/src/components/activity/ActivityFeed.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client';
22

3+
import type { JSX } from 'react';
34
import { useEffect, useMemo, useState } from 'react';
45
import { ActivityDto, GroupDto } from '@fairshare/shared-types';
56
import { ActivitySquare, BadgeCheck, Clock3, Mail, Receipt, RefreshCw, UsersRound } from 'lucide-react';
@@ -48,7 +49,8 @@ function labelFor(activity: ActivityDto): string {
4849
function formatAmount(activity: ActivityDto): string | null {
4950
const cents = activity.metadata?.amountCents ?? activity.metadata?.totalAmountCents;
5051
if (!cents) return null;
51-
return (Number(cents) / 100).toLocaleString(undefined, { style: 'currency', currency: activity.metadata?.currency ?? 'USD' });
52+
const currency = typeof activity.metadata?.currency === 'string' ? activity.metadata.currency : 'USD';
53+
return (Number(cents) / 100).toLocaleString(undefined, { style: 'currency', currency });
5254
}
5355

5456
function timeAgo(iso: string): string {

apps/web/src/components/settings/AppearanceSettings.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client';
22

3+
import type { JSX } from 'react';
34
import { Laptop, Moon, Sun } from 'lucide-react';
45
import { useThemeMode } from '../theme/ThemeProvider';
56

apps/web/src/components/theme/ThemeProvider.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
3434
const [resolved, setResolved] = useState<ResolvedTheme>('light');
3535

3636
useEffect(() => {
37-
const stored = (typeof window !== 'undefined' && (localStorage.getItem(STORAGE_KEY) as ThemeMode | null)) ?? 'system';
37+
const readStored = (): ThemeMode => {
38+
if (typeof window === 'undefined') return 'system';
39+
const raw = localStorage.getItem(STORAGE_KEY);
40+
return raw === 'light' || raw === 'dark' || raw === 'system' ? raw : 'system';
41+
};
42+
43+
const stored = readStored();
3844
setModeState(stored);
3945
setResolved(applyTheme(stored));
4046
}, []);

0 commit comments

Comments
 (0)