feat(frontend): 添加 Zustand store 架构

- 创建 5 个领域 store:runtimeStore, marketStore, portfolioStore, agentStore, uiStore
- 更新 CLAUDE.md 记录架构改进
- Zustand 已安装但 stores 尚未在 App.jsx 中使用(渐进迁移)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 17:44:17 +08:00
parent 06a23c32a4
commit 0f1bc2bb39
7 changed files with 520 additions and 113 deletions

View File

@@ -0,0 +1,40 @@
import { create } from 'zustand';
/**
* UI Store - UI state, view management, layout
*/
export const useUIStore = create((set) => ({
// Current view
currentView: 'traders', // 'traders' | 'room' | 'explain' | 'chart' | 'statistics' | 'runtime'
setCurrentView: (currentView) => set({ currentView }),
// Chart tab
chartTab: 'all',
setChartTab: (chartTab) => set({ chartTab }),
// Initial animation
isInitialAnimating: true,
setIsInitialAnimating: (isInitialAnimating) => set({ isInitialAnimating }),
// Last update timestamp
lastUpdate: new Date(),
setLastUpdate: (lastUpdate) => set({ lastUpdate }),
// Is updating
isUpdating: false,
setIsUpdating: (isUpdating) => set({ isUpdating }),
// Room bubbles
bubbles: {},
setBubbles: (bubbles) => set({ bubbles }),
// Resizable panels
leftWidth: 70,
setLeftWidth: (leftWidth) => set({ leftWidth }),
isResizing: false,
setIsResizing: (isResizing) => set({ isResizing }),
// Now timestamp (for current time display)
now: new Date(),
setNow: (now) => set({ now }),
}));