add frontend

This commit is contained in:
Marvin Gabler 2025-10-21 19:49:06 +02:00
parent a0710f5558
commit 2b37cddd1d
15 changed files with 5408 additions and 0 deletions

Binary file not shown.

31
frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,31 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Environment variables
.env
.env.local
.env.production.local
.env.development.local
.env.test.local

183
frontend/README.md Normal file
View File

@ -0,0 +1,183 @@
# Trading Agents Terminal Frontend
A React-based terminal/ASCII-style frontend for the Trading Agents multi-agent trading analysis system.
## Features
- **Terminal-Inspired UI**: Bloomberg Terminal-style interface with ASCII aesthetics
- **Real-Time Updates**: WebSocket integration for live analysis progress
- **Agent Pipeline Visualization**: Visual representation of the multi-agent workflow
- **Analysis Management**: Create, monitor, and manage trading analyses
- **Report Viewer**: View and download analysis reports
- **Log Viewer**: Real-time execution logs with filtering
## Tech Stack
- **React 18** with TypeScript
- **Vite** for fast development
- **Tailwind CSS** with custom terminal theme
- **TanStack Query** (React Query) for data fetching
- **Zustand** for state management
- **React Router** for navigation
- **Lucide React** for icons
- **Framer Motion** for animations
## Getting Started
### Prerequisites
- Node.js 16+
- npm or yarn
- Trading Agents API server running (default: http://localhost:8002)
### Installation
```bash
# Install dependencies
npm install
# Start development server
npm run dev
```
The application will be available at http://localhost:5173
### Configuration
Create a `.env` file:
```
VITE_API_URL=http://localhost:8002
```
### First Time Setup
1. Navigate to the Settings page
2. Enter your API key (get one from the API server)
3. Configure the API URL if different from default
4. Start creating analyses!
## Project Structure
```
src/
├── components/
│ ├── layout/ # Header, Sidebar, StatusBar, Layout
│ ├── ui/ # Reusable UI components (ASCIIBox, Button, etc.)
│ ├── analysis/ # Analysis-related components
│ ├── agents/ # Agent pipeline visualization
│ └── dashboard/ # Dashboard components
├── pages/ # Page components
├── hooks/ # Custom React hooks
├── services/ # API and WebSocket services
├── stores/ # Zustand stores
├── types/ # TypeScript type definitions
├── utils/ # Utility functions
└── styles/ # Global styles
```
## Available Scripts
```bash
# Development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Type checking
npm run type-check
# Linting
npm run lint
```
## Features Guide
### Dashboard
- System metrics overview
- Recent activity feed
- Quick links to common actions
### Analysis Management
- Create new analyses with custom parameters
- View all analyses in a sortable table
- Real-time status updates
- Detailed analysis view with agent pipeline
### Real-Time Monitoring
- WebSocket connection for live updates
- Agent pipeline progress visualization
- Live log streaming
- Progress bars and status indicators
### Reports
- Tabbed interface for different report types
- Markdown rendering
- Copy to clipboard
- Download as text file
### Settings
- API key configuration
- API URL configuration
- Application information
## Styling
The application uses a custom terminal/ASCII theme with:
- Green (#00ff00) - Primary color
- Cyan (#00ffff) - Accent color
- Yellow (#ffff00) - Warning color
- Red (#ff0000) - Error color
- Dark background (#0a0e14)
All components follow the ASCII/terminal aesthetic with box-drawing characters and monospace fonts.
## Development
### Adding New Pages
1. Create page component in `src/pages/`
2. Add route in `src/App.tsx`
3. Add navigation link in `src/components/layout/Sidebar.tsx`
### Adding New Components
1. Create component in appropriate directory under `src/components/`
2. Use existing UI components for consistency
3. Follow terminal styling conventions
### API Integration
All API calls go through `src/services/api.ts`. Use the custom hooks in `src/hooks/` for data fetching:
```typescript
import { useAnalyses } from '../hooks/useAnalyses';
const { data, isLoading } = useAnalyses();
```
## Deployment
```bash
# Build for production
npm run build
# Preview the build
npm run preview
```
The built files will be in the `dist/` directory. Deploy to any static hosting service (Vercel, Netlify, etc.).
## License
Part of the Trading Agents project.

110
frontend/START_FRONTEND.md Normal file
View File

@ -0,0 +1,110 @@
# Trading Agents Frontend - Quick Start
## Quick Start
### 1. Install Dependencies (First Time Only)
```bash
cd frontend
npm install
```
### 2. Start Development Server
```bash
npm run dev
```
The frontend will be available at: **http://localhost:5173**
### 3. Configure API Connection
1. Navigate to http://localhost:5173/settings
2. Enter your API key from the backend
3. Verify the API URL is correct (default: http://localhost:8002)
**Note:** Make sure the Trading Agents API is running on port 8002 before using the frontend!
## First Time Setup
When you first open the application:
1. You'll be automatically redirected to the Settings page
2. Enter the API key you received when starting the API server
3. The API key is stored securely in your browser's local storage
4. Once configured, you can start creating analyses!
## Available Commands
```bash
# Development server (with hot reload)
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Type checking
npm run type-check
```
## Troubleshooting
**"Invalid or inactive API key"**
- Go to Settings and verify your API key
- Make sure you copied the entire key from the API startup logs
- Check that the API server is running
**"Cannot connect to API"**
- Verify the API URL in Settings (default: http://localhost:8002)
- Make sure the API server is running
- Check for port conflicts
**Frontend not loading**
- Check that port 5173 is not in use
- Try stopping the dev server and starting again
- Clear browser cache and reload
## Development Tips
- The frontend uses hot module replacement (HMR) for instant updates
- Changes to TypeScript files will cause a rebuild
- Changes to CSS will update instantly
- Browser DevTools are your friend for debugging
## Project Structure
```
frontend/
├── src/
│ ├── components/ # React components
│ ├── pages/ # Page components
│ ├── hooks/ # Custom hooks
│ ├── services/ # API & WebSocket
│ ├── stores/ # State management
│ ├── types/ # TypeScript types
│ ├── utils/ # Utilities
│ └── styles/ # Global styles
├── public/ # Static assets
└── index.html # Entry HTML
```
## Features
- **Dashboard**: Overview of all analyses and system metrics
- **Analyses**: List and manage all trading analyses
- **Create Analysis**: Form to start new analysis
- **Analysis Detail**: Real-time view of analysis progress
- **Settings**: Configure API key and URL
## Next Steps
1. Start the API server (see `api/START_API.md`)
2. Start the frontend (`npm run dev`)
3. Configure your API key in Settings
4. Create your first analysis!
Enjoy using Trading Agents! 🚀

23
frontend/eslint.config.js Normal file
View File

@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])

13
frontend/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/litadel.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Litadel - Multi-Agent Trading System</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

4930
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

42
frontend/package.json Normal file
View File

@ -0,0 +1,42 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@tailwindcss/postcss": "^4.1.15",
"@tanstack/react-query": "^5.90.5",
"autoprefixer": "^10.4.21",
"axios": "^1.12.2",
"framer-motion": "^12.23.24",
"lucide-react": "^0.546.0",
"postcss": "^8.5.6",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-hot-toast": "^2.6.0",
"react-router-dom": "^7.9.4",
"recharts": "^3.3.0",
"tailwindcss": "^4.1.15",
"zustand": "^5.0.8"
},
"devDependencies": {
"@eslint/js": "^9.36.0",
"@types/node": "^24.6.0",
"@types/react": "^19.1.16",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.4",
"eslint": "^9.36.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.22",
"globals": "^16.4.0",
"typescript": "~5.9.3",
"typescript-eslint": "^8.45.0",
"vite": "^7.1.7"
}
}

View File

@ -0,0 +1,7 @@
export default {
plugins: {
'@tailwindcss/postcss': {},
autoprefixer: {},
},
}

BIN
frontend/public/litadel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

1
frontend/public/vite.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

7
frontend/tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@ -0,0 +1,26 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

7
frontend/vite.config.ts Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})