feat: institutional agentic ui redesign - purge fake smc canvas, fix header layout voids, 1-click tradingview fullscreen, hermes quant agentic copilot hud
This commit is contained in:
+113
-98
@@ -8,6 +8,7 @@ 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 { SecurityGate } from "@/components/auth/SecurityGate";
|
||||
import { TradePosition } from "@/components/positions/ActiveTradesTable";
|
||||
import { useExnessWebSocket } from "@/hooks/useExnessWebSocket";
|
||||
@@ -17,6 +18,14 @@ 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);
|
||||
|
||||
const [apiBaseUrl, setApiBaseUrl] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
if (window.location.hostname === "localhost" && window.location.port === "3000") {
|
||||
@@ -37,9 +46,9 @@ export default function TitanQuantTerminalPage() {
|
||||
}
|
||||
return process.env.NEXT_PUBLIC_WS_URL || "ws://localhost:8085/ws/stream";
|
||||
});
|
||||
|
||||
const [activeSymbol, setActiveSymbol] = useState("XAUUSD");
|
||||
const [activeTimeframe, setActiveTimeframe] = useState("15m");
|
||||
const [candles, setCandles] = useState<any[]>([]);
|
||||
const [confluence, setConfluence] = useState<any>(null);
|
||||
const [positions, setPositions] = useState<TradePosition[]>([]);
|
||||
const [showConnectModal, setShowConnectModal] = useState(false);
|
||||
@@ -80,57 +89,33 @@ export default function TitanQuantTerminalPage() {
|
||||
setIsUnlocked(false);
|
||||
};
|
||||
|
||||
// Fetch Candles
|
||||
useEffect(() => {
|
||||
async function fetchCandles() {
|
||||
try {
|
||||
const res = await fetch(`${apiBaseUrl}/api/v1/chart/candles?timeframe=${activeTimeframe}&count=60`);
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
setCandles(data.candles || []);
|
||||
}
|
||||
} catch (err) {
|
||||
// Fallback default sample candles if backend initializing
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
const fallback = Array.from({ length: 40 }).map((_, i) => ({
|
||||
time: now - (40 - i) * 900,
|
||||
open: 2730 + Math.sin(i * 0.5) * 4,
|
||||
high: 2734 + Math.sin(i * 0.5) * 4 + 1.5,
|
||||
low: 2728 + Math.sin(i * 0.5) * 4 - 1.5,
|
||||
close: 2731 + Math.sin(i * 0.5) * 4 + 0.8,
|
||||
}));
|
||||
setCandles(fallback);
|
||||
}
|
||||
}
|
||||
fetchCandles();
|
||||
}, [apiBaseUrl, activeTimeframe, activeSymbol]);
|
||||
|
||||
// Fetch Confluence Analysis
|
||||
useEffect(() => {
|
||||
async function fetchAnalysis() {
|
||||
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: [],
|
||||
});
|
||||
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);
|
||||
@@ -231,7 +216,7 @@ export default function TitanQuantTerminalPage() {
|
||||
|
||||
return (
|
||||
<main className="flex flex-col min-h-screen bg-[#04080f] text-gray-100 select-none">
|
||||
{/* 1. Global Institutional Top HUD */}
|
||||
{/* 1. Global Institutional Top HUD (Single-Tier, No Wrap) */}
|
||||
<TitanHeader
|
||||
telemetry={packet?.telemetry || null}
|
||||
ping={ping}
|
||||
@@ -239,38 +224,50 @@ export default function TitanQuantTerminalPage() {
|
||||
circuitBreakerTripped={packet?.circuit_breaker.is_tripped || false}
|
||||
onEmergencyKill={handleEmergencyKill}
|
||||
onLockTerminal={handleLockTerminal}
|
||||
activeWorkspaceMode={workspaceMode}
|
||||
onChangeWorkspaceMode={setWorkspaceMode}
|
||||
/>
|
||||
|
||||
{/* 2. Main 3-Column Institutional Workspace */}
|
||||
{/* 2. Dynamic Institutional Workspace (Pro, Focus, or Agentic Cockpit) */}
|
||||
<div className="flex-1 grid grid-cols-1 xl:grid-cols-12 gap-2.5 p-2.5">
|
||||
|
||||
{/* Left Column (3 cols on xl): Multi-Asset Radar & Macro Calendar */}
|
||||
<aside className="xl:col-span-3 flex flex-col gap-2.5">
|
||||
<div className="h-[300px]">
|
||||
<WatchlistRadar
|
||||
activeSymbol={activeSymbol}
|
||||
onSelectSymbol={(sym) => setActiveSymbol(sym)}
|
||||
liveGoldTick={packet?.tick || null}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 min-h-[300px]">
|
||||
<EconomicCalendarDock
|
||||
isQuarantineActive={packet?.news_quarantine.is_active || false}
|
||||
quarantineReason={packet?.news_quarantine.reason || ""}
|
||||
/>
|
||||
</div>
|
||||
</aside>
|
||||
{/* Left Column (3 cols on xl in Pro mode): Multi-Asset Radar & Macro Calendar */}
|
||||
{workspaceMode === "pro" && (
|
||||
<aside className="xl:col-span-3 flex flex-col gap-2.5">
|
||||
<div className="h-[280px]">
|
||||
<WatchlistRadar
|
||||
activeSymbol={activeSymbol}
|
||||
onSelectSymbol={(sym) => setActiveSymbol(sym)}
|
||||
liveGoldTick={packet?.tick || null}
|
||||
/>
|
||||
</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 (6 cols on xl): Dual-Pane Chart Stage & Cockpit Dock */}
|
||||
<section className="xl:col-span-6 flex flex-col gap-2.5">
|
||||
{/* Center Stage: TradingView Advanced Chart & Cockpit Dock */}
|
||||
<section
|
||||
className={`flex flex-col gap-2.5 ${
|
||||
workspaceMode === "focus"
|
||||
? "xl:col-span-12"
|
||||
: workspaceMode === "agentic"
|
||||
? "xl:col-span-7"
|
||||
: "xl:col-span-6"
|
||||
}`}
|
||||
>
|
||||
<ChartStageContainer
|
||||
symbol={activeSymbol}
|
||||
timeframe={activeTimeframe}
|
||||
onSelectTimeframe={(tf) => setActiveTimeframe(tf)}
|
||||
candles={candles}
|
||||
liveTick={packet?.tick || null}
|
||||
activeFvgs={confluence?.active_fvgs || []}
|
||||
onOpenConnectModal={() => setShowConnectModal(true)}
|
||||
isTheaterMode={workspaceMode === "focus"}
|
||||
onToggleTheaterMode={() => setWorkspaceMode(workspaceMode === "focus" ? "pro" : "focus")}
|
||||
/>
|
||||
|
||||
{/* Lower 4-Tab Analytical Cockpit Dock */}
|
||||
@@ -289,22 +286,41 @@ export default function TitanQuantTerminalPage() {
|
||||
/>
|
||||
</section>
|
||||
|
||||
{/* Right Column (3 cols on xl): Quant War Room & Multi-Tier Execution */}
|
||||
<aside className="xl:col-span-3 flex flex-col gap-2.5">
|
||||
<div className="shrink-0">
|
||||
<ConfluenceMeter confluence={confluence} />
|
||||
</div>
|
||||
<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}
|
||||
/>
|
||||
</div>
|
||||
</aside>
|
||||
{/* Right Column: Hermes Agentic Copilot & Multi-Tier Execution Terminal */}
|
||||
{workspaceMode !== "focus" && (
|
||||
<aside
|
||||
className={`flex flex-col gap-2.5 ${
|
||||
workspaceMode === "agentic" ? "xl:col-span-5" : "xl:col-span-3"
|
||||
}`}
|
||||
>
|
||||
{/* Hermes Agentic Copilot HUD (Always visible in Pro & Agentic mode) */}
|
||||
<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>
|
||||
|
||||
{/* Connect Broker Modal */}
|
||||
@@ -344,31 +360,30 @@ export default function TitanQuantTerminalPage() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-gray-400 mb-1">Server Cluster</label>
|
||||
<select
|
||||
<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"
|
||||
>
|
||||
<option value="Exness-MT5Real15">Exness-MT5Real15 (Your Live Server)</option>
|
||||
<option value="Exness-MT5Real">Exness-MT5Real</option>
|
||||
<option value="Exness-MT5Trial">Exness-MT5Trial (Demo)</option>
|
||||
</select>
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="pt-2 flex items-center justify-end gap-2">
|
||||
<div className="flex justify-end gap-2 pt-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowConnectModal(false)}
|
||||
className="px-3 py-1.5 rounded bg-[#070d18] border border-[#14233d] text-gray-400 hover:text-gray-200"
|
||||
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-400 hover:bg-cyan-300 text-black font-bold shadow-md shadow-cyan-500/20"
|
||||
className="px-4 py-1.5 rounded bg-cyan-600 hover:bg-cyan-500 text-white font-bold"
|
||||
>
|
||||
Connect MT5
|
||||
Save & Connect
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user