Restore working dashboard and TradingView analysis

- Fixed layout conflicts by removing minimal layout.tsx in favor of complete layout.js
- Restored original AI Analysis page with full TradingView integration
- Connected enhanced screenshot API to real TradingView automation service
- Fixed screenshot gallery to handle both string and object formats
- Added image serving API route for screenshot display
- Resolved hydration mismatch issues with suppressHydrationWarning
- All navigation pages working (Analysis, Trading, Automation, Settings)
- TradingView automation successfully capturing screenshots from AI and DIY layouts
- Docker Compose v2 compatibility ensured

Working features:
- Homepage with hero section and status cards
- Navigation menu with Trading Bot branding
- Real TradingView screenshot capture
- AI-powered chart analysis
- Multi-layout support (AI + DIY module)
- Screenshot gallery with image serving
- API endpoints for balance, status, screenshots, trading
This commit is contained in:
mindesbunister
2025-07-14 14:21:19 +02:00
parent 9978760995
commit de45349baa
68 changed files with 2147 additions and 1813 deletions

View File

@@ -50,11 +50,26 @@ export default function DriftAccountStatus() {
return
}
// Check if account actually exists
if (!loginData.userAccountExists) {
setError('Drift account not initialized. Please visit app.drift.trade and deposit funds to create your account.')
return
}
// Step 2: Fetch balance
const balanceRes = await fetch('/api/drift/balance')
if (balanceRes.ok) {
const balanceData = await balanceRes.json()
setBalance(balanceData)
// Map the API response to the expected format
const mappedBalance: AccountBalance = {
totalCollateral: balanceData.totalValue || 0,
freeCollateral: balanceData.availableBalance || 0,
marginRequirement: balanceData.marginUsed || 0,
accountValue: balanceData.totalValue || 0,
leverage: balanceData.totalValue > 0 ? (balanceData.marginUsed || 0) / balanceData.totalValue : 0,
availableBalance: balanceData.availableBalance || 0
}
setBalance(mappedBalance)
} else {
const errorData = await balanceRes.json()
setError(errorData.error || 'Failed to fetch balance')
@@ -64,7 +79,18 @@ export default function DriftAccountStatus() {
const positionsRes = await fetch('/api/drift/positions')
if (positionsRes.ok) {
const positionsData = await positionsRes.json()
setPositions(positionsData.positions || [])
// Map the API response to the expected format
const mappedPositions = (positionsData.positions || []).map((pos: any) => ({
symbol: pos.symbol,
side: (pos.side?.toUpperCase() || 'LONG') as 'LONG' | 'SHORT',
size: pos.size || 0,
entryPrice: pos.entryPrice || 0,
markPrice: pos.markPrice || 0,
unrealizedPnl: pos.unrealizedPnl || 0,
marketIndex: pos.marketIndex || 0,
marketType: 'PERP' as 'PERP' | 'SPOT'
}))
setPositions(mappedPositions)
} else {
const errorData = await positionsRes.json()
console.warn('Failed to fetch positions:', errorData.error)