refactor: rename getLogo to currencySymbol

This commit is contained in:
theborakompanioni 2025-10-10 11:02:16 +02:00
parent d953e83433
commit 2911172e06
No known key found for this signature in database
GPG key ID: E8070AF0053AAC0D
5 changed files with 12 additions and 10 deletions

View file

@ -15,7 +15,7 @@ export default function JamLanding() {
toggleDisplayMode,
isPrivate,
formatAmount,
getLogo,
currencySymbol,
jars,
totalBalance,
isLoading,
@ -40,7 +40,7 @@ export default function JamLanding() {
>
{formatAmount(totalBalance)}{' '}
</span>
<span className="flex min-h-[48px] items-center">{getLogo('lg')}</span>
<span className="flex min-h-[48px] items-center">{currencySymbol('lg')}</span>
</div>
)}
</div>

View file

@ -17,7 +17,7 @@ interface NavbarProps {
theme: string
toggleTheme: () => void
formatAmount: (amount: number) => string
getLogo: (size: 'sm' | 'lg') => React.ReactNode
currencySymbol: (size: 'sm' | 'lg') => React.ReactNode
jars: Jar[]
isLoading?: boolean
}
@ -37,7 +37,7 @@ const WithActivityIndicator = ({ active, children }: PropsWithChildren<{ active:
)
}
export function Navbar({ theme, toggleTheme, formatAmount, getLogo, jars, isLoading = false }: NavbarProps) {
export function Navbar({ theme, toggleTheme, formatAmount, currencySymbol, jars, isLoading = false }: NavbarProps) {
const { t } = useTranslation()
const navigate = useNavigate()
const jmSessionState = useStore(jmSessionStore, (state) => state.state)
@ -71,7 +71,7 @@ export function Navbar({ theme, toggleTheme, formatAmount, getLogo, jars, isLoad
) : (
<>
<div className="tabular-nums">{formatAmount(totalBalance)}</div>
{getLogo('sm')}
{currencySymbol('sm')}
</>
)}
</div>

View file

@ -26,7 +26,9 @@ export function Layout({ children }: LayoutProps) {
togglePrivacyMode,
toggleDisplayMode,
formatAmount,
getLogo: (size: 'sm' | 'lg' = 'lg') => <CurrencySymbol currency={currency} isPrivate={isPrivate} size={size} />,
currencySymbol: (size: 'sm' | 'lg' = 'lg') => (
<CurrencySymbol currency={currency} isPrivate={isPrivate} size={size} />
),
jars,
totalBalance,
walletName,
@ -42,7 +44,7 @@ export function Layout({ children }: LayoutProps) {
theme={resolvedTheme || 'dark'}
toggleTheme={toggleTheme}
formatAmount={formatAmount}
getLogo={(size) => <CurrencySymbol currency={currency} isPrivate={isPrivate} size={size} />}
currencySymbol={displayModeValue.currencySymbol}
jars={jars}
isLoading={isLoading}
/>

View file

@ -29,7 +29,7 @@ export interface DisplayModeContextType {
togglePrivacyMode: () => void
toggleDisplayMode: () => void
formatAmount: (amount: number) => string
getLogo: (size?: 'sm' | 'lg') => ReactNode
currencySymbol: (size?: 'sm' | 'lg') => ReactNode
jars: Jar[]
totalBalance: number
walletName: string | null

View file

@ -21,7 +21,7 @@ export default meta
type Story = StoryObj<typeof Navbar>
const mockFormatAmount = (amount: number) => `${amount} sats`
const mockGetLogo = (size: 'sm' | 'lg') => <Bitcoin size={size === 'sm' ? 18 : 32} />
const mockCurrencySymbol = (size: 'sm' | 'lg') => <Bitcoin size={size === 'sm' ? 18 : 32} />
const mockJars = [
{ name: 'Apricot', balance: 12345, color: '#e2b86a' as JarColor },
{ name: 'Blueberry', balance: 67890, color: '#3b5ba9' as JarColor },
@ -32,7 +32,7 @@ export const Default: Story = {
theme: 'light',
toggleTheme: () => alert('Theme toggled!'),
formatAmount: mockFormatAmount,
getLogo: mockGetLogo,
currencySymbol: mockCurrencySymbol,
jars: mockJars,
},
}