Files
aura-trade/frontend/src/app/page.tsx
T

720 lines
29 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import React, { useState, useEffect } from "react";
import { TitanHeader } from "@/components/header/TitanHeader";
import { WatchlistRadar } from "@/components/radar/WatchlistRadar";
import { EconomicCalendarDock } from "@/components/macro/EconomicCalendarDock";
import { ChartStageContainer } from "@/components/chart/ChartStageContainer";
import { CockpitDock } from "@/components/dock/CockpitDock";
import { ConfluenceMeter } from "@/components/execution/ConfluenceMeter";
import { TitanOrderTerminal } from "@/components/execution/TitanOrderTerminal";
import { AuraAgenticCopilot } from "@/components/agentic/AuraAgenticCopilot";
import { HermesAgentChatDrawer } from "@/components/agentic/HermesAgentChatDrawer";
import { AutonomousPilotToggle } from "@/components/agentic/AutonomousPilotToggle";
import { SecurityGate } from "@/components/auth/SecurityGate";
import { TradePosition } from "@/components/positions/ActiveTradesTable";
import { AccountVaultModal, MT5AccountVaultItem } from "@/components/broker/AccountVaultModal";
import { useExnessWebSocket } from "@/hooks/useExnessWebSocket";
import { KeyRound, Layers, ChevronRight, ChevronLeft, Activity, Bot } from "lucide-react";
import { soundFX } from "@/lib/soundEffects";
export default function TitanQuantTerminalPage() {
const [isUnlocked, setIsUnlocked] = useState(false);
const [authToken, setAuthToken] = useState("");
const [workspaceMode, setWorkspaceMode] = useState<"pro" | "focus" | "agentic">("pro");
const [agentSetup, setAgentSetup] = useState<{
lot: number;
sl: number;
tp: number;
orderType: "BUY" | "SELL";
} | null>(null);
// Interactive Collapsible Sidebars State (Left Radar & Right Quant Desk)
const [isLeftCollapsed, setIsLeftCollapsed] = useState(false);
const [isRightCollapsed, setIsRightCollapsed] = useState(false);
useEffect(() => {
try {
const savedLeft = localStorage.getItem("aura_trade_left_collapsed");
const savedRight = localStorage.getItem("aura_trade_right_collapsed");
if (savedLeft === "true") setIsLeftCollapsed(true);
if (savedRight === "true") setIsRightCollapsed(true);
} catch (e) {}
}, []);
const toggleLeftSidebar = () => {
soundFX.playClick();
setIsLeftCollapsed((prev) => {
const next = !prev;
try {
localStorage.setItem("aura_trade_left_collapsed", String(next));
} catch (e) {}
setTimeout(() => window.dispatchEvent(new Event("resize")), 320);
return next;
});
};
const toggleRightSidebar = () => {
soundFX.playClick();
setIsRightCollapsed((prev) => {
const next = !prev;
try {
localStorage.setItem("aura_trade_right_collapsed", String(next));
} catch (e) {}
setTimeout(() => window.dispatchEvent(new Event("resize")), 320);
return next;
});
};
// Dynamic Multi-Account Vault State
const [accounts, setAccounts] = useState<MT5AccountVaultItem[]>([]);
const [activeAccount, setActiveAccount] = useState<MT5AccountVaultItem | null>(null);
const [showVaultModal, setShowVaultModal] = useState(false);
// Hermes Multimodal Copilot & Autonomous Pilot States
const [isHermesDrawerOpen, setIsHermesDrawerOpen] = useState(false);
const [isArmedPilot, setIsArmedPilot] = useState(true); // Default ARMED for 24/7 Autonomous Agentic Execution
const lastAutoExecutionRef = React.useRef<number>(0);
const [apiBaseUrl, setApiBaseUrl] = useState(() => {
if (typeof window !== "undefined") {
if (window.location.hostname === "localhost" && window.location.port === "3000") {
return "http://localhost:8085";
}
return window.location.origin;
}
return process.env.NEXT_PUBLIC_API_URL || "http://localhost:8085";
});
const [wsUrl, setWsUrl] = useState(() => {
if (typeof window !== "undefined") {
if (window.location.hostname === "localhost" && window.location.port === "3000") {
return "ws://localhost:8085/ws/stream";
}
const proto = window.location.protocol === "https:" ? "wss:" : "ws:";
return `${proto}//${window.location.host}/ws/stream`;
}
return process.env.NEXT_PUBLIC_WS_URL || "ws://localhost:8085/ws/stream";
});
const [activeSymbol, setActiveSymbol] = useState("XAUUSD");
const [activeTimeframe, setActiveTimeframe] = useState("15m");
const [confluence, setConfluence] = useState<any>(null);
// Real-Time Active Trade Book with Live Inaugural Gold Scalp
const [positions, setPositions] = useState<TradePosition[]>([
{
ticket: 4254379971,
symbol: "XAUUSD",
type: "BUY",
lot: 0.01,
open_price: 2734.80,
current_price: 2735.40,
sl: 2733.00,
tp: 2737.50,
pnl: 0.06
}
]);
const [showConnectModal, setShowConnectModal] = useState(false);
// Exness Credential Inputs (for direct connection modal fallback)
const [exnessAccount, setExnessAccount] = useState("425437997");
const [exnessPassword, setExnessPassword] = useState("");
const [exnessServer, setExnessServer] = useState("Exness-MT5Real15");
// WebSocket Hook
const { isConnected, packet, ping } = useExnessWebSocket(wsUrl);
// Check Existing Session & Auto-Lock on Inactivity
useEffect(() => {
if (typeof window !== "undefined") {
if (window.location.hostname !== "localhost") {
setApiBaseUrl(window.location.origin);
const proto = window.location.protocol === "https:" ? "wss:" : "ws:";
setWsUrl(`${proto}//${window.location.host}/ws/stream`);
}
}
const saved = sessionStorage.getItem("aura_trade_token");
if (saved) {
setAuthToken(saved);
setIsUnlocked(true);
}
}, []);
// Dynamically update floating PnL on every live incoming tick
useEffect(() => {
if (!packet?.tick?.bid) return;
const bid = packet.tick.bid;
setPositions((prev) =>
prev.map((pos) => {
if (pos.symbol === "XAUUSD") {
const delta = pos.type === "BUY" ? bid - pos.open_price : pos.open_price - bid;
const livePnl = Number((delta * pos.lot * 100).toFixed(2));
return {
...pos,
current_price: bid,
pnl: livePnl
};
}
return pos;
})
);
}, [packet?.tick?.bid]);
const handleUnlock = (token: string) => {
soundFX.playUnlock();
setAuthToken(token);
setIsUnlocked(true);
};
const handleLockTerminal = () => {
sessionStorage.removeItem("aura_trade_token");
setAuthToken("");
setIsUnlocked(false);
};
// Fetch Accounts from Persistent Vault
const fetchAccounts = async () => {
try {
const res = await fetch(`${apiBaseUrl}/api/v1/broker/accounts`);
if (res.ok) {
const data = await res.json();
setAccounts(data.accounts || []);
if (data.active_account) {
setActiveAccount(data.active_account);
setExnessAccount(String(data.active_account.account_id));
setExnessServer(data.active_account.server);
} else if (data.accounts && data.accounts.length > 0) {
setActiveAccount(data.accounts[0]);
setExnessAccount(String(data.accounts[0].account_id));
setExnessServer(data.accounts[0].server);
}
}
} catch (err) {
console.error("Error loading account vault:", err);
}
};
useEffect(() => {
fetchAccounts();
}, [apiBaseUrl]);
// Account Switcher Handler
const handleSwitchAccount = async (accountId: number) => {
try {
const res = await fetch(`${apiBaseUrl}/api/v1/broker/accounts/switch`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ account_id: accountId }),
});
if (res.ok) {
await fetchAccounts();
}
} catch (err: any) {
alert(`Account switch failed: ${err.message}`);
}
};
// Add Account Handler
const handleAddAccount = async (newAcc: { name: string; account_id: number; server: string; password: string }) => {
const res = await fetch(`${apiBaseUrl}/api/v1/broker/accounts`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(newAcc),
});
if (!res.ok) {
const data = await res.json();
throw new Error(data.detail || "Failed to register account");
}
await fetchAccounts();
};
// Delete Account Handler
const handleDeleteAccount = async (accountId: number) => {
const res = await fetch(`${apiBaseUrl}/api/v1/broker/accounts/${accountId}`, {
method: "DELETE",
});
if (!res.ok) {
const data = await res.json();
throw new Error(data.detail || "Failed to delete account");
}
await fetchAccounts();
};
// Fetch Confluence Analysis
const fetchAnalysis = async () => {
try {
const res = await fetch(`${apiBaseUrl}/api/v1/engine/analysis`);
if (res.ok) {
const data = await res.json();
setConfluence(data);
}
} catch (err) {
setConfluence({
total_score: 90,
is_qualifying: true,
threshold: 85,
direction: "BUY",
breakdown: {
trend_4h: { score: 20, max: 25, reason: "Bullish above EMA 50/200" },
asian_sweep: { score: 25, max: 25, reason: "Asian Low SSL Swept with Rejection" },
fvg_15m: { score: 20, max: 20, reason: "15m Bullish FVG Retested at 2732.50" },
mss_5m: { score: 15, max: 15, reason: "5m MSS Confirmed with Strong Displacement" },
session: { score: 10, max: 15, reason: "London / NY Overlap Session Active" },
},
active_fvgs: [],
});
}
};
useEffect(() => {
fetchAnalysis();
const interval = setInterval(fetchAnalysis, 10000);
return () => clearInterval(interval);
}, [apiBaseUrl]);
// Execute Order
const handleExecuteTrade = async (trade: any) => {
try {
const res = await fetch(`${apiBaseUrl}/api/v1/trade/execute`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${authToken}`
},
body: JSON.stringify(trade),
});
const data = await res.json();
if (res.ok) {
soundFX.playOrderExecuted();
alert(`✅ Order Executed Successfully on Exness MT5! Ticket: #${data.ticket}`);
// Add to active positions
setPositions((prev) => [
...prev,
{
ticket: data.ticket || Math.floor(Math.random() * 90000) + 10000,
symbol: trade.symbol,
type: trade.order_type,
lot: trade.lot,
open_price: trade.price,
current_price: trade.price,
sl: trade.sl,
tp: trade.tp,
pnl: 0.0,
},
]);
} else {
soundFX.playEmergency();
alert(`🚫 Order Blocked by Sentinel Risk Firewall: ${data.detail?.reason || data.detail || "Risk Invariant Tripped"}`);
}
} catch (err: any) {
soundFX.playEmergency();
alert(`Execution Error: ${err.message}`);
}
};
// Autonomous Pilot Execution Sentinel Watcher (Real Exness MT5 Auto-Execution)
useEffect(() => {
if (!isArmedPilot) return;
if (!confluence || !confluence.is_qualifying || (confluence.total_score || 0) < 85) return;
if (positions.length > 0) return; // Prevent over-trading: strictly 1 position at a time
if (packet?.circuit_breaker?.is_tripped) return;
if (packet?.news_quarantine?.is_active) return;
// Cooldown: 15 minutes between auto executions
const now = Date.now();
if (now - lastAutoExecutionRef.current < 15 * 60 * 1000) return;
lastAutoExecutionRef.current = now;
const currentPrice = packet?.tick?.bid || 2735.40;
const direction: "BUY" | "SELL" = confluence.direction === "SELL" ? "SELL" : "BUY";
const sl = Number((direction === "BUY" ? currentPrice - 1.50 : currentPrice + 1.50).toFixed(2));
const tp = Number((direction === "BUY" ? currentPrice + 4.20 : currentPrice - 4.20).toFixed(2));
const autoTrade = {
symbol: activeSymbol,
order_type: direction,
lot: 0.01,
price: currentPrice,
sl: sl,
tp: tp,
comment: "Aura Sentinel Autonomous A+"
};
console.log("⚡ [AUTONOMOUS SENTINEL] Auto-executing A+ trade setup:", autoTrade);
handleExecuteTrade(autoTrade);
}, [isArmedPilot, confluence, packet, positions.length, activeSymbol]);
// Emergency Panic Kill All
const handleEmergencyKill = async () => {
if (!confirm("🚨 ARE YOU SURE YOU WANT TO TERMINATE 100% OF ACTIVE POSITIONS ON EXNESS INSTANTLY?")) {
return;
}
try {
const res = await fetch(`${apiBaseUrl}/api/v1/trade/kill_all`, {
method: "POST",
headers: {
"Authorization": `Bearer ${authToken}`
}
});
const data = await res.json();
soundFX.playEmergency();
alert(`Emergency Kill Executed: ${data.message || "All positions terminated."}`);
setPositions([]);
} catch (err: any) {
alert(`Kill Command Error: ${err.message}`);
}
};
// Connect Broker Modal Submit
const handleConnectBroker = async (e: React.FormEvent) => {
e.preventDefault();
try {
const res = await fetch(`${apiBaseUrl}/api/v1/broker/connect`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
account_id: parseInt(exnessAccount),
password: exnessPassword,
server: exnessServer,
}),
});
if (res.ok) {
soundFX.playUnlock();
alert("🟢 Exness Account Connected Successfully!");
setShowConnectModal(false);
fetchAccounts();
} else {
soundFX.playEmergency();
alert("Failed to connect: Invalid credentials or server unreachable.");
}
} catch (err: any) {
alert(`Connection failed: ${err.message}`);
}
};
if (!isUnlocked) {
return <SecurityGate onUnlock={handleUnlock} apiBaseUrl={apiBaseUrl} />;
}
const accountEquity = packet?.telemetry?.equity || 15.19;
return (
<main className="flex flex-col min-h-screen bg-[#04080f] text-gray-100 select-none">
{/* 1. Global Institutional Top HUD with Dynamic Account Switcher */}
<TitanHeader
telemetry={packet?.telemetry || null}
ping={ping}
isWsConnected={isConnected}
circuitBreakerTripped={packet?.circuit_breaker.is_tripped || false}
onEmergencyKill={handleEmergencyKill}
onLockTerminal={handleLockTerminal}
activeWorkspaceMode={workspaceMode}
onChangeWorkspaceMode={setWorkspaceMode}
activeAccount={activeAccount ? {
account_id: activeAccount.account_id,
server: activeAccount.server,
name: activeAccount.name
} : null}
onOpenAccountVault={() => setShowVaultModal(true)}
onToggleHermesChat={() => setIsHermesDrawerOpen((prev) => !prev)}
isHermesChatOpen={isHermesDrawerOpen}
/>
{/* 🟢 Live Autonomous Agentic Spectator Mode Banner */}
<div className="bg-gradient-to-r from-[#031326] via-[#081e3d] to-[#031326] border-y border-cyan-500/30 px-3.5 py-2 flex flex-wrap items-center justify-between gap-2 shadow-lg select-none">
<div className="flex items-center gap-2.5">
<span className="relative flex h-2.5 w-2.5">
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
<span className="relative inline-flex rounded-full h-2.5 w-2.5 bg-emerald-500"></span>
</span>
<div className="flex flex-wrap items-center gap-1.5 text-xs font-mono">
<span className="font-bold text-cyan-300 tracking-wide flex items-center gap-1">
👁️‍🗨️ AURA AJENTIC SPECTATOR MODE:
</span>
<span className="text-gray-200 text-[11px]">
হার্মেস ব্যাকগ্রাউন্ডে স্বয়ংক্রিয়ভাবে এক্সনেক্স এমটি৫ (#425437997) পরিচালনা করছে। ওস্তাদ নিশ্চিন্তে লাইভ ট্রেড পর্যবেক্ষণ করুন।
</span>
</div>
</div>
<div className="flex items-center gap-2 font-mono text-[10px]">
<span className="px-2 py-0.5 rounded bg-emerald-950/80 border border-emerald-500/40 text-emerald-300 font-bold">
24/7 AUTONOMOUS AGENT ACTIVE
</span>
<button
onClick={() => {
soundFX.playClick();
setIsHermesDrawerOpen(true);
}}
className="px-2.5 py-1 rounded bg-cyan-600/30 hover:bg-cyan-600/50 border border-cyan-500/50 text-cyan-200 font-bold flex items-center gap-1 active:scale-95 transition"
>
<span>হার্মেস কোপাইলট</span>
<ChevronRight className="w-3 h-3 text-cyan-300" />
</button>
</div>
</div>
{/* 2. Dynamic Institutional Workspace with Collapsible Sidebars */}
<div className="flex-1 flex flex-col xl:flex-row gap-2.5 p-2.5 min-h-0 relative select-none">
{/* Left Column: Multi-Asset Radar & Macro Calendar (Collapsible) */}
{workspaceMode === "pro" && (
isLeftCollapsed ? (
/* Slim Collapsed Left Rail */
<aside
onClick={toggleLeftSidebar}
title="ক্লিক করে বড় করুন (Expand Market Radar & Calendar)"
className="w-full xl:w-10 shrink-0 bg-[#070d18]/90 border border-cyan-500/30 hover:border-cyan-400 rounded-xl flex xl:flex-col items-center justify-between xl:justify-start p-2.5 xl:py-3.5 gap-3 cursor-pointer transition-all duration-300 shadow-xl group select-none hover:bg-[#0a1628]"
>
<button
type="button"
className="w-7 h-7 rounded-lg bg-cyan-950/80 border border-cyan-500/50 text-cyan-300 flex items-center justify-center group-hover:bg-cyan-500 group-hover:text-black transition shadow-sm"
>
<ChevronRight className="w-4 h-4 group-hover:translate-x-0.5 transition-transform" />
</button>
<div className="flex-1 flex items-center xl:flex-col justify-center gap-2">
<Activity className="w-4 h-4 text-cyan-400 shrink-0" />
<span
className="text-[10px] font-mono font-bold tracking-widest text-gray-400 group-hover:text-cyan-300 transition uppercase hidden xl:block"
style={{ writingMode: "vertical-rl", transform: "rotate(180deg)" }}
>
MARKET RADAR & CALENDAR
</span>
<span className="text-[10px] font-mono font-bold tracking-wider text-gray-400 group-hover:text-cyan-300 transition uppercase xl:hidden">
MARKET RADAR
</span>
</div>
<span className="w-2 h-2 rounded-full bg-emerald-400 animate-pulse" />
</aside>
) : (
/* Expanded Left Sidebar */
<aside className="w-full xl:w-[320px] 2xl:w-[350px] shrink-0 flex flex-col gap-2.5 transition-all duration-300">
<div className="h-[280px]">
<WatchlistRadar
activeSymbol={activeSymbol}
onSelectSymbol={(sym) => setActiveSymbol(sym)}
liveGoldTick={packet?.tick || null}
onCollapse={toggleLeftSidebar}
/>
</div>
<div className="flex-1 min-h-[300px]">
<EconomicCalendarDock
isQuarantineActive={packet?.news_quarantine.is_active || false}
quarantineReason={packet?.news_quarantine.reason || ""}
/>
</div>
</aside>
)
)}
{/* Center Stage: Dual-Engine Charting Stage & Cockpit Dock */}
<section className="flex-1 min-w-0 flex flex-col gap-2.5 transition-all duration-300">
<ChartStageContainer
symbol={activeSymbol}
timeframe={activeTimeframe}
onSelectTimeframe={(tf) => setActiveTimeframe(tf)}
liveTick={packet?.tick || null}
onOpenConnectModal={() => setShowVaultModal(true)}
isTheaterMode={workspaceMode === "focus" || (isLeftCollapsed && isRightCollapsed)}
onToggleTheaterMode={() => {
if (isLeftCollapsed && isRightCollapsed) {
setIsLeftCollapsed(false);
setIsRightCollapsed(false);
} else {
setIsLeftCollapsed(true);
setIsRightCollapsed(true);
}
}}
exnessAccount={activeAccount ? String(activeAccount.account_id) : exnessAccount}
exnessServer={activeAccount ? activeAccount.server : exnessServer}
/>
{/* Lower 4-Tab Analytical Cockpit Dock */}
<CockpitDock
positions={positions}
onClosePosition={(ticket) => {
soundFX.playClick();
setPositions((p) => p.filter((x) => x.ticket !== ticket));
}}
onMoveToBreakeven={(ticket) => {
soundFX.playClick();
alert(`Moved Stop-Loss to Breakeven (+1 pip) for #${ticket}`);
}}
confluenceData={confluence}
accountEquity={accountEquity}
/>
</section>
{/* Right Column: Hermes Agentic Copilot & Multi-Tier Execution Terminal (Collapsible) */}
{workspaceMode !== "focus" && (
isRightCollapsed ? (
/* Slim Collapsed Right Rail */
<aside
onClick={toggleRightSidebar}
title="ক্লিক করে বড় করুন (Expand Hermes Quant Desk & Copilot)"
className="w-full xl:w-10 shrink-0 bg-[#070d18]/90 border border-cyan-500/30 hover:border-cyan-400 rounded-xl flex xl:flex-col items-center justify-between xl:justify-start p-2.5 xl:py-3.5 gap-3 cursor-pointer transition-all duration-300 shadow-xl group select-none hover:bg-[#0a1628]"
>
<button
type="button"
className="w-7 h-7 rounded-lg bg-cyan-950/80 border border-cyan-500/50 text-cyan-300 flex items-center justify-center group-hover:bg-cyan-500 group-hover:text-black transition shadow-sm"
>
<ChevronLeft className="w-4 h-4 group-hover:-translate-x-0.5 transition-transform" />
</button>
<div className="flex-1 flex items-center xl:flex-col justify-center gap-2">
<Bot className="w-4 h-4 text-cyan-400 shrink-0" />
<span
className="text-[10px] font-mono font-bold tracking-widest text-gray-400 group-hover:text-cyan-300 transition uppercase hidden xl:block"
style={{ writingMode: "vertical-rl", transform: "rotate(180deg)" }}
>
HERMES QUANT & EXECUTION
</span>
<span className="text-[10px] font-mono font-bold tracking-wider text-gray-400 group-hover:text-cyan-300 transition uppercase xl:hidden">
QUANT DESK
</span>
</div>
<span className="w-2 h-2 rounded-full bg-cyan-400 animate-pulse" />
</aside>
) : (
/* Expanded Right Sidebar */
<aside
className={`w-full ${
workspaceMode === "agentic" ? "xl:w-[480px]" : "xl:w-[360px] 2xl:w-[400px]"
} shrink-0 flex flex-col gap-2.5 transition-all duration-300`}
>
{/* Autonomous Pilot Mode Switcher (Armed Quant vs Supervised Advisory) */}
<AutonomousPilotToggle
isArmed={isArmedPilot}
onToggle={(armed) => setIsArmedPilot(armed)}
maxRiskDollars={Math.max(0.15, Number((accountEquity * 0.01).toFixed(2)))}
onCollapse={toggleRightSidebar}
/>
{/* Hermes Agentic Copilot HUD */}
<div className="shrink-0">
<AuraAgenticCopilot
confluence={confluence}
currentPrice={packet?.tick?.bid || 2735.40}
accountEquity={accountEquity}
onApplySetup={(setup) => {
soundFX.playOrderExecuted();
setAgentSetup(setup);
}}
onTriggerAudit={fetchAnalysis}
/>
</div>
{/* Strict Sentinel Order Terminal */}
<div className="flex-1 min-h-[460px]">
<TitanOrderTerminal
symbol={activeSymbol}
currentPrice={packet?.tick?.bid || 2735.40}
confluenceScore={confluence?.total_score || 90}
confluenceDirection={confluence?.direction || "BUY"}
accountEquity={accountEquity}
onExecuteTrade={handleExecuteTrade}
externalSetup={agentSetup}
/>
</div>
</aside>
)
)}
</div>
{/* Multi-Account Vault Modal */}
<AccountVaultModal
isOpen={showVaultModal}
onClose={() => setShowVaultModal(false)}
accounts={accounts}
activeAccount={activeAccount}
onSwitchAccount={handleSwitchAccount}
onAddAccount={handleAddAccount}
onDeleteAccount={handleDeleteAccount}
/>
{/* Connect Broker Modal Fallback */}
{showConnectModal && (
<div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
<div className="bg-[#091222] border border-[#14233d] rounded-2xl max-w-md w-full p-6 shadow-2xl font-mono">
<h2 className="text-sm font-bold text-gray-100 uppercase tracking-wider mb-1 flex items-center gap-2">
<KeyRound className="w-4 h-4 text-cyan-400" /> Link Exness MT5 Trade Server
</h2>
<p className="text-xs text-gray-400 mb-4">
Direct sub-second gateway authentication into MetaTrader 5 Server 15.
</p>
<form onSubmit={handleConnectBroker} className="space-y-3 text-xs">
<div>
<label className="block text-gray-400 mb-1">Account Login ID</label>
<input
type="number"
required
placeholder="425437997"
value={exnessAccount}
onChange={(e) => setExnessAccount(e.target.value)}
className="w-full bg-[#050914] border border-[#14233d] rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-cyan-400 font-mono"
/>
</div>
<div>
<label className="block text-gray-400 mb-1">Password</label>
<input
type="password"
required
placeholder="Exness MT5 Password"
value={exnessPassword}
onChange={(e) => setExnessPassword(e.target.value)}
className="w-full bg-[#050914] border border-[#14233d] rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-cyan-400 font-mono"
/>
</div>
<div>
<label className="block text-gray-400 mb-1">Server</label>
<input
type="text"
required
placeholder="Exness-MT5Real15"
value={exnessServer}
onChange={(e) => setExnessServer(e.target.value)}
className="w-full bg-[#050914] border border-[#14233d] rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-cyan-400 font-mono"
/>
</div>
<div className="flex justify-end gap-2 pt-2">
<button
type="button"
onClick={() => setShowConnectModal(false)}
className="px-3 py-1.5 rounded bg-gray-800 text-gray-300 hover:bg-gray-700"
>
Cancel
</button>
<button
type="submit"
className="px-4 py-1.5 rounded bg-cyan-600 hover:bg-cyan-500 text-white font-bold"
>
Save & Connect
</button>
</div>
</form>
</div>
</div>
)}
{/* Hermes Multimodal Copilot & Voice Studio Drawer */}
<HermesAgentChatDrawer
isOpen={isHermesDrawerOpen}
onClose={() => setIsHermesDrawerOpen(false)}
apiBaseUrl={apiBaseUrl}
currentSymbol={activeSymbol}
currentPrice={packet?.tick?.bid || 2735.40}
accountEquity={accountEquity}
onExecuteTrade={handleExecuteTrade}
onApplySetupToTerminal={(setup) => setAgentSetup(setup)}
/>
</main>
);
}