first day of vibe coding

This commit is contained in:
k
2026-04-20 22:11:18 +08:00
commit 1747fc489f
38 changed files with 15267 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import { create } from 'zustand'
interface DashboardState {
selectedPostId: number | null
asset: 'BTC' | 'ETH'
timeframe: '5m' | '15m' | '1H' | '4H' | '1D' | '1W'
walletAddress: string | null
isSubscribed: boolean
livePrices: { BTC: number | null; ETH: number | null }
setSelectedPost: (id: number | null) => void
setAsset: (asset: 'BTC' | 'ETH') => void
setTimeframe: (tf: '5m' | '15m' | '1H' | '4H' | '1D' | '1W') => void
setWallet: (address: string | null) => void
setSubscribed: (subscribed: boolean) => void
setLivePrice: (asset: 'BTC' | 'ETH', price: number) => void
}
export const useDashboardStore = create<DashboardState>((set) => ({
selectedPostId: null,
asset: 'BTC',
timeframe: '4H',
walletAddress: null,
isSubscribed: false,
livePrices: { BTC: null, ETH: null },
setSelectedPost: (id) => set({ selectedPostId: id }),
setAsset: (asset) => set({ asset }),
setTimeframe: (timeframe) => set({ timeframe }),
setWallet: (walletAddress) => set({ walletAddress }),
setSubscribed: (isSubscribed) => set({ isSubscribed }),
setLivePrice: (asset, price) =>
set((s) => ({ livePrices: { ...s.livePrices, [asset]: price } })),
}))