feat: interactive collapsible sidebars with arrow toggle buttons and ultra-wide chart maximizer
This commit is contained in:
+170
-67
@@ -15,7 +15,7 @@ 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 } from "lucide-react";
|
||||
import { KeyRound, Layers, ChevronRight, ChevronLeft, Activity, Bot } from "lucide-react";
|
||||
import { soundFX } from "@/lib/soundEffects";
|
||||
|
||||
export default function TitanQuantTerminalPage() {
|
||||
@@ -29,6 +29,43 @@ export default function TitanQuantTerminalPage() {
|
||||
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);
|
||||
@@ -417,46 +454,79 @@ export default function TitanQuantTerminalPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 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">
|
||||
{/* 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 (3 cols on xl in Pro mode): Multi-Asset Radar & Macro Calendar */}
|
||||
{/* Left Column: Multi-Asset Radar & Macro Calendar (Collapsible) */}
|
||||
{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>
|
||||
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 flex-col gap-2.5 ${
|
||||
workspaceMode === "focus"
|
||||
? "xl:col-span-12"
|
||||
: workspaceMode === "agentic"
|
||||
? "xl:col-span-7"
|
||||
: "xl:col-span-6"
|
||||
}`}
|
||||
>
|
||||
<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"}
|
||||
onToggleTheaterMode={() => setWorkspaceMode(workspaceMode === "focus" ? "pro" : "focus")}
|
||||
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}
|
||||
/>
|
||||
@@ -477,47 +547,80 @@ export default function TitanQuantTerminalPage() {
|
||||
/>
|
||||
</section>
|
||||
|
||||
{/* Right Column: Hermes Agentic Copilot & Multi-Tier Execution Terminal */}
|
||||
{/* Right Column: Hermes Agentic Copilot & Multi-Tier Execution Terminal (Collapsible) */}
|
||||
{workspaceMode !== "focus" && (
|
||||
<aside
|
||||
className={`flex flex-col gap-2.5 ${
|
||||
workspaceMode === "agentic" ? "xl:col-span-5" : "xl:col-span-3"
|
||||
}`}
|
||||
>
|
||||
{/* 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)))}
|
||||
/>
|
||||
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>
|
||||
|
||||
{/* 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>
|
||||
<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>
|
||||
|
||||
{/* 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}
|
||||
<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}
|
||||
/>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{/* 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>
|
||||
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { ShieldAlert, ShieldCheck, Zap, Radio, AlertTriangle } from "lucide-react";
|
||||
import { ShieldAlert, ShieldCheck, Zap, Radio, AlertTriangle, ChevronRight } from "lucide-react";
|
||||
import { soundFX } from "@/lib/soundEffects";
|
||||
|
||||
interface AutonomousPilotToggleProps {
|
||||
isArmed: boolean;
|
||||
onToggle: (armed: boolean) => void;
|
||||
maxRiskDollars?: number;
|
||||
onCollapse?: () => void;
|
||||
}
|
||||
|
||||
export const AutonomousPilotToggle: React.FC<AutonomousPilotToggleProps> = ({
|
||||
isArmed,
|
||||
onToggle,
|
||||
maxRiskDollars = 0.15,
|
||||
onCollapse,
|
||||
}) => {
|
||||
const handleToggle = () => {
|
||||
soundFX.playClick();
|
||||
@@ -53,26 +55,41 @@ export const AutonomousPilotToggle: React.FC<AutonomousPilotToggleProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={handleToggle}
|
||||
className={`px-3 py-1.5 rounded-lg font-bold text-[10px] flex items-center gap-1.5 transition active:scale-95 shadow-sm ${
|
||||
isArmed
|
||||
? "bg-gradient-to-r from-amber-600 to-yellow-600 hover:from-amber-500 hover:to-yellow-500 text-black border border-amber-400"
|
||||
: "bg-[#0b172a] hover:bg-[#122240] border border-[#182e52] text-gray-300"
|
||||
}`}
|
||||
>
|
||||
{isArmed ? (
|
||||
<>
|
||||
<Radio className="w-3 h-3 text-black animate-pulse" />
|
||||
<span>DISARM</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Zap className="w-3 h-3 text-cyan-400" />
|
||||
<span>ARM AUTO-PILOT</span>
|
||||
</>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<button
|
||||
onClick={handleToggle}
|
||||
className={`px-3 py-1.5 rounded-lg font-bold text-[10px] flex items-center gap-1.5 transition active:scale-95 shadow-sm ${
|
||||
isArmed
|
||||
? "bg-gradient-to-r from-amber-600 to-yellow-600 hover:from-amber-500 hover:to-yellow-500 text-black border border-amber-400"
|
||||
: "bg-[#0b172a] hover:bg-[#122240] border border-[#182e52] text-gray-300"
|
||||
}`}
|
||||
>
|
||||
{isArmed ? (
|
||||
<>
|
||||
<Radio className="w-3 h-3 text-black animate-pulse" />
|
||||
<span>DISARM</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Zap className="w-3 h-3 text-cyan-400" />
|
||||
<span>ARM AUTO-PILOT</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
|
||||
{onCollapse && (
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onCollapse();
|
||||
}}
|
||||
title="সাইডবার চিপুন (Collapse Quant Desk)"
|
||||
className="p-1.5 rounded-lg bg-[#091528] hover:bg-cyan-500/20 border border-cyan-500/40 text-cyan-300 hover:text-white transition flex items-center group active:scale-95 shadow-sm"
|
||||
>
|
||||
<ChevronRight className="w-3.5 h-3.5 group-hover:translate-x-0.5 transition-transform" />
|
||||
</button>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { TrendingUp, TrendingDown, Search, Activity, Zap, CheckCircle2 } from "lucide-react";
|
||||
import { TrendingUp, TrendingDown, Search, Activity, Zap, CheckCircle2, ChevronLeft } from "lucide-react";
|
||||
import { soundFX } from "@/lib/soundEffects";
|
||||
|
||||
export interface WatchlistAsset {
|
||||
@@ -72,12 +72,14 @@ interface WatchlistRadarProps {
|
||||
activeSymbol: string;
|
||||
onSelectSymbol: (symbol: string) => void;
|
||||
liveGoldTick?: { bid: number; ask: number; spread_pips: number } | null;
|
||||
onCollapse?: () => void;
|
||||
}
|
||||
|
||||
export const WatchlistRadar: React.FC<WatchlistRadarProps> = ({
|
||||
activeSymbol,
|
||||
onSelectSymbol,
|
||||
liveGoldTick,
|
||||
onCollapse,
|
||||
}) => {
|
||||
const [filter, setFilter] = useState("");
|
||||
const [tab, setTab] = useState<"all" | "metals" | "forex" | "crypto">("all");
|
||||
@@ -116,9 +118,23 @@ export const WatchlistRadar: React.FC<WatchlistRadarProps> = ({
|
||||
<Activity className="w-3.5 h-3.5 text-cyan-400" />
|
||||
<h2 className="font-bold text-xs tracking-wider text-gray-200 uppercase font-mono">Market Radar</h2>
|
||||
</div>
|
||||
<span className="text-[10px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 flex items-center gap-1">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse" /> LIVE
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-[10px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 flex items-center gap-1">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse" /> LIVE
|
||||
</span>
|
||||
{onCollapse && (
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onCollapse();
|
||||
}}
|
||||
title="সাইডবার চিপুন (Collapse Market Radar)"
|
||||
className="p-1 rounded bg-[#060b16] hover:bg-cyan-500/20 border border-cyan-500/30 text-cyan-400 hover:text-white transition flex items-center group active:scale-95 shadow-sm"
|
||||
>
|
||||
<ChevronLeft className="w-3.5 h-3.5 group-hover:-translate-x-0.5 transition-transform" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tabs */}
|
||||
|
||||
Reference in New Issue
Block a user