mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-30 15:48:37 +00:00
- Add global currency store (sat/msat/usd) - Add currency toggle to site header - Update currency formatting logic (integers for sats, 2 decimals for USD) - Connect dashboard and balances pages to global currency state
22 lines
469 B
TypeScript
22 lines
469 B
TypeScript
import { create } from 'zustand';
|
|
import { persist } from 'zustand/middleware';
|
|
import type { DisplayUnit } from '@/lib/types/units';
|
|
|
|
interface CurrencyState {
|
|
displayUnit: DisplayUnit;
|
|
setDisplayUnit: (unit: DisplayUnit) => void;
|
|
}
|
|
|
|
export const useCurrencyStore = create<CurrencyState>()(
|
|
persist(
|
|
(set) => ({
|
|
displayUnit: 'sat',
|
|
setDisplayUnit: (unit) => set({ displayUnit: unit }),
|
|
}),
|
|
{
|
|
name: 'currency-storage',
|
|
}
|
|
)
|
|
);
|
|
|