Add React frontend for energy trading system

Implements React + TypeScript UI with Vite and Tailwind CSS.
Features dashboard with real-time WebSocket updates, backtesting
page, model management interface, trading controls, and settings.
Includes state management with Zustand, API integration with
Axios/TanStack Query, and interactive charts with Recharts.
This commit is contained in:
2026-02-12 01:01:08 +07:00
parent fe76bc7629
commit c6bca0b7bb
48 changed files with 5978 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { useEffect } from 'react';
import { webSocketService } from '@/services/websocket';
import type { WebSocketEventType } from '@/services/types';
export function useWebSocket() {
useEffect(() => {
webSocketService.connect();
return () => webSocketService.disconnect();
}, []);
const subscribe = <T = unknown>(
eventType: WebSocketEventType,
handler: (data: T) => void
): (() => void) => {
return webSocketService.subscribe<T>(eventType, handler);
};
const isConnected = webSocketService.getConnectionStatus();
return { subscribe, isConnected };
}