2f7b266e6b
* MP-1674: replaced the logo and added dekstop only nav * MP-1677: borrowCapacity implemented into the SubAccount Nav * MP-1677: adjusted the SubAccount navigation * M1677: fixed the button and SearchInput component * MP-1674: fixed the NavLink component * MP-1674: fixed the SubAccount navigation * tidy: cleaning up the trading view * MP-1674: added withdraw and funding functions * MP-1674: worked on the AccountStats * MP-1671: modal work * MP-1647: improvised CreditAccount expander * tidy: fixed the page structure * MP-1758: finished the SearchInput layout * MP-1759: updated the semicircle graphs * MP-1759: SemiCircle to Gauge * fix: implemented animated numbers * tidy: refactor * MP-1759: added Tooltip to the Gauge * fix: replace animate={true} with animate * fix: fixed the Gauge timing * fix: updated the BorrowCapacity styles * fix: renamed SubAccount to Account * fix: Text should not be a button, Button should be * tidy: format * fix: Text no clicky * fix: replaced all the Text appearances with onClick
38 lines
890 B
TypeScript
38 lines
890 B
TypeScript
import create from 'zustand'
|
|
import { persist } from 'zustand/middleware'
|
|
|
|
interface CreditManagerStore {
|
|
isOpen: boolean
|
|
selectedAccount: string | null
|
|
actions: {
|
|
toggleCreditManager: () => void
|
|
setSelectedAccount: (id: string) => void
|
|
}
|
|
}
|
|
|
|
const useCreditManagerStore = create<CreditManagerStore>()(
|
|
persist(
|
|
(set, get) => ({
|
|
isOpen: true,
|
|
selectedAccount: null,
|
|
actions: {
|
|
toggleCreditManager: () => set(() => ({ isOpen: !get().isOpen })),
|
|
setSelectedAccount: (accountId: string) => {
|
|
set(() => ({
|
|
selectedAccount: accountId,
|
|
}))
|
|
},
|
|
},
|
|
}),
|
|
{
|
|
name: 'creditManager',
|
|
partialize: (state) =>
|
|
Object.fromEntries(
|
|
Object.entries(state).filter(([key]) => ['selectedAccount'].includes(key)),
|
|
),
|
|
},
|
|
),
|
|
)
|
|
|
|
export default useCreditManagerStore
|