FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
brokers update
tilakpatel2282b334ef1ddc
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/brokers/angelone.rs b/fincept-terminal-desktop/src-tauri/src/commands/brokers/angelone.rsnew file mode 100644index 000000000..2b685ef8b--- /dev/null+++ b/fincept-terminal-desktop/src-tauri/src/commands/brokers/angelone.rs@@ -0,0 +1,160 @@+//! AngelOne (Angel Broking) API Commands+//!+//! Authentication and order management for Angel Broking (AngelOne)++use reqwest::Client;+use serde_json::{json, Value};+use super::common::ApiResponse;++/// Base URL for AngelOne API+const ANGELONE_BASE_URL: &str = "https://apiconnect.angelbroking.com";++/// AngelOne login - authenticate with client code, password (PIN), and TOTP+#[tauri::command]+pub async fn angelone_login(+ api_key: String,+ client_code: String,+ password: String,+ totp: String,+) -> ApiResponse<Value> {+ let client = Client::new();+ let timestamp = chrono::Utc::now().timestamp_millis();++ let payload = json!({+ "clientcode": client_code,+ "password": password,+ "totp": totp+ });++ let url = format!("{}/rest/auth/angelbroking/user/v1/loginByPassword", ANGELONE_BASE_URL);++ match client+ .post(&url)+ .header("Content-Type", "application/json")+ .header("Accept", "application/json")+ .header("X-UserType", "USER")+ .header("X-SourceID", "WEB")+ .header("X-ClientLocalIP", "127.0.0.1")+ .header("X-ClientPublicIP", "127.0.0.1")+ .header("X-MACAddress", "00:00:00:00:00:00")+ .header("X-PrivateKey", &api_key)+ .json(&payload)+ .send()+ .await+ {+ Ok(response) => {+ let status = response.status();++ match response.json::<Value>().await {+ Ok(data) => {+ if status.is_success() {+ // Extract tokens from response+ if let Some(data_obj) = data.get("data") {+ let jwt_token = data_obj.get("jwtToken")+ .and_then(|v| v.as_str())+ .unwrap_or("");+ let feed_token = data_obj.get("feedToken")+ .and_then(|v| v.as_str());+ let refresh_token = data_obj.get("refreshToken")+ .and_then(|v| v.as_str());++ if !jwt_token.is_empty() {+ return ApiResponse {+ success: true,+ data: Some(json!({+ "access_token": jwt_token,+ "feed_token": feed_token,+ "refresh_token": refresh_token,+ "user_id": client_code+ })),+ error: None,+ timestamp,+ };+ }+ }++ // Authentication failed+ let error_msg = data.get("message")+ .and_then(|v| v.as_str())+ .unwrap_or("Authentication failed");++ ApiResponse {+ success: false,+ data: None,+ error: Some(error_msg.to_string()),+ timestamp,+ }+ } else {+ let error_msg = data.get("message")+ .and_then(|v| v.as_str())+ .map(|s| s.to_string())+ .unwrap_or_else(|| format!("HTTP error: {}", status));++ ApiResponse {+ success: false,+ data: None,+ error: Some(error_msg),+ timestamp,+ }+ }+ }+ Err(e) => ApiResponse {+ success: false,+ data: None,+ error: Some(format!("Failed to parse response: {}", e)),+ timestamp,+ },+ }+ }+ Err(e) => ApiResponse {+ success: false,+ data: None,+ error: Some(format!("Request failed: {}", e)),+ timestamp,+ },+ }+}++/// Validate AngelOne access token+#[tauri::command]+pub async fn angelone_validate_token(+ auth_token: String,+ api_key: String,+) -> ApiResponse<bool> {+ let client = Client::new();+ let timestamp = chrono::Utc::now().timestamp_millis();++ // Use profile endpoint to validate token+ let url = format!("{}/rest/secure/angelbroking/user/v1/getProfile", ANGELONE_BASE_URL);++ match client+ .get(&url)+ .header("Authorization", format!("Bearer {}", auth_token))+ .header("Content-Type", "application/json")+ .header("Accept", "application/json")+ .header("X-UserType", "USER")+ .header("X-SourceID", "WEB")+ .header("X-ClientLocalIP", "127.0.0.1")+ .header("X-ClientPublicIP", "127.0.0.1")+ .header("X-MACAddress", "00:00:00:00:00:00")+ .header("X-PrivateKey", &api_key)+ .send()+ .await+ {+ Ok(response) => {+ let is_valid = response.status().is_success();+ ApiResponse {+ success: is_valid,+ data: Some(is_valid),+ error: if is_valid { None } else { Some("Token validation failed".to_string()) },+ timestamp,+ }+ }+ Err(e) => ApiResponse {+ success: false,+ data: Some(false),+ error: Some(format!("Validation request failed: {}", e)),+ timestamp,+ },+ }+}diff --git a/fincept-terminal-desktop/src-tauri/src/commands/brokers/fyers.rs b/fincept-terminal-desktop/src-tauri/src/commands/brokers/fyers.rsindex 4dd9baa8c..b8263c54f 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/brokers/fyers.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/brokers/fyers.rs@@ -37,6 +37,22 @@ fn create_fyers_headers(api_key: &str, access_token: &str) -> HeaderMap {headers}+/// Validate that credentials are present and non-empty+/// Returns Err if credentials are missing or appear invalid+fn validate_credentials(api_key: &str, access_token: &str) -> Result<(), String> {+ if api_key.is_empty() {+ return Err("API key is empty. Please authenticate first.".to_string());+ }+ if access_token.is_empty() {+ return Err("Access token is empty. Please authenticate first.".to_string());+ }+ // Fyers access tokens should be at least 40 characters+ if access_token.len() < 40 {+ return Err("Access token appears invalid or expired. Please re-authenticate.".to_string());+ }+ Ok(())+}+// ============================================================================// Fyers Authentication Commands// ============================================================================@@ -503,6 +519,17 @@ pub async fn fyers_get_quotes(access_token: String,symbols: Vec<String>,) -> Result<ApiResponse<Value>, String> {+ // Validate credentials early to avoid unnecessary API calls+ if let Err(e) = validate_credentials(&api_key, &access_token) {+ eprintln!("[fyers_get_quotes] Credential validation failed: {}", e);+ return Ok(ApiResponse {+ success: false,+ data: None,+ error: Some(e),+ timestamp: chrono::Utc::now().timestamp(),+ });+ }+let timestamp = chrono::Utc::now().timestamp();let headers = create_fyers_headers(&api_key, &access_token);let client = reqwest::Client::new();@@ -587,6 +614,17 @@ pub async fn fyers_get_history(from_date: String,to_date: String,) -> Result<ApiResponse<Value>, String> {+ // Validate credentials early to avoid unnecessary API calls+ if let Err(e) = validate_credentials(&api_key, &access_token) {+ eprintln!("[fyers_get_history] Credential validation failed: {}", e);+ return Ok(ApiResponse {+ success: false,+ data: None,+ error: Some(e),+ timestamp: chrono::Utc::now().timestamp(),+ });+ }+let timestamp = chrono::Utc::now().timestamp();let headers = create_fyers_headers(&api_key, &access_token);let client = reqwest::Client::new();@@ -701,6 +739,17 @@ pub async fn fyers_get_depth(access_token: String,symbol: String,) -> Result<ApiResponse<Value>, String> {+ // Validate credentials early to avoid unnecessary API calls+ if let Err(e) = validate_credentials(&api_key, &access_token) {+ eprintln!("[fyers_get_depth] Credential validation failed: {}", e);+ return Ok(ApiResponse {+ success: false,+ data: None,+ error: Some(e),+ timestamp: chrono::Utc::now().timestamp(),+ });+ }+let timestamp = chrono::Utc::now().timestamp();let headers = create_fyers_headers(&api_key, &access_token);let client = reqwest::Client::new();diff --git a/fincept-terminal-desktop/src-tauri/src/commands/brokers/mod.rs b/fincept-terminal-desktop/src-tauri/src/commands/brokers/mod.rsindex 7097b2235..5ac74aabf 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/brokers/mod.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/brokers/mod.rs@@ -11,6 +11,7 @@//! - **Kotak**: Full-featured broker with TOTP+MPIN auth//! - **Groww**: Groww trading platform integration//! - **AliceBlue**: AliceBlue ANT API integration+//! - **AngelOne**: Angel Broking API with TOTP auth//! - **5Paisa**: 5Paisa trading platform integration//! - **IIFL**: IIFL Securities trading integration//! - **Motilal**: Motilal Oswal trading integration@@ -56,6 +57,7 @@ pub mod dhan;pub mod kotak;pub mod groww;pub mod aliceblue;+pub mod angelone;pub mod fivepaisa;pub mod iifl;pub mod motilal;@@ -93,6 +95,9 @@ pub use groww::*;// Re-export everything from aliceblue (includes tauri command wrappers)pub use aliceblue::*;+// Re-export everything from angelone (includes tauri command wrappers)+pub use angelone::*;+// Re-export everything from fivepaisa (includes tauri command wrappers)pub use fivepaisa::*;diff --git a/fincept-terminal-desktop/src/brokers/stocks/BaseStockBrokerAdapter.ts b/fincept-terminal-desktop/src/brokers/stocks/BaseStockBrokerAdapter.tsindex a18ffd976..34e8538cc 100644--- a/fincept-terminal-desktop/src/brokers/stocks/BaseStockBrokerAdapter.ts+++ b/fincept-terminal-desktop/src/brokers/stocks/BaseStockBrokerAdapter.ts@@ -279,6 +279,24 @@ export abstract class BaseStockBrokerAdapter implements IStockBrokerAdapter {return BaseStockBrokerAdapter.isTokenValidForTodayIST(tokenTimestamp);}+ // ============================================================================+ // Authentication Guard+ // ============================================================================++ /**+ * Ensure user is authenticated before making API calls+ * Checks both credentials AND connection status (token validity)+ * Throws error if not authenticated - prevents unnecessary API calls with invalid tokens+ */+ protected ensureAuthenticated(): void {+ if (!this.accessToken) {+ throw new Error('Not authenticated. Please login first.');+ }+ if (!this._isConnected) {+ throw new Error('Session expired or invalid. Please re-authenticate.');+ }+ }+// ============================================================================// Rate Limiting// ============================================================================diff --git a/fincept-terminal-desktop/src/brokers/stocks/india/fyers/FyersAdapter.ts b/fincept-terminal-desktop/src/brokers/stocks/india/fyers/FyersAdapter.tsindex 66e7d10ee..9787dafd0 100644--- a/fincept-terminal-desktop/src/brokers/stocks/india/fyers/FyersAdapter.ts+++ b/fincept-terminal-desktop/src/brokers/stocks/india/fyers/FyersAdapter.ts@@ -1929,14 +1929,7 @@ export class FyersAdapter extends BaseStockBrokerAdapter {// Helper Methods// ============================================================================- /**- * Ensure user is authenticated before making API calls- */- private ensureAuthenticated(): void {- if (!this.accessToken || !this.apiKey) {- throw new Error('Not authenticated. Please login first.');- }- }+ // ensureAuthenticated() inherited from BaseStockBrokerAdapter/*** Store credentials securelydiff --git a/fincept-terminal-desktop/src/brokers/stocks/india/kotak/KotakAdapter.ts b/fincept-terminal-desktop/src/brokers/stocks/india/kotak/KotakAdapter.tsindex 8f6337382..16ac4d60c 100644--- a/fincept-terminal-desktop/src/brokers/stocks/india/kotak/KotakAdapter.ts+++ b/fincept-terminal-desktop/src/brokers/stocks/india/kotak/KotakAdapter.ts@@ -67,10 +67,11 @@ export class KotakAdapter extends BaseStockBrokerAdapter {readonly region: Region = 'india';readonly metadata: StockBrokerMetadata = KOTAK_METADATA;- private apiKey: string | null = null; // neo-fin-key (consumer key)+ private ucc: string | null = null; // User Client Code (stored as apiKey)+ protected accessToken: string | null = null; // neo-fin-key access token (stored as apiSecret)private mobileNumber: string | null = null;- private ucc: string | null = null; // User Client Code- private mpin: string | null = null;+ private mpin: string | null = null; // 6-digit MPIN (stored as userId)+ protected apiKey: string | null = null; // Alias for UCC (for base class compatibility)// Intermediate auth state (between TOTP and MPIN)private viewToken: string | null = null;@@ -93,16 +94,21 @@ export class KotakAdapter extends BaseStockBrokerAdapter {/*** Set API credentials before authentication*- * For Kotak:- * - apiKey = neo-fin-key (consumer key)- * - apiSecret = mpin- * - userId = UCC (User Client Code)- * - Additional: mobileNumber required+ * For Kotak (OpenAlgo mapping):+ * - apiKey = UCC (User Client Code)+ * - apiSecret = Access Token (neo-fin-key consumer token)*/- setCredentials(apiKey: string, apiSecret: string, userId?: string): void {- this.apiKey = apiKey;- this.mpin = apiSecret;- this.ucc = userId || null;+ setCredentials(apiKey: string, apiSecret: string): void {+ this.ucc = apiKey; // UCC is primary identifier+ this.apiKey = apiKey; // Set apiKey for base class compatibility+ this.accessToken = apiSecret; // Access token for authorization+ }++ /**+ * Set MPIN separately (Kotak-specific)+ */+ setMpin(mpin: string): void {+ this.mpin = mpin;}/**@@ -128,13 +134,23 @@ export class KotakAdapter extends BaseStockBrokerAdapter {* Returns view_token and view_sid for step 2*/async loginWithTotp(totp: string): Promise<{ success: boolean; message: string }> {- if (!this.apiKey || !this.mobileNumber || !this.ucc) {+ if (!this.ucc || !this.accessToken || !this.mobileNumber) {return {success: false,- message: 'Missing credentials. Call setCredentials() and setMobileNumber() first.',+ message: 'Missing credentials. UCC, Access Token, and Mobile Number required.',};}+ // Ensure mobile number has +91 prefix+ let mobile = this.mobileNumber.trim().replace(/\s/g, '');+ if (mobile.startsWith('+91')) {+ // Already has prefix+ } else if (mobile.startsWith('91') && mobile.length === 12) {+ mobile = `+${mobile}`;+ } else {+ mobile = `+91${mobile}`;+ }+try {const response = await invoke<{success: boolean;@@ -144,9 +160,9 @@ export class KotakAdapter extends BaseStockBrokerAdapter {};error?: string;}>('kotak_totp_login', {- consumerKey: this.apiKey,- mobileNumber: this.mobileNumber,ucc: this.ucc,+ accessToken: this.accessToken,+ mobileNumber: mobile,totp,});@@ -262,9 +278,10 @@ export class KotakAdapter extends BaseStockBrokerAdapter {*/async authenticate(credentials: BrokerCredentials): Promise<AuthResponse> {try {- this.apiKey = credentials.apiKey;- this.mpin = credentials.apiSecret || null;- this.ucc = credentials.userId || null;+ this.ucc = credentials.apiKey; // UCC stored as apiKey+ this.apiKey = credentials.apiKey; // Set for base class compatibility+ this.accessToken = credentials.apiSecret || null; // Access token as apiSecret+ this.mpin = credentials.userId || null; // MPIN as userId// If access token provided, validate itif (credentials.accessToken) {@@ -341,11 +358,22 @@ export class KotakAdapter extends BaseStockBrokerAdapter {const credentials = await this.loadCredentials();if (!credentials) return false;- this.apiKey = credentials.apiKey;- this.mpin = credentials.apiSecret || null;- this.accessToken = credentials.accessToken || null;- this.ucc = credentials.userId || null;- this.userId = credentials.userId || null;+ this.ucc = credentials.apiKey; // UCC stored as apiKey+ this.apiKey = credentials.apiKey; // Set for base class compatibility+ this.accessToken = credentials.apiSecret || credentials.accessToken || null; // Access token+ this.mpin = credentials.userId || null; // MPIN stored as userId+ this.userId = this.ucc; // Set userId to UCC for identification++ // Load mobile number from additionalData+ const additionalData = (credentials as any).additionalData;+ if (additionalData) {+ try {+ const parsed = JSON.parse(additionalData);+ this.mobileNumber = parsed.mobileNumber || null;+ } catch (e) {+ console.warn('[Kotak] Failed to parse additionalData:', e);+ }+ }if (this.accessToken) {console.log('[Kotak] Validating stored access token...');diff --git a/fincept-terminal-desktop/src/brokers/stocks/india/shoonya/ShoonyaAdapter.ts b/fincept-terminal-desktop/src/brokers/stocks/india/shoonya/ShoonyaAdapter.tsindex c2d22707f..ba617a0aa 100644--- a/fincept-terminal-desktop/src/brokers/stocks/india/shoonya/ShoonyaAdapter.ts+++ b/fincept-terminal-desktop/src/brokers/stocks/india/shoonya/ShoonyaAdapter.ts@@ -1159,7 +1159,7 @@ export class ShoonyaAdapter extends BaseStockBrokerAdapter {// Helper Methods// ============================================================================- private ensureAuthenticated(): void {+ protected ensureAuthenticated(): void {if (!this.accessToken || !this.userId) {throw new Error('Not authenticated. Please login first.');}diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/EquityTradingTab.tsx b/fincept-terminal-desktop/src/components/tabs/equity-trading/EquityTradingTab.tsxindex a93d7ed55..45fb64a60 100644--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/EquityTradingTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/equity-trading/EquityTradingTab.tsx@@ -196,7 +196,11 @@ function EquityTradingContent() {// Subscribe to WebSocket for live prices and fetch initial datauseEffect(() => {- if (!adapter || !isAuthenticated || !selectedSymbol) return;+ // CRITICAL: Don't make any API calls if broker is not authenticated+ if (!adapter || !isAuthenticated || !selectedSymbol) {+ console.log('[EquityTrading] Skipping subscription - broker not authenticated or no symbol selected');+ return;+ }let isCancelled = false;@@ -319,7 +323,11 @@ function EquityTradingContent() {// Subscribe to watchlist via WebSocket for real-time updatesuseEffect(() => {- if (!adapter || !isAuthenticated || !useWebSocketForWatchlist) return;+ // CRITICAL: Don't make any API calls if broker is not authenticated+ if (!adapter || !isAuthenticated || !useWebSocketForWatchlist) {+ console.log('[EquityTrading] Skipping watchlist subscription - broker not authenticated or WS disabled');+ return;+ }let isCancelled = false;const subscribedSymbols: string[] = [];@@ -414,7 +422,11 @@ function EquityTradingContent() {// Fallback: Fetch watchlist quotes via REST if WebSocket is disabled// Uses smart polling based on market hours - polls frequently when open, uses cache when closeduseEffect(() => {- if (!adapter || !isAuthenticated || useWebSocketForWatchlist) return;+ // CRITICAL: Don't make any API calls if broker is not authenticated+ if (!adapter || !isAuthenticated || useWebSocketForWatchlist) {+ console.log('[EquityTrading] Skipping watchlist polling - broker not authenticated or WS enabled');+ return;+ }let isCancelled = false;let isPolling = false;@@ -502,7 +514,11 @@ function EquityTradingContent() {// Smart polling for selected symbol's quote and depth data// Polls based on market hours - more frequently when open, uses cache when closeduseEffect(() => {- if (!adapter || !isAuthenticated || !selectedSymbol) return;+ // CRITICAL: Don't make any API calls if broker is not authenticated+ if (!adapter || !isAuthenticated || !selectedSymbol) {+ console.log('[EquityTrading] Skipping symbol polling - broker not authenticated or no symbol');+ return;+ }let isCancelled = false;let isPolling = false;diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerAuthPanel.tsx b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerAuthPanel.tsxdeleted file mode 100644index e188369f7..000000000--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerAuthPanel.tsx+++ /dev/null@@ -1,809 +0,0 @@-/**- * Broker Authentication Panel - Fincept Style- *- * Handles OAuth and credential-based authentication for stock brokers- */--import React, { useState } from 'react';-import { KeyRound, ExternalLink, Loader2, AlertCircle, CheckCircle2, Eye, EyeOff, Lock, LogOut, Zap } from 'lucide-react';-import { open } from '@tauri-apps/plugin-shell';-import { useStockBrokerAuth, useStockBrokerSelection } from '@/contexts/StockBrokerContext';-import type { BrokerCredentials } from '@/brokers/stocks/types';--// Fincept color palette-const COLORS = {- ORANGE: '#FF8800',- GREEN: '#00D66F',- RED: '#FF3B3B',- CYAN: '#00E5FF',- YELLOW: '#FFD700',- BLUE: '#0088FF',- DARK_BG: '#000000',- PANEL_BG: '#0F0F0F',- HEADER_BG: '#1A1A1A',- BORDER: '#2A2A2A',- GRAY: '#787878',- MUTED: '#4A4A4A',- WHITE: '#FFFFFF',-};--interface BrokerAuthPanelProps {- onAuthSuccess?: () => void;-}--export function BrokerAuthPanel({ onAuthSuccess }: BrokerAuthPanelProps) {- const { metadata } = useStockBrokerSelection();- const { isAuthenticated, authenticate, logout, getAuthUrl, isConnecting, error, clearError, adapter } = useStockBrokerAuth();-- const [showCredentials, setShowCredentials] = useState(false);- const [credentials, setCredentials] = useState<BrokerCredentials>({- apiKey: '',- apiSecret: '',- accessToken: '',- userId: '',- totpSecret: '',- password: '',- pin: '',- });- const [callbackUrl, setCallbackUrl] = useState('');- const [showCallbackInput, setShowCallbackInput] = useState(false);-- // Handle OAuth flow- const handleOAuthLogin = async () => {- try {- const authUrl = await getAuthUrl();- if (authUrl) {- console.log('[BrokerAuthPanel] Opening OAuth URL:', authUrl.substring(0, 50) + '...');- await open(authUrl);- console.log('[BrokerAuthPanel] ✓ Browser opened successfully');- setShowCallbackInput(true);- } else {- console.error('[BrokerAuthPanel] No auth URL returned');- }- } catch (err) {- console.error('[BrokerAuthPanel] Failed to get auth URL:', err);- }- };-- // Handle callback URL submission- const handleCallbackSubmit = async () => {- try {- const url = new URL(callbackUrl);- const requestToken = url.searchParams.get('request_token');- const authCode = url.searchParams.get('auth_code');- const code = url.searchParams.get('code');-- const token = requestToken || authCode || code;-- if (!token) {- console.error('[BrokerAuthPanel] No auth code/token found in callback URL');- return;- }-- console.log('[BrokerAuthPanel] Found auth token, loading stored credentials...');-- const storedCreds = await (adapter as any)?.loadCredentials();-- if (!storedCreds || !storedCreds.apiKey) {- console.error('[BrokerAuthPanel] No stored credentials found. Please save API credentials first.');- return;- }-- const authCredentials: BrokerCredentials = {- apiKey: storedCreds.apiKey,- apiSecret: storedCreds.apiSecret,- };-- if (requestToken) {- (authCredentials as any).requestToken = requestToken;- } else if (authCode) {- (authCredentials as any).authCode = authCode;- } else {- authCredentials.accessToken = token;- }-- const response = await authenticate(authCredentials);-- if (response.success) {- console.log('[BrokerAuthPanel] ✓ Authentication successful');- setShowCallbackInput(false);- setCallbackUrl('');- if (onAuthSuccess) {- onAuthSuccess();- }- } else {- console.error('[BrokerAuthPanel] Authentication failed:', response.message);- }- } catch (err) {- console.error('[BrokerAuthPanel] Failed to process callback:', err);- }- };-- // Handle credential-based login- const handleCredentialLogin = async () => {- clearError();-- const response = await authenticate(credentials);- if (response.success && onAuthSuccess) {- onAuthSuccess();- }- };-- // Handle logout- const handleLogout = async () => {- await logout();- setCredentials({- apiKey: '',- apiSecret: '',- accessToken: '',- userId: '',- totpSecret: '',- password: '',- pin: '',- });- };-- // Test API endpoint- const testApiEndpoint = async () => {- try {- console.log('[BrokerAuthPanel] Testing API endpoint...');-- if (adapter && metadata?.id === 'zerodha') {- const quote = await adapter.getQuote('INFY', 'NSE');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! INFY LTP: ₹${quote.lastPrice}\nCheck console for full response`);- } else if (adapter && metadata?.id === 'fyers') {- const quote = await adapter.getQuote('RELIANCE', 'NSE');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! RELIANCE LTP: ₹${quote.lastPrice}\nCheck console for full response`);- } else if (adapter && metadata?.id === 'angelone') {- const quote = await adapter.getQuote('SBIN', 'NSE');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! SBIN LTP: ₹${quote.lastPrice}\nCheck console for full response`);- } else if (adapter && metadata?.id === 'saxobank') {- // Test Saxo Bank with a major European stock- const quote = await adapter.getQuote('SIE:xetr', 'XETR');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! Siemens AG Quote: €${quote.lastPrice}\nCheck console for full response`);- } else if (adapter && metadata?.id === 'alpaca') {- const quote = await adapter.getQuote('AAPL', 'NASDAQ');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! AAPL LTP: $${quote.lastPrice}\nCheck console for full response`);- } else if (adapter && metadata?.id === 'ibkr') {- const quote = await adapter.getQuote('AAPL', 'NASDAQ');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! AAPL LTP: $${quote.lastPrice}\nCheck console for full response`);- } else if (adapter && metadata?.id === 'tradier') {- const quote = await adapter.getQuote('AAPL', 'NASDAQ');- console.log('[BrokerAuthPanel] ✓ Quote received:', quote);- alert(`Success! AAPL LTP: $${quote.lastPrice}\nCheck console for full response`);- } else {- alert('Test only available for configured brokers');- }- } catch (err: any) {- console.error('[BrokerAuthPanel] API test failed:', err);- alert(`API test failed: ${err.message}\nCheck console for details`);- }- };-- if (!metadata) {- return (- <div style={{- padding: '24px',- backgroundColor: COLORS.HEADER_BG,- border: `1px solid ${COLORS.BORDER}`,- textAlign: 'center'- }}>- <p style={{ color: COLORS.GRAY, fontSize: '11px' }}>Select a broker to continue</p>- </div>- );- }-- // Already authenticated- if (isAuthenticated) {- return (- <div style={{- padding: '20px',- backgroundColor: COLORS.HEADER_BG,- border: `1px solid ${COLORS.BORDER}`,- fontFamily: '"IBM Plex Mono", monospace'- }}>- {/* Connected Header */}- <div style={{- display: 'flex',- alignItems: 'center',- gap: '12px',- marginBottom: '20px',- paddingBottom: '16px',- borderBottom: `1px solid ${COLORS.BORDER}`- }}>- <div style={{- width: '36px',- height: '36px',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- backgroundColor: `${COLORS.GREEN}20`,- border: `1px solid ${COLORS.GREEN}40`- }}>- <CheckCircle2 size={18} color={COLORS.GREEN} />- </div>- <div>- <h3 style={{ color: COLORS.WHITE, fontSize: '13px', fontWeight: 600, margin: 0 }}>- CONNECTED TO {metadata.displayName.toUpperCase()}- </h3>- <p style={{ color: COLORS.GREEN, fontSize: '10px', margin: '4px 0 0 0' }}>- Your broker account is linked- </p>- </div>- </div>-- {/* Action Buttons */}- <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>- <button- onClick={testApiEndpoint}- style={{- width: '100%',- padding: '10px 16px',- backgroundColor: `${COLORS.BLUE}20`,- border: `1px solid ${COLORS.BLUE}40`,- color: COLORS.BLUE,- fontSize: '11px',- fontWeight: 600,- fontFamily: '"IBM Plex Mono", monospace',- cursor: 'pointer',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px'- }}- >- <Zap size={14} />- TEST API ENDPOINT- </button>-- <button- onClick={handleLogout}- style={{- width: '100%',- padding: '10px 16px',- backgroundColor: `${COLORS.RED}20`,- border: `1px solid ${COLORS.RED}40`,- color: COLORS.RED,- fontSize: '11px',- fontWeight: 600,- fontFamily: '"IBM Plex Mono", monospace',- cursor: 'pointer',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px'- }}- >- <LogOut size={14} />- DISCONNECT BROKER- </button>- </div>- </div>- );- }-- return (- <div style={{- padding: '20px',- backgroundColor: COLORS.HEADER_BG,- border: `1px solid ${COLORS.BORDER}`,- fontFamily: '"IBM Plex Mono", monospace'- }}>- {/* Header */}- <div style={{- display: 'flex',- alignItems: 'center',- gap: '12px',- marginBottom: '20px',- paddingBottom: '16px',- borderBottom: `1px solid ${COLORS.BORDER}`- }}>- <div style={{- width: '36px',- height: '36px',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- backgroundColor: `${COLORS.ORANGE}20`,- border: `1px solid ${COLORS.ORANGE}40`- }}>- <KeyRound size={18} color={COLORS.ORANGE} />- </div>- <div>- <h3 style={{ color: COLORS.WHITE, fontSize: '13px', fontWeight: 600, margin: 0 }}>- CONNECT TO {metadata.displayName.toUpperCase()}- </h3>- <p style={{ color: COLORS.GRAY, fontSize: '10px', margin: '4px 0 0 0' }}>- {metadata.authType === 'oauth' ? 'OAuth 2.0 Authentication' : 'API Credentials'}- </p>- </div>- </div>-- {/* Error display */}- {error && (- <div style={{- marginBottom: '16px',- padding: '12px',- backgroundColor: `${COLORS.RED}15`,- border: `1px solid ${COLORS.RED}40`,- display: 'flex',- alignItems: 'center',- gap: '10px'- }}>- <AlertCircle size={16} color={COLORS.RED} />- <p style={{ color: COLORS.RED, fontSize: '11px', margin: 0 }}>{error}</p>- </div>- )}-- {/* OAuth Flow */}- {metadata.authType === 'oauth' && (- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>- <p style={{ color: COLORS.GRAY, fontSize: '11px', margin: 0, lineHeight: 1.6 }}>- Click the button below to authenticate with {metadata.displayName}. You will be redirected to their login page.- </p>-- <button- onClick={handleOAuthLogin}- disabled={isConnecting}- style={{- width: '100%',- padding: '12px 16px',- backgroundColor: isConnecting ? COLORS.MUTED : COLORS.ORANGE,- border: 'none',- color: isConnecting ? COLORS.GRAY : COLORS.DARK_BG,- fontSize: '11px',- fontWeight: 700,- fontFamily: '"IBM Plex Mono", monospace',- letterSpacing: '0.5px',- cursor: isConnecting ? 'not-allowed' : 'pointer',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px'- }}- >- {isConnecting ? (- <Loader2 size={14} className="animate-spin" />- ) : (- <ExternalLink size={14} />- )}- LOGIN WITH {metadata.displayName.toUpperCase()}- </button>-- {/* Callback URL Input */}- {showCallbackInput && (- <div style={{- marginTop: '8px',- padding: '16px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`- }}>- <div style={{ display: 'flex', alignItems: 'flex-start', gap: '10px', marginBottom: '12px' }}>- <AlertCircle size={16} color={COLORS.ORANGE} style={{ flexShrink: 0, marginTop: '2px' }} />- <div>- <p style={{ color: COLORS.WHITE, fontSize: '11px', fontWeight: 600, margin: '0 0 4px 0' }}>- PASTE CALLBACK URL- </p>- <p style={{ color: COLORS.GRAY, fontSize: '9px', margin: 0 }}>- After authorizing on {metadata.displayName}, copy the URL from your browser's address bar and paste it below.- </p>- </div>- </div>-- <input- type="text"- value={callbackUrl}- onChange={(e) => setCallbackUrl(e.target.value)}- placeholder="https://127.0.0.1/?auth_code=..."- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.HEADER_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '11px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box',- marginBottom: '12px'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />-- <button- onClick={handleCallbackSubmit}- disabled={!callbackUrl || isConnecting}- style={{- width: '100%',- padding: '10px 16px',- backgroundColor: !callbackUrl || isConnecting ? COLORS.MUTED : COLORS.GREEN,- border: 'none',- color: !callbackUrl || isConnecting ? COLORS.GRAY : COLORS.DARK_BG,- fontSize: '11px',- fontWeight: 700,- fontFamily: '"IBM Plex Mono", monospace',- cursor: !callbackUrl || isConnecting ? 'not-allowed' : 'pointer'- }}- >- COMPLETE AUTHENTICATION- </button>- </div>- )}-- <p style={{ color: COLORS.MUTED, fontSize: '9px', textAlign: 'center', margin: 0 }}>- You'll be redirected to {metadata.website} to authorize access- </p>- </div>- )}-- {/* Credential-based Flow */}- {metadata.authType !== 'oauth' && (- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>- {/* API Key */}- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- API KEY- </label>- <input- type="text"- value={credentials.apiKey}- onChange={(e) => setCredentials({ ...credentials, apiKey: e.target.value })}- placeholder="Enter your API key"- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- </div>-- {/* API Secret */}- {metadata.authType === 'api_key' && (- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- API SECRET- </label>- <div style={{ position: 'relative' }}>- <input- type={showCredentials ? 'text' : 'password'}- value={credentials.apiSecret || ''}- onChange={(e) => setCredentials({ ...credentials, apiSecret: e.target.value })}- placeholder="Enter your API secret"- style={{- width: '100%',- padding: '10px 40px 10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- <button- type="button"- onClick={() => setShowCredentials(!showCredentials)}- style={{- position: 'absolute',- right: '10px',- top: '50%',- transform: 'translateY(-50%)',- background: 'none',- border: 'none',- color: COLORS.GRAY,- cursor: 'pointer',- padding: '4px'- }}- >- {showCredentials ? <EyeOff size={16} /> : <Eye size={16} />}- </button>- </div>- </div>- )}-- {/* TOTP auth fields (Angel One style) */}- {metadata.authType === 'totp' && (- <>- {/* Client Code / User ID */}- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- CLIENT CODE / USER ID- </label>- <input- type="text"- value={credentials.userId || ''}- onChange={(e) => setCredentials({ ...credentials, userId: e.target.value })}- placeholder="Enter your client code"- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- </div>-- {/* Password */}- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- PASSWORD- </label>- <div style={{ position: 'relative' }}>- <input- type={showCredentials ? 'text' : 'password'}- value={credentials.password || ''}- onChange={(e) => setCredentials({ ...credentials, password: e.target.value })}- placeholder="Enter your password"- style={{- width: '100%',- padding: '10px 40px 10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- <button- type="button"- onClick={() => setShowCredentials(!showCredentials)}- style={{- position: 'absolute',- right: '10px',- top: '50%',- transform: 'translateY(-50%)',- background: 'none',- border: 'none',- color: COLORS.GRAY,- cursor: 'pointer',- padding: '4px'- }}- >- {showCredentials ? <EyeOff size={16} /> : <Eye size={16} />}- </button>- </div>- </div>-- {/* TOTP Code */}- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- TOTP CODE- </label>- <input- type="text"- value={credentials.pin || ''}- onChange={(e) => setCredentials({ ...credentials, pin: e.target.value })}- placeholder="Enter 6-digit TOTP code"- maxLength={6}- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box',- letterSpacing: '4px',- textAlign: 'center'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px' }}>- Enter the 6-digit code from your authenticator app- </p>- </div>- </>- )}-- {/* Password auth fields */}- {metadata.authType === 'password' && (- <>- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- USER ID- </label>- <input- type="text"- value={credentials.userId || ''}- onChange={(e) => setCredentials({ ...credentials, userId: e.target.value })}- placeholder="Enter your user ID"- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- </div>- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- PASSWORD- </label>- <input- type="password"- value={credentials.password || ''}- onChange={(e) => setCredentials({ ...credentials, password: e.target.value })}- placeholder="Enter your password"- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- </div>- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- TRADING PIN- </label>- <input- type="password"- value={credentials.pin || ''}- onChange={(e) => setCredentials({ ...credentials, pin: e.target.value })}- placeholder="Enter your trading PIN"- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- </div>- </>- )}-- <button- onClick={handleCredentialLogin}- disabled={isConnecting || !credentials.apiKey}- style={{- width: '100%',- padding: '12px 16px',- backgroundColor: isConnecting || !credentials.apiKey ? COLORS.MUTED : COLORS.ORANGE,- border: 'none',- color: isConnecting || !credentials.apiKey ? COLORS.GRAY : COLORS.DARK_BG,- fontSize: '11px',- fontWeight: 700,- fontFamily: '"IBM Plex Mono", monospace',- letterSpacing: '0.5px',- cursor: isConnecting || !credentials.apiKey ? 'not-allowed' : 'pointer',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px',- marginTop: '8px'- }}- >- {isConnecting ? (- <Loader2 size={14} className="animate-spin" />- ) : (- <Lock size={14} />- )}- CONNECT BROKER- </button>- </div>- )}-- {/* Security Note */}- <div style={{- marginTop: '20px',- padding: '12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`- }}>- <p style={{ color: COLORS.MUTED, fontSize: '9px', margin: 0, lineHeight: 1.6 }}>- Your credentials are stored securely on your local device and are never sent to our servers.- We only communicate directly with {metadata.displayName}'s API.- </p>- </div>- </div>- );-}diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerConfigPanel.tsx b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerConfigPanel.tsxdeleted file mode 100644index 5dae3a75c..000000000--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerConfigPanel.tsx+++ /dev/null@@ -1,468 +0,0 @@-/**- * Broker Configuration Panel - Fincept Style- *- * Handles broker API key configuration before authentication- * Required for OAuth brokers like Zerodha and Fyers- */--import React, { useState, useEffect } from 'react';-import { Settings, Save, Eye, EyeOff, AlertCircle, CheckCircle2, ExternalLink, HelpCircle, Loader2 } from 'lucide-react';-import { useStockBrokerSelection, useStockBrokerContext } from '@/contexts/StockBrokerContext';-import { createStockBrokerAdapter } from '@/brokers/stocks';-import type { BrokerCredentials } from '@/brokers/stocks/types';--// Fincept color palette-const COLORS = {- ORANGE: '#FF8800',- GREEN: '#00D66F',- RED: '#FF3B3B',- CYAN: '#00E5FF',- YELLOW: '#FFD700',- DARK_BG: '#000000',- PANEL_BG: '#0F0F0F',- HEADER_BG: '#1A1A1A',- BORDER: '#2A2A2A',- GRAY: '#787878',- MUTED: '#4A4A4A',- WHITE: '#FFFFFF',-};--interface BrokerConfigPanelProps {- onConfigSaved?: () => void;-}--export function BrokerConfigPanel({ onConfigSaved }: BrokerConfigPanelProps) {- const { metadata, broker, setBroker } = useStockBrokerSelection();- const { adapter } = useStockBrokerContext();-- const [showSecret, setShowSecret] = useState(false);- const [config, setConfig] = useState<BrokerCredentials>({- apiKey: '',- apiSecret: '',- });- const [isSaving, setIsSaving] = useState(false);- const [saveSuccess, setSaveSuccess] = useState(false);- const [error, setError] = useState<string | null>(null);-- // Debug: Log adapter availability- useEffect(() => {- console.log('[BrokerConfigPanel] Component mounted/updated', {- hasMetadata: !!metadata,- metadataId: metadata?.id,- hasAdapter: !!adapter,- adapterType: adapter?.constructor.name,- hasSetCredentials: !!(adapter && adapter.setCredentials),- });- }, [adapter, metadata]);-- // Load existing config on mount- useEffect(() => {- if (adapter) {- setConfig({- apiKey: '',- apiSecret: '',- });- }- }, [adapter, metadata?.id]);-- const handleSave = async () => {- setError(null);- setSaveSuccess(false);-- // Validation- if (!config.apiKey?.trim()) {- setError('API Key is required');- return;- }-- if (metadata?.authType === 'oauth' && !config.apiSecret?.trim()) {- setError('API Secret is required for OAuth brokers');- return;- }-- if (!metadata) {- setError('No broker selected');- return;- }-- setIsSaving(true);-- try {- console.log('[BrokerConfigPanel] === SAVE CONFIGURATION STARTED ===');-- // Get or create adapter- let adapterToUse = adapter;-- if (!adapterToUse) {- console.log('[BrokerConfigPanel] Creating temporary adapter for configuration');- adapterToUse = createStockBrokerAdapter(metadata.id);- }-- // Set credentials on the adapter- if (!adapterToUse.setCredentials) {- throw new Error(`${metadata.displayName} does not support credential configuration.`);- }-- // Store to database FIRST- await (adapterToUse as any).storeCredentials({- apiKey: config.apiKey,- apiSecret: config.apiSecret || '',- });-- // THEN set on adapter instance (in-memory)- adapterToUse.setCredentials(config.apiKey, config.apiSecret || '');-- // If we created a temporary adapter and broker is selected, re-select- if (!adapter && broker) {- await setBroker(broker);- }-- setSaveSuccess(true);- setTimeout(() => setSaveSuccess(false), 3000);-- if (onConfigSaved) {- onConfigSaved();- }- } catch (err) {- console.error('[BrokerConfigPanel] Save failed:', err);- setError(err instanceof Error ? err.message : 'Failed to save configuration');- } finally {- setIsSaving(false);- }- };-- // Get API credentials URL for the broker- const getApiKeysUrl = (brokerId: string) => {- const urls: Record<string, string> = {- zerodha: 'https://developers.kite.trade/',- fyers: 'https://myapi.fyers.in/dashboard',- angelone: 'https://smartapi.angelbroking.com/publisher-login',- angel: 'https://smartapi.angelbroking.com/',- dhan: 'https://dhanhq.co/api',- upstox: 'https://upstox.com/developer/api/',- kotak: 'https://napi.kotaksecurities.com/devportal/',- saxobank: 'https://www.developer.saxo/openapi/appmanagement',- alpaca: 'https://app.alpaca.markets/brokerage/new-account',- ibkr: 'https://www.interactivebrokers.com/en/trading/ib-api.php',- };- return urls[brokerId] || metadata?.website || '#';- };-- if (!metadata) {- return (- <div style={{- padding: '24px',- backgroundColor: COLORS.HEADER_BG,- border: `1px solid ${COLORS.BORDER}`,- textAlign: 'center'- }}>- <p style={{ color: COLORS.GRAY, fontSize: '11px' }}>Select a broker to configure</p>- </div>- );- }-- return (- <div style={{- padding: '20px',- backgroundColor: COLORS.HEADER_BG,- border: `1px solid ${COLORS.BORDER}`,- fontFamily: '"IBM Plex Mono", monospace'- }}>- {/* Header */}- <div style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- marginBottom: '20px',- paddingBottom: '16px',- borderBottom: `1px solid ${COLORS.BORDER}`- }}>- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>- <div style={{- width: '36px',- height: '36px',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- backgroundColor: `${COLORS.ORANGE}20`,- border: `1px solid ${COLORS.ORANGE}40`- }}>- <Settings size={18} color={COLORS.ORANGE} />- </div>- <div>- <h3 style={{ color: COLORS.WHITE, fontSize: '13px', fontWeight: 600, margin: 0 }}>- CONFIGURE {metadata.displayName.toUpperCase()}- </h3>- <p style={{ color: COLORS.GRAY, fontSize: '10px', margin: '4px 0 0 0' }}>- Set up your API credentials- </p>- </div>- </div>-- <a- href={getApiKeysUrl(metadata.id)}- target="_blank"- rel="noopener noreferrer"- style={{- display: 'flex',- alignItems: 'center',- gap: '6px',- fontSize: '10px',- color: COLORS.ORANGE,- textDecoration: 'none',- padding: '6px 10px',- border: `1px solid ${COLORS.ORANGE}40`,- backgroundColor: `${COLORS.ORANGE}10`- }}- >- <HelpCircle size={12} />- GET API KEYS- <ExternalLink size={10} />- </a>- </div>-- {/* Success Message */}- {saveSuccess && (- <div style={{- marginBottom: '16px',- padding: '12px',- backgroundColor: `${COLORS.GREEN}15`,- border: `1px solid ${COLORS.GREEN}40`,- display: 'flex',- alignItems: 'center',- gap: '10px'- }}>- <CheckCircle2 size={16} color={COLORS.GREEN} />- <p style={{ color: COLORS.GREEN, fontSize: '11px', margin: 0 }}>Configuration saved successfully!</p>- </div>- )}-- {/* Error Message */}- {error && (- <div style={{- marginBottom: '16px',- padding: '12px',- backgroundColor: `${COLORS.RED}15`,- border: `1px solid ${COLORS.RED}40`,- display: 'flex',- alignItems: 'center',- gap: '10px'- }}>- <AlertCircle size={16} color={COLORS.RED} />- <p style={{ color: COLORS.RED, fontSize: '11px', margin: 0 }}>{error}</p>- </div>- )}-- {/* Info Box for OAuth Brokers */}- {metadata.authType === 'oauth' && (- <div style={{- marginBottom: '16px',- padding: '14px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`- }}>- <h4 style={{- color: COLORS.WHITE,- fontSize: '11px',- fontWeight: 600,- margin: '0 0 10px 0',- display: 'flex',- alignItems: 'center',- gap: '8px'- }}>- <HelpCircle size={14} color={COLORS.ORANGE} />- HOW TO GET YOUR API CREDENTIALS- </h4>- <ol style={{- color: COLORS.GRAY,- fontSize: '10px',- margin: 0,- paddingLeft: '16px',- lineHeight: 1.8- }}>- <li>Visit <a href={getApiKeysUrl(metadata.id)} target="_blank" rel="noopener noreferrer" style={{ color: COLORS.ORANGE }}>{metadata.displayName} Developer Portal</a></li>- <li>Create a new app or use an existing one</li>- <li>Copy your App ID (API Key) and App Secret</li>- <li>Set the redirect URL to: <code style={{ padding: '2px 6px', backgroundColor: COLORS.DARK_BG, color: COLORS.CYAN, fontSize: '9px' }}>http://127.0.0.1/</code></li>- <li>Paste your credentials below and save</li>- </ol>- </div>- )}-- {/* Form Fields */}- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>- {/* API Key */}- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- API KEY / APP ID- <span style={{ color: COLORS.RED, marginLeft: '4px' }}>*</span>- </label>- <input- type="text"- value={config.apiKey}- onChange={(e) => setConfig({ ...config, apiKey: e.target.value })}- placeholder={`Enter your ${metadata.displayName} API Key`}- style={{- width: '100%',- padding: '10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px' }}>- {metadata.id === 'zerodha' && 'Your Kite Connect API key'}- {metadata.id === 'fyers' && 'Your Fyers App ID'}- {metadata.id === 'angelone' && 'Your Angel One Smart API key'}- {metadata.id === 'dhan' && 'Your Dhan API App ID'}- {metadata.id === 'upstox' && 'Your Upstox API key'}- {metadata.id === 'kotak' && 'Your Kotak Neo Consumer Key (neo-fin-key)'}- {metadata.id === 'saxobank' && 'Your Saxo Bank OpenAPI App Key'}- {metadata.id === 'alpaca' && 'Your Alpaca API Key ID'}- {metadata.id === 'ibkr' && 'Your Interactive Brokers Client ID'}- {!['zerodha', 'fyers', 'angelone', 'dhan', 'upstox', 'kotak', 'saxobank', 'alpaca', 'ibkr'].includes(metadata.id) && 'Your broker API key'}- </p>- </div>-- {/* API Secret (for OAuth brokers) */}- {metadata.authType === 'oauth' && (- <div>- <label style={{- display: 'block',- color: COLORS.GRAY,- fontSize: '10px',- fontWeight: 600,- marginBottom: '6px',- letterSpacing: '0.5px'- }}>- API SECRET / APP SECRET- <span style={{ color: COLORS.RED, marginLeft: '4px' }}>*</span>- </label>- <div style={{ position: 'relative' }}>- <input- type={showSecret ? 'text' : 'password'}- value={config.apiSecret || ''}- onChange={(e) => setConfig({ ...config, apiSecret: e.target.value })}- placeholder="Enter your API Secret"- style={{- width: '100%',- padding: '10px 40px 10px 12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`,- color: COLORS.WHITE,- fontSize: '12px',- fontFamily: 'monospace',- outline: 'none',- boxSizing: 'border-box'- }}- onFocus={(e) => e.currentTarget.style.borderColor = COLORS.ORANGE}- onBlur={(e) => e.currentTarget.style.borderColor = COLORS.BORDER}- />- <button- type="button"- onClick={() => setShowSecret(!showSecret)}- style={{- position: 'absolute',- right: '10px',- top: '50%',- transform: 'translateY(-50%)',- background: 'none',- border: 'none',- color: COLORS.GRAY,- cursor: 'pointer',- padding: '4px'- }}- >- {showSecret ? <EyeOff size={16} /> : <Eye size={16} />}- </button>- </div>- <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px' }}>- {metadata.id === 'zerodha' && 'Your Kite Connect API secret'}- {metadata.id === 'fyers' && 'Your Fyers App Secret'}- {metadata.id === 'dhan' && 'Your Dhan API App Secret'}- {metadata.id === 'upstox' && 'Your Upstox API secret'}- {metadata.id === 'saxobank' && 'Your Saxo Bank OpenAPI App Secret'}- {metadata.id === 'alpaca' && 'Your Alpaca API Secret Key'}- {!['zerodha', 'fyers', 'dhan', 'upstox', 'saxobank', 'alpaca'].includes(metadata.id) && 'Your broker API secret'}- </p>- </div>- )}-- {/* Save Button */}- <button- onClick={handleSave}- disabled={isSaving || !config.apiKey}- style={{- width: '100%',- padding: '12px 16px',- backgroundColor: isSaving || !config.apiKey ? COLORS.MUTED : COLORS.ORANGE,- border: 'none',- color: isSaving || !config.apiKey ? COLORS.GRAY : COLORS.DARK_BG,- fontSize: '11px',- fontWeight: 700,- fontFamily: '"IBM Plex Mono", monospace',- letterSpacing: '0.5px',- cursor: isSaving || !config.apiKey ? 'not-allowed' : 'pointer',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px',- marginTop: '8px'- }}- >- {isSaving ? (- <>- <Loader2 size={14} className="animate-spin" />- SAVING...- </>- ) : (- <>- <Save size={14} />- SAVE CONFIGURATION- </>- )}- </button>- </div>-- {/* Security Note */}- <div style={{- marginTop: '20px',- padding: '12px',- backgroundColor: COLORS.PANEL_BG,- border: `1px solid ${COLORS.BORDER}`- }}>- <p style={{ color: COLORS.MUTED, fontSize: '9px', margin: 0, lineHeight: 1.6 }}>- <strong style={{ color: COLORS.GRAY }}>🔒 SECURITY:</strong> Your API credentials are stored securely on your local device using encrypted storage.- They are never sent to our servers and only used to communicate directly with {metadata.displayName}'s API.- </p>- </div>-- {/* Next Steps */}- {metadata.authType === 'oauth' && (- <div style={{- marginTop: '12px',- padding: '12px',- backgroundColor: `${COLORS.ORANGE}15`,- border: `1px solid ${COLORS.ORANGE}40`- }}>- <p style={{ color: COLORS.ORANGE, fontSize: '10px', margin: 0 }}>- <strong>NEXT STEP:</strong> After saving your configuration, switch to the <strong>AUTHENTICATION</strong> tab to complete the OAuth login flow.- </p>- </div>- )}- </div>- );-}diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerSetupPanel.tsx b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerSetupPanel.tsxdeleted file mode 100644index 410204bc4..000000000--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokerSetupPanel.tsx+++ /dev/null@@ -1,128 +0,0 @@-/**- * Broker Setup Panel - Fincept Style- *- * Combined panel showing both Configuration and Authentication tabs- */--import React, { useState } from 'react';-import { Settings, KeyRound } from 'lucide-react';-import { BrokerConfigPanel } from './BrokerConfigPanel';-import { BrokerAuthPanel } from './BrokerAuthPanel';--// Fincept color palette-const COLORS = {- ORANGE: '#FF8800',- GREEN: '#00D66F',- RED: '#FF3B3B',- CYAN: '#00E5FF',- DARK_BG: '#000000',- PANEL_BG: '#0F0F0F',- HEADER_BG: '#1A1A1A',- BORDER: '#2A2A2A',- GRAY: '#787878',- MUTED: '#4A4A4A',- WHITE: '#FFFFFF',-};--type SetupTab = 'config' | 'auth';--export function BrokerSetupPanel() {- const [activeTab, setActiveTab] = useState<SetupTab>('config');-- return (- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>- {/* Tab Navigation */}- <div style={{- display: 'flex',- gap: '0',- backgroundColor: COLORS.DARK_BG,- border: `1px solid ${COLORS.BORDER}`,- padding: '2px'- }}>- <button- onClick={() => setActiveTab('config')}- style={{- flex: 1,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px',- padding: '10px 16px',- backgroundColor: activeTab === 'config' ? COLORS.ORANGE : 'transparent',- border: 'none',- color: activeTab === 'config' ? COLORS.DARK_BG : COLORS.GRAY,- cursor: 'pointer',- fontSize: '11px',- fontWeight: 700,- fontFamily: '"IBM Plex Mono", monospace',- letterSpacing: '0.5px',- transition: 'all 0.15s ease'- }}- onMouseEnter={(e) => {- if (activeTab !== 'config') {- e.currentTarget.style.backgroundColor = COLORS.HEADER_BG;- e.currentTarget.style.color = COLORS.WHITE;- }- }}- onMouseLeave={(e) => {- if (activeTab !== 'config') {- e.currentTarget.style.backgroundColor = 'transparent';- e.currentTarget.style.color = COLORS.GRAY;- }- }}- >- <Settings size={14} />- CONFIGURATION- </button>- <button- onClick={() => setActiveTab('auth')}- style={{- flex: 1,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px',- padding: '10px 16px',- backgroundColor: activeTab === 'auth' ? COLORS.ORANGE : 'transparent',- border: 'none',- color: activeTab === 'auth' ? COLORS.DARK_BG : COLORS.GRAY,- cursor: 'pointer',- fontSize: '11px',- fontWeight: 700,- fontFamily: '"IBM Plex Mono", monospace',- letterSpacing: '0.5px',- transition: 'all 0.15s ease'- }}- onMouseEnter={(e) => {- if (activeTab !== 'auth') {- e.currentTarget.style.backgroundColor = COLORS.HEADER_BG;- e.currentTarget.style.color = COLORS.WHITE;- }- }}- onMouseLeave={(e) => {- if (activeTab !== 'auth') {- e.currentTarget.style.backgroundColor = 'transparent';- e.currentTarget.style.color = COLORS.GRAY;- }- }}- >- <KeyRound size={14} />- AUTHENTICATION- </button>- </div>-- {/* Tab Content */}- <div>- {activeTab === 'config' && (- <BrokerConfigPanel- onConfigSaved={() => {- // Auto-switch to auth tab after successful config- setTimeout(() => setActiveTab('auth'), 1500);- }}- />- )}- {activeTab === 'auth' && <BrokerAuthPanel />}- </div>- </div>- );-}diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokersManagementPanel.tsx b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokersManagementPanel.tsxindex 94a46544a..7a21664db 100644--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokersManagementPanel.tsx+++ b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/BrokersManagementPanel.tsx@@ -103,7 +103,8 @@ export function BrokersManagementPanel() {// Config Stateconst [showSecret, setShowSecret] = useState(false);- const [config, setConfig] = useState<BrokerCredentials>({ apiKey: '', apiSecret: '' });+ const [config, setConfig] = useState<BrokerCredentials>({ apiKey: '', apiSecret: '', userId: '' });+ const [mobileNumber, setMobileNumber] = useState(''); // Kotak-specificconst [isSaving, setIsSaving] = useState(false);const [saveSuccess, setSaveSuccess] = useState(false);const [configError, setConfigError] = useState<string | null>(null);@@ -287,17 +288,221 @@ export function BrokersManagementPanel() {try {const tempAdapter = createStockBrokerAdapter(selectedBrokerId!);- // Store credentials- await (tempAdapter as any).storeCredentials({+ // Prepare credentials+ const credentials: any = {apiKey: config.apiKey,apiSecret: config.apiSecret || '',- });+ userId: config.userId || '',+ };++ // Store broker-specific additional data+ const additionalData: any = {};++ if (selectedBroker.id === 'kotak' && mobileNumber) {+ additionalData.mobileNumber = mobileNumber;+ }++ if (selectedBroker.id === 'aliceblue' && (config as any).encryptionKey) {+ additionalData.encryptionKey = (config as any).encryptionKey;+ }++ if (selectedBroker.id === 'fivepaisa') {+ if ((config as any).email) additionalData.email = (config as any).email;+ if ((config as any).pin) additionalData.pin = (config as any).pin;+ }++ if (selectedBroker.id === 'motilal') {+ if ((config as any).password) additionalData.password = (config as any).password;+ if ((config as any).dob) additionalData.dob = (config as any).dob;+ }++ if (selectedBroker.id === 'angelone' && (config as any).pin) {+ additionalData.pin = (config as any).pin;+ }++ if (selectedBroker.id === 'shoonya' && (config as any).password) {+ additionalData.password = (config as any).password;+ }++ // Add additionalData to credentials if it has any fields+ if (Object.keys(additionalData).length > 0) {+ credentials.additionalData = JSON.stringify(additionalData);+ }++ // Store credentials+ await (tempAdapter as any).storeCredentials(credentials);// Set on adapterif (tempAdapter.setCredentials) {tempAdapter.setCredentials(config.apiKey, config.apiSecret || '');}+ // Kotak-specific: Set MPIN and mobile number+ if (selectedBroker.id === 'kotak') {+ if (config.userId && (tempAdapter as any).setMpin) {+ (tempAdapter as any).setMpin(config.userId);+ }+ if (mobileNumber && (tempAdapter as any).setMobileNumber) {+ (tempAdapter as any).setMobileNumber(mobileNumber);+ }+ }++ // Shoonya-specific: Authenticate immediately with TOTP+ if (selectedBroker.id === 'shoonya') {+ const shoonyaCredentials: any = {+ apiKey: config.apiKey,+ apiSecret: config.apiSecret || '',+ userId: config.userId || '',+ password: (config as any).password || '',+ totpCode: (config as any).totpCode || '',+ };++ const authResult = await tempAdapter.authenticate(shoonyaCredentials);++ if (!authResult.success) {+ setConfigError(authResult.message || 'Shoonya authentication failed');+ return;+ }++ // Update broker statuses with connected state+ setBrokerStatuses(prev => {+ const newMap = new Map(prev);+ const existing = newMap.get(selectedBrokerId!);+ if (existing) {+ newMap.set(selectedBrokerId!, { ...existing, status: 'connected', hasCredentials: true });+ }+ return newMap;+ });++ setSaveSuccess(true);+ setTimeout(() => setSaveSuccess(false), 3000);+ return;+ }++ // AngelOne-specific: Authenticate immediately with Client ID, PIN, TOTP+ if (selectedBroker.id === 'angelone') {+ const angeloneCredentials: any = {+ apiKey: config.apiKey,+ userId: config.userId || '',+ password: (config as any).pin || '', // Adapter expects 'password' field+ pin: (config as any).totpCode || '', // Adapter expects TOTP in 'pin' field+ };++ const authResult = await tempAdapter.authenticate(angeloneCredentials);++ if (!authResult.success) {+ setConfigError(authResult.message || 'Angel One authentication failed');+ return;+ }++ // Update broker statuses with connected state+ setBrokerStatuses(prev => {+ const newMap = new Map(prev);+ const existing = newMap.get(selectedBrokerId!);+ if (existing) {+ newMap.set(selectedBrokerId!, { ...existing, status: 'connected', hasCredentials: true });+ }+ return newMap;+ });++ setSaveSuccess(true);+ setTimeout(() => setSaveSuccess(false), 3000);+ return;+ }++ // AliceBlue-specific: Authenticate with User ID + Encryption Key+ if (selectedBroker.id === 'aliceblue') {+ const aliceblueCredentials: any = {+ apiKey: config.apiKey,+ apiSecret: config.apiSecret || '',+ userId: config.userId || '',+ encKey: (config as any).encryptionKey || '', // Adapter expects 'encKey' field+ };++ const authResult = await tempAdapter.authenticate(aliceblueCredentials);++ if (!authResult.success) {+ setConfigError(authResult.message || 'AliceBlue authentication failed');+ return;+ }++ setBrokerStatuses(prev => {+ const newMap = new Map(prev);+ const existing = newMap.get(selectedBrokerId!);+ if (existing) {+ newMap.set(selectedBrokerId!, { ...existing, status: 'connected', hasCredentials: true });+ }+ return newMap;+ });++ setSaveSuccess(true);+ setTimeout(() => setSaveSuccess(false), 3000);+ return;+ }++ // 5Paisa-specific: Authenticate with Email, PIN, TOTP+ if (selectedBroker.id === 'fivepaisa') {+ const fivepaisaCredentials: any = {+ apiKey: config.apiKey,+ apiSecret: config.apiSecret || '',+ email: (config as any).email || '',+ pin: (config as any).pin || '',+ totp: (config as any).totpCode || '', // Adapter expects 'totp' field+ };++ const authResult = await tempAdapter.authenticate(fivepaisaCredentials);++ if (!authResult.success) {+ setConfigError(authResult.message || '5Paisa authentication failed');+ return;+ }++ setBrokerStatuses(prev => {+ const newMap = new Map(prev);+ const existing = newMap.get(selectedBrokerId!);+ if (existing) {+ newMap.set(selectedBrokerId!, { ...existing, status: 'connected', hasCredentials: true });+ }+ return newMap;+ });++ setSaveSuccess(true);+ setTimeout(() => setSaveSuccess(false), 3000);+ return;+ }++ // Motilal Oswal-specific: Authenticate with User ID, Password, DOB, TOTP+ if (selectedBroker.id === 'motilal') {+ const motilalCredentials: any = {+ apiKey: config.apiKey,+ apiSecret: (config as any).password || '', // Adapter reads password from apiSecret+ userId: config.userId || '',+ password: (config as any).password || '', // Also provide as password field+ pin: (config as any).dob || '', // Adapter expects DOB in 'pin' field+ totpSecret: (config as any).totpCode || '', // Adapter expects 'totpSecret' field+ };++ const authResult = await tempAdapter.authenticate(motilalCredentials);++ if (!authResult.success) {+ setConfigError(authResult.message || 'Motilal Oswal authentication failed');+ return;+ }++ setBrokerStatuses(prev => {+ const newMap = new Map(prev);+ const existing = newMap.get(selectedBrokerId!);+ if (existing) {+ newMap.set(selectedBrokerId!, { ...existing, status: 'connected', hasCredentials: true });+ }+ return newMap;+ });++ setSaveSuccess(true);+ setTimeout(() => setSaveSuccess(false), 3000);+ return;+ }+// Update broker statusessetBrokerStatuses(prev => {const newMap = new Map(prev);@@ -760,16 +965,20 @@ export function BrokersManagementPanel() {</h3></div>- {/* API Key */}+ {/* API Key / UCC / Vendor Code */}<div style={{ marginBottom: '12px' }}><label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>- API KEY / APP ID <span style={{ color: COLORS.RED }}>*</span>+ {selectedBroker.id === 'kotak' ? 'UCC (USER CLIENT CODE)' : selectedBroker.id === 'shoonya' ? 'VENDOR CODE' : 'API KEY / APP ID'} <span style={{ color: COLORS.RED }}>*</span></label><inputtype="text"value={config.apiKey}onChange={(e) => setConfig({ ...config, apiKey: e.target.value })}- placeholder={`Enter your ${selectedBroker.displayName} API Key`}+ placeholder={+ selectedBroker.id === 'kotak' ? 'Enter your UCC (e.g., KS12345)' :+ selectedBroker.id === 'shoonya' ? 'Enter your Vendor Code' :+ `Enter your ${selectedBroker.displayName} API Key`+ }style={{width: '100%',padding: '10px 12px',@@ -782,13 +991,86 @@ export function BrokersManagementPanel() {boxSizing: 'border-box',}}/>+ {selectedBroker.id === 'kotak' && (+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your UCC (User Client Code) - Primary identifier+ </p>+ )}+ {selectedBroker.id === 'shoonya' && (+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Vendor Code from Shoonya API settings+ </p>+ )}</div>- {/* API Secret (for OAuth) */}- {selectedBroker.authType === 'oauth' && (+ {/* Mobile Number (Kotak only) */}+ {selectedBroker.id === 'kotak' && (<div style={{ marginBottom: '12px' }}><label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>- API SECRET <span style={{ color: COLORS.RED }}>*</span>+ MOBILE NUMBER <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={mobileNumber}+ onChange={(e) => setMobileNumber(e.target.value)}+ placeholder="10-digit mobile number"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Will be prefixed with +91 automatically+ </p>+ </div>+ )}++ {/* MPIN (Kotak only) */}+ {selectedBroker.id === 'kotak' && (+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ MPIN (6-DIGIT TRADING PIN) <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type={showSecret ? 'text' : 'password'}+ value={config.userId || ''}+ onChange={(e) => setConfig({ ...config, userId: e.target.value.replace(/\D/g, '').slice(0, 6) })}+ placeholder="Enter your 6-digit MPIN"+ maxLength={6}+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '16px',+ fontFamily: 'monospace',+ textAlign: 'center',+ letterSpacing: '4px',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your 6-digit trading MPIN+ </p>+ </div>+ )}++ {/* API Secret (for OAuth) or Access Token (for Kotak) or API Secret Key (for Shoonya) */}+ {(selectedBroker.authType === 'oauth' || selectedBroker.id === 'kotak' || selectedBroker.id === 'shoonya') && (+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ {selectedBroker.id === 'kotak' ? 'ACCESS TOKEN (NEO-FIN-KEY)' :+ selectedBroker.id === 'shoonya' ? 'API SECRET KEY' :+ 'API SECRET'} <span style={{ color: COLORS.RED }}>*</span></label><div style={{ position: 'relative' }}><input@@ -828,6 +1110,539 @@ export function BrokersManagementPanel() {</div>)}+ {/* Shoonya-specific fields: User ID, Password, TOTP */}+ {selectedBroker.id === 'shoonya' && (+ <>+ {/* User ID */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ USER ID <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={config.userId || ''}+ onChange={(e) => setConfig({ ...config, userId: e.target.value })}+ placeholder="Enter your Shoonya User ID"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your Shoonya trading account User ID+ </p>+ </div>++ {/* Password */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ PASSWORD <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <div style={{ position: 'relative' }}>+ <input+ type={showSecret ? 'text' : 'password'}+ value={(config as any).password || ''}+ onChange={(e) => setConfig({ ...config, password: e.target.value } as any)}+ placeholder="Enter your password"+ style={{+ width: '100%',+ padding: '10px 40px 10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <button+ type="button"+ onClick={() => setShowSecret(!showSecret)}+ style={{+ position: 'absolute',+ right: '12px',+ top: '50%',+ transform: 'translateY(-50%)',+ background: 'none',+ border: 'none',+ color: COLORS.GRAY,+ cursor: 'pointer',+ }}+ >+ {showSecret ? <EyeOff size={16} /> : <Eye size={16} />}+ </button>+ </div>+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your Shoonya trading password (will be SHA256 hashed)+ </p>+ </div>++ {/* TOTP */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ TOTP CODE <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={(config as any).totpCode || ''}+ onChange={(e) => setConfig({ ...config, totpCode: e.target.value.replace(/\D/g, '').slice(0, 6) } as any)}+ placeholder="Enter 6-digit TOTP"+ maxLength={6}+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '16px',+ fontFamily: 'monospace',+ textAlign: 'center',+ letterSpacing: '4px',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ TOTP code from your authenticator app+ </p>+ </div>+ </>+ )}++ {/* AngelOne-specific fields: Client ID, PIN, TOTP */}+ {selectedBroker.id === 'angelone' && (+ <>+ {/* Client ID */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ CLIENT ID <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={config.userId || ''}+ onChange={(e) => setConfig({ ...config, userId: e.target.value })}+ placeholder="Enter your Angel One Client ID"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your Angel One trading account Client ID+ </p>+ </div>++ {/* PIN */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ PIN <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <div style={{ position: 'relative' }}>+ <input+ type={showSecret ? 'text' : 'password'}+ value={(config as any).pin || ''}+ onChange={(e) => setConfig({ ...config, pin: e.target.value } as any)}+ placeholder="Enter your PIN"+ minLength={4}+ style={{+ width: '100%',+ padding: '10px 40px 10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <button+ type="button"+ onClick={() => setShowSecret(!showSecret)}+ style={{+ position: 'absolute',+ right: '12px',+ top: '50%',+ transform: 'translateY(-50%)',+ background: 'none',+ border: 'none',+ color: COLORS.GRAY,+ cursor: 'pointer',+ }}+ >+ {showSecret ? <EyeOff size={16} /> : <Eye size={16} />}+ </button>+ </div>+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your Angel One trading account PIN+ </p>+ </div>++ {/* TOTP */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ TOTP CODE <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={(config as any).totpCode || ''}+ onChange={(e) => setConfig({ ...config, totpCode: e.target.value.replace(/\D/g, '').slice(0, 6) } as any)}+ placeholder="Enter 6-digit TOTP"+ maxLength={6}+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '16px',+ fontFamily: 'monospace',+ textAlign: 'center',+ letterSpacing: '4px',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ 6-digit code from your authenticator app+ </p>+ </div>+ </>+ )}++ {/* AliceBlue-specific fields: User ID, Encryption Key */}+ {selectedBroker.id === 'aliceblue' && (+ <>+ {/* User ID */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ USER ID <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={config.userId || ''}+ onChange={(e) => setConfig({ ...config, userId: e.target.value })}+ placeholder="Enter your AliceBlue User ID"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your AliceBlue trading account User ID+ </p>+ </div>++ {/* Encryption Key */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ ENCRYPTION KEY <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <div style={{ position: 'relative' }}>+ <input+ type={showSecret ? 'text' : 'password'}+ value={(config as any).encryptionKey || ''}+ onChange={(e) => setConfig({ ...config, encryptionKey: e.target.value } as any)}+ placeholder="Enter your Encryption Key"+ style={{+ width: '100%',+ padding: '10px 40px 10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <button+ type="button"+ onClick={() => setShowSecret(!showSecret)}+ style={{+ position: 'absolute',+ right: '12px',+ top: '50%',+ transform: 'translateY(-50%)',+ background: 'none',+ border: 'none',+ color: COLORS.GRAY,+ cursor: 'pointer',+ }}+ >+ {showSecret ? <EyeOff size={16} /> : <Eye size={16} />}+ </button>+ </div>+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your AliceBlue Encryption Key (encKey)+ </p>+ </div>+ </>+ )}++ {/* 5Paisa-specific fields: Email, PIN, TOTP */}+ {selectedBroker.id === 'fivepaisa' && (+ <>+ {/* Email ID */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ EMAIL ID <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="email"+ value={(config as any).email || ''}+ onChange={(e) => setConfig({ ...config, email: e.target.value } as any)}+ placeholder="Enter your 5Paisa Email ID"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your 5Paisa registered Email ID+ </p>+ </div>++ {/* PIN */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ PIN <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <div style={{ position: 'relative' }}>+ <input+ type={showSecret ? 'text' : 'password'}+ value={(config as any).pin || ''}+ onChange={(e) => setConfig({ ...config, pin: e.target.value } as any)}+ placeholder="Enter your PIN"+ style={{+ width: '100%',+ padding: '10px 40px 10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <button+ type="button"+ onClick={() => setShowSecret(!showSecret)}+ style={{+ position: 'absolute',+ right: '12px',+ top: '50%',+ transform: 'translateY(-50%)',+ background: 'none',+ border: 'none',+ color: COLORS.GRAY,+ cursor: 'pointer',+ }}+ >+ {showSecret ? <EyeOff size={16} /> : <Eye size={16} />}+ </button>+ </div>+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your 5Paisa trading PIN+ </p>+ </div>++ {/* TOTP */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ TOTP CODE <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={(config as any).totpCode || ''}+ onChange={(e) => setConfig({ ...config, totpCode: e.target.value.replace(/\D/g, '').slice(0, 6) } as any)}+ placeholder="Enter 6-digit TOTP"+ maxLength={6}+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '16px',+ fontFamily: 'monospace',+ textAlign: 'center',+ letterSpacing: '4px',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ 6-digit TOTP from your authenticator app+ </p>+ </div>+ </>+ )}++ {/* Motilal Oswal-specific fields: User ID, Password, 2FA (DOB), TOTP */}+ {selectedBroker.id === 'motilal' && (+ <>+ {/* User ID */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ USER ID <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={config.userId || ''}+ onChange={(e) => setConfig({ ...config, userId: e.target.value })}+ placeholder="Enter your Motilal Oswal User ID"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your Motilal Oswal Client ID+ </p>+ </div>++ {/* Password */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ PASSWORD <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <div style={{ position: 'relative' }}>+ <input+ type={showSecret ? 'text' : 'password'}+ value={(config as any).password || ''}+ onChange={(e) => setConfig({ ...config, password: e.target.value } as any)}+ placeholder="Enter your password"+ style={{+ width: '100%',+ padding: '10px 40px 10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <button+ type="button"+ onClick={() => setShowSecret(!showSecret)}+ style={{+ position: 'absolute',+ right: '12px',+ top: '50%',+ transform: 'translateY(-50%)',+ background: 'none',+ border: 'none',+ color: COLORS.GRAY,+ cursor: 'pointer',+ }}+ >+ {showSecret ? <EyeOff size={16} /> : <Eye size={16} />}+ </button>+ </div>+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Your Motilal Oswal trading password+ </p>+ </div>++ {/* 2FA - Date of Birth */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ 2FA - DATE OF BIRTH <span style={{ color: COLORS.RED }}>*</span>+ </label>+ <input+ type="text"+ value={(config as any).dob || ''}+ onChange={(e) => setConfig({ ...config, dob: e.target.value } as any)}+ placeholder="DD/MM/YYYY (e.g., 18/10/1988)"+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '12px',+ fontFamily: 'monospace',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Format: DD/MM/YYYY (required for 2FA)+ </p>+ </div>++ {/* TOTP (Optional) */}+ <div style={{ marginBottom: '12px' }}>+ <label style={{ display: 'block', color: COLORS.GRAY, fontSize: '10px', fontWeight: 600, marginBottom: '6px' }}>+ TOTP CODE (OPTIONAL)+ </label>+ <input+ type="text"+ value={(config as any).totpCode || ''}+ onChange={(e) => setConfig({ ...config, totpCode: e.target.value.replace(/\D/g, '').slice(0, 6) } as any)}+ placeholder="Enter 6-digit TOTP (if enabled)"+ maxLength={6}+ style={{+ width: '100%',+ padding: '10px 12px',+ backgroundColor: COLORS.PANEL_BG,+ border: `1px solid ${COLORS.BORDER}`,+ color: COLORS.WHITE,+ fontSize: '16px',+ fontFamily: 'monospace',+ textAlign: 'center',+ letterSpacing: '4px',+ outline: 'none',+ boxSizing: 'border-box',+ }}+ />+ <p style={{ color: COLORS.MUTED, fontSize: '9px', marginTop: '4px', margin: '4px 0 0 0' }}>+ Optional TOTP if enabled on your account+ </p>+ </div>+ </>+ )}+<buttononClick={handleSaveConfig}disabled={isSaving || !config.apiKey}@@ -847,7 +1662,7 @@ export function BrokersManagementPanel() {}}>{isSaving ? <Loader2 size={14} className="animate-spin" /> : <Save size={14} />}- SAVE CONFIGURATION+ {['shoonya', 'angelone', 'aliceblue', 'fivepaisa', 'motilal'].includes(selectedBroker.id) ? 'SAVE & AUTHENTICATE' : 'SAVE CONFIGURATION'}</button></div>diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/index.ts b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/index.tsindex 3565217f1..1401403a0 100644--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/index.ts+++ b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/index.ts@@ -5,9 +5,6 @@*/export { BrokerSelector } from './BrokerSelector';-export { BrokerAuthPanel } from './BrokerAuthPanel';-export { BrokerConfigPanel } from './BrokerConfigPanel';-export { BrokerSetupPanel } from './BrokerSetupPanel';export { BrokersManagementPanel } from './BrokersManagementPanel';export { StockOrderForm } from './StockOrderForm';export { PositionsPanel } from './PositionsPanel';diff --git a/fincept-terminal-desktop/src/components/tabs/maritime/MaritimeTabDeck.backup.tsx b/fincept-terminal-desktop/src/components/tabs/maritime/MaritimeTabDeck.backup.tsxdeleted file mode 100644index 841193812..000000000--- a/fincept-terminal-desktop/src/components/tabs/maritime/MaritimeTabDeck.backup.tsx+++ /dev/null@@ -1,770 +0,0 @@-// MaritimeTabDeck.tsx - High-Performance Maritime Intelligence with Deck.gl-// NO DUMMY DATA - Only real vessel data from Marine API--import React, { useState, useEffect, useMemo } from 'react';-import DeckGL from '@deck.gl/react';-import { ScatterplotLayer, PathLayer } from '@deck.gl/layers';-import { TileLayer } from '@deck.gl/geo-layers';-import { BitmapLayer } from '@deck.gl/layers';-import { useAuth } from '@/contexts/AuthContext';-import { MarineApiService, VesselData } from '@/services/maritime/marineApi';-import { useTerminalTheme } from '@/contexts/ThemeContext';-import { TabFooter } from '@/components/common/TabFooter';-import { GeocodingService, GeocodeLocation } from '@/services/geopolitics/geocodingService';--const INITIAL_VIEW_STATE = {- longitude: 72.8,- latitude: 19.0,- zoom: 10,- pitch: 0,- bearing: 0-};--export default function MaritimeTabDeck() {- const { colors, fontFamily, fontSize } = useTerminalTheme();- const { session } = useAuth();- const apiKey = session?.api_key || null;-- const [vessels, setVessels] = useState<VesselData[]>([]);- const [isLoading, setIsLoading] = useState(false);- const [error, setError] = useState<string | null>(null);- const [searchImo, setSearchImo] = useState('');- const [searchingVessel, setSearchingVessel] = useState(false);- const [viewState, setViewState] = useState(INITIAL_VIEW_STATE);- const [selectedVessel, setSelectedVessel] = useState<VesselData | null>(null);- const [vesselHistory, setVesselHistory] = useState<any[]>([]);- const [showHistory, setShowHistory] = useState(false);- const [healthStatus, setHealthStatus] = useState<any>(null);- const [multiImoInput, setMultiImoInput] = useState('');- const [searchMode, setSearchMode] = useState<'single' | 'multi'>('single');- const [locationSearch, setLocationSearch] = useState('');- const [searchingLocation, setSearchingLocation] = useState(false);- const [suggestions, setSuggestions] = useState<GeocodeLocation[]>([]);- const [showSuggestions, setShowSuggestions] = useState(false);-- // Load vessels from API- const loadVessels = async () => {- if (!apiKey) {- setError('No API key available');- return;- }-- setIsLoading(true);- setError(null);-- try {- const response = await MarineApiService.searchVesselsByArea(- {- min_lat: 18.5,- max_lat: 19.5,- min_lng: 72.0,- max_lng: 73.5- },- apiKey- );-- if (response.success && response.data) {- const validVessels = response.data.vessels.filter(- v => v.last_pos_latitude && v.last_pos_longitude- );- setVessels(validVessels);- console.log(`Loaded ${validVessels.length} vessels`);- } else {- setError(response.error || 'Failed to load vessels');- }- } catch (err) {- setError(err instanceof Error ? err.message : 'Unknown error');- } finally {- setIsLoading(false);- }- };-- // Search specific vessel by IMO- const searchVessel = async () => {- if (!apiKey || !searchImo.trim()) return;-- setSearchingVessel(true);- setError(null);-- try {- const response = await MarineApiService.getVesselPosition(searchImo.trim(), apiKey);-- if (response.success && response.data) {- const vessel = response.data.vessel;-- // Add to vessel list if not exists- setVessels(prev => {- const exists = prev.find(v => v.imo === vessel.imo);- if (exists) return prev;- return [...prev, vessel];- });-- // Zoom to vessel- setViewState({- longitude: parseFloat(vessel.last_pos_longitude),- latitude: parseFloat(vessel.last_pos_latitude),- zoom: 14,- pitch: 0,- bearing: 0- });-- setSearchImo('');- console.log(`Found vessel: ${vessel.name}`);- } else {- setError(response.error || 'Vessel not found');- }- } catch (err) {- setError(err instanceof Error ? err.message : 'Search failed');- } finally {- setSearchingVessel(false);- }- };-- // Multi-vessel search- const searchMultiVessels = async () => {- if (!apiKey || !multiImoInput.trim()) return;-- setSearchingVessel(true);- setError(null);-- try {- const imos = multiImoInput.split(/[,\s]+/).map(s => s.trim()).filter(s => s.length > 0);-- if (imos.length === 0) {- setError('Please enter at least one IMO number');- setSearchingVessel(false);- return;- }-- if (imos.length > 50) {- setError('Maximum 50 IMO numbers allowed');- setSearchingVessel(false);- return;- }-- const response = await MarineApiService.getMultiVesselPositions(imos, apiKey);-- if (response.success && response.data && response.data.vessels) {- const newVessels = response.data.vessels;-- setVessels(prev => {- const combined = [...prev];- newVessels.forEach(vessel => {- const exists = combined.find(v => v.imo === vessel.imo);- if (!exists) combined.push(vessel);- });- return combined;- });-- setMultiImoInput('');- console.log(`Found ${response.data.found_count || 0} vessels, ${response.data.not_found_count || 0} not found`);-- if (response.data.not_found_count > 0 && response.data.not_found) {- setError(`${response.data.not_found_count} vessels not found: ${response.data.not_found.join(', ')}`);- }- } else {- setError(response.error || 'Multi-vessel search failed');- }- } catch (err) {- setError(err instanceof Error ? err.message : 'Search failed');- } finally {- setSearchingVessel(false);- }- };-- // Load vessel history- const loadVesselHistory = async (vessel: VesselData) => {- if (!apiKey) return;-- setSelectedVessel(vessel);- setShowHistory(true);- setError(null);-- try {- const response = await MarineApiService.getVesselHistory(vessel.imo, apiKey);-- if (response.success && response.data && response.data.history && response.data.history.positions) {- setVesselHistory(response.data.history.positions);- console.log(`Loaded history: ${response.data.history.positions.length} positions`);- } else {- setError(response.error || 'Failed to load vessel history');- setVesselHistory([]);- }- } catch (err) {- setError(err instanceof Error ? err.message : 'History load failed');- setVesselHistory([]);- }- };-- // Load health status- const loadHealthStatus = async () => {- if (!apiKey) return;-- try {- const response = await MarineApiService.getMarineHealth(apiKey);-- if (response.success && response.data) {- setHealthStatus(response.data);- console.log('Marine API Health:', response.data.status);- }- } catch (err) {- console.error('Health check failed:', err);- }- };-- // Fetch autocomplete suggestions using Python geopy- const fetchSuggestions = async (query: string) => {- if (query.length < 3) {- setSuggestions([]);- setShowSuggestions(false);- return;- }-- try {- const results = await GeocodingService.searchLocation(query, 5);- if (results.success && results.suggestions) {- setSuggestions(results.suggestions);- setShowSuggestions(results.suggestions.length > 0);- }- } catch (err) {- console.error('Autocomplete failed:', err);- setSuggestions([]);- setShowSuggestions(false);- }- };-- // Geocoding search- const searchByLocation = async (selectedLocation?: GeocodeLocation) => {- if (!apiKey) return;-- const locationData = selectedLocation || (suggestions.length > 0 ? suggestions[0] : null);- if (!locationData && !locationSearch.trim()) return;-- setSearchingLocation(true);- setError(null);- setShowSuggestions(false);-- try {- let bounds;- if (locationData) {- // Use location from suggestions- bounds = locationData.bbox;- } else {- // Search new location- const results = await GeocodingService.searchLocation(locationSearch, 1);- if (!results.success || !results.suggestions || results.suggestions.length === 0) {- setError('Location not found');- setSearchingLocation(false);- return;- }- bounds = results.suggestions[0].bbox;- }-- // Search vessels in this area- const vesselResponse = await MarineApiService.searchVesselsByArea(bounds, apiKey);-- if (vesselResponse.success && vesselResponse.data) {- const validVessels = vesselResponse.data.vessels.filter(- v => v.last_pos_latitude && v.last_pos_longitude- );- setVessels(validVessels);-- // Pan to center- const centerLat = (bounds.min_lat + bounds.max_lat) / 2;- const centerLng = (bounds.min_lng + bounds.max_lng) / 2;- setViewState({- longitude: centerLng,- latitude: centerLat,- zoom: 10,- pitch: 0,- bearing: 0- });-- console.log(`Found ${validVessels.length} vessels in area`);- }- } catch (err) {- setError(err instanceof Error ? err.message : 'Geocoding failed');- } finally {- setSearchingLocation(false);- }- };-- // Search current viewport- const searchCurrentView = async () => {- if (!apiKey) return;-- setIsLoading(true);- setError(null);-- try {- // Calculate bounds from viewport- const zoom = viewState.zoom;- const lat = viewState.latitude;- const lng = viewState.longitude;-- // Approximate bounds based on zoom level- const latDelta = 180 / Math.pow(2, zoom);- const lngDelta = 360 / Math.pow(2, zoom);-- const bounds = {- min_lat: lat - latDelta,- max_lat: lat + latDelta,- min_lng: lng - lngDelta,- max_lng: lng + lngDelta- };-- const response = await MarineApiService.searchVesselsByArea(bounds, apiKey);-- if (response.success && response.data) {- const validVessels = response.data.vessels.filter(- v => v.last_pos_latitude && v.last_pos_longitude- );- setVessels(validVessels);- console.log(`Loaded ${validVessels.length} vessels in current view`);- } else {- setError(response.error || 'Failed to load vessels');- }- } catch (err) {- setError(err instanceof Error ? err.message : 'Search failed');- } finally {- setIsLoading(false);- }- };-- // Auto-load vessels on mount- useEffect(() => {- loadVessels();- loadHealthStatus();- const interval = setInterval(loadVessels, 300000); // Refresh every 5 minutes- return () => clearInterval(interval);- }, [apiKey]);-- // Memoized vessel data - precompute positions and colors- const vesselPoints = useMemo(() => {- return vessels.map(v => {- const speed = parseFloat(v.last_pos_speed) || 0;- let color: [number, number, number, number];- if (speed < 5) color = [0, 255, 255, 180];- else if (speed < 15) color = [255, 215, 0, 180];- else color = [255, 69, 0, 180];-- return {- position: [parseFloat(v.last_pos_longitude), parseFloat(v.last_pos_latitude), 0] as [number, number, number],- color,- imo: v.imo,- name: v.name,- speed- };- });- }, [vessels]);-- // Memoized layers with static accessors for performance- const layers = useMemo(() => {- const allLayers: any[] = [- new TileLayer({- id: 'basemap',- data: 'https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',- minZoom: 0,- maxZoom: 19,- tileSize: 256,- renderSubLayers: (props: any) => {- const { boundingBox } = props.tile;- return new BitmapLayer(props, {- data: undefined,- image: props.data,- bounds: [boundingBox[0][0], boundingBox[0][1], boundingBox[1][0], boundingBox[1][1]]- });- }- })- ];-- // Add vessel history track- if (showHistory && vesselHistory.length > 0) {- const pathData = vesselHistory.map(pos => [- parseFloat(pos.longitude),- parseFloat(pos.latitude)- ]);-- allLayers.push(- new PathLayer({- id: 'vessel-history',- data: [{ path: pathData }],- getPath: (d: any) => d.path,- getColor: [255, 215, 0, 200],- getWidth: 3,- widthMinPixels: 2,- widthMaxPixels: 8,- jointRounded: true,- capRounded: true- })- );- }-- if (vesselPoints.length > 0) {- allLayers.push(- new ScatterplotLayer({- id: 'vessels',- data: vesselPoints,- getPosition: (d: any) => d.position,- getFillColor: (d: any) => d.color,- getRadius: 80,- radiusMinPixels: 4,- radiusMaxPixels: 20,- pickable: true,- autoHighlight: true,- highlightColor: [255, 255, 255, 100],- onClick: (info: any) => {- if (info.object) {- const vessel = vessels.find(v => v.imo === info.object.imo);- if (vessel) {- loadVesselHistory(vessel);- }- }- }- })- );- }-- return allLayers;- }, [vesselPoints, showHistory, vesselHistory, vessels]);-- return (- <div- style={{- width: '100%',- height: '100%',- display: 'flex',- flexDirection: 'column',- background: colors.background,- color: colors.text,- fontFamily: fontFamily,- fontSize: `${fontSize}px`,- position: 'relative',- overflow: 'hidden'- }}- >- {/* Header - Fincept Style - Split into Two Rows */}- <div- style={{- position: 'absolute',- top: 0,- left: 0,- right: 0,- background: '#000000',- borderBottom: '2px solid #ff6600',- zIndex: 1000,- fontFamily: 'Consolas, monospace',- fontSize: '12px'- }}- >- {/* Row 1: Title + Stats */}- <div style={{- padding: '4px 12px',- display: 'flex',- alignItems: 'center',- gap: '12px',- borderBottom: '1px solid #333'- }}>- <div style={{ color: '#ff6600', fontWeight: 'bold', fontSize: '13px' }}>- MAR>- </div>- <div style={{ color: '#ffffff', fontWeight: 'bold' }}>- MARITIME TRACKING- </div>- <div style={{ color: '#888888' }}>|</div>- <div style={{ color: vessels.length > 0 ? '#00ff00' : '#ff0000', fontWeight: 'bold' }}>- {vesselPoints.length}/{vessels.length} VESSELS- </div>- </div>-- {/* Row 2: Search Controls */}- <div style={{- padding: '4px 12px',- display: 'flex',- gap: '8px',- alignItems: 'center'- }}>- {/* Location Search with Autocomplete */}- <div style={{ position: 'relative' }}>- <input- type="text"- placeholder="Search: Suez Canal..."- value={locationSearch}- onChange={(e) => {- setLocationSearch(e.target.value);- fetchSuggestions(e.target.value);- }}- onKeyDown={(e) => {- if (e.key === 'Enter') {- searchByLocation();- } else if (e.key === 'Escape') {- setShowSuggestions(false);- }- }}- onFocus={() => suggestions.length > 0 && setShowSuggestions(true)}- disabled={searchingLocation}- style={{- padding: '4px 8px',- background: '#1a1a1a',- border: '1px solid #333',- color: '#fff',- fontFamily: 'Consolas, monospace',- fontSize: '11px',- width: '160px',- outline: 'none'- }}- />- {showSuggestions && suggestions.length > 0 && (- <div- style={{- position: 'absolute',- top: '100%',- left: 0,- width: '160px',- background: '#1a1a1a',- border: '1px solid #333',- borderTop: 'none',- maxHeight: '200px',- overflowY: 'auto',- zIndex: 2000,- marginTop: '1px'- }}- >- {suggestions.map((suggestion, idx) => (- <div- key={idx}- onClick={() => {- setLocationSearch(suggestion.name);- searchByLocation(suggestion);- setShowSuggestions(false);- }}- style={{- padding: '6px 8px',- cursor: 'pointer',- fontSize: '10px',- borderBottom: idx < suggestions.length - 1 ? '1px solid #333' : 'none',- color: '#ccc',- background: '#1a1a1a',- transition: 'background 0.1s'- }}- onMouseEnter={(e) => {- e.currentTarget.style.background = '#2a2a2a';- e.currentTarget.style.color = '#fff';- }}- onMouseLeave={(e) => {- e.currentTarget.style.background = '#1a1a1a';- e.currentTarget.style.color = '#ccc';- }}- >- {suggestion.name}- </div>- ))}- </div>- )}- </div>-- <button- onClick={() => searchByLocation()}- disabled={searchingLocation || !locationSearch.trim()}- style={{- padding: '4px 10px',- background: '#10b981',- border: 'none',- color: '#000',- fontFamily: 'Consolas, monospace',- fontSize: '10px',- fontWeight: 'bold',- cursor: searchingLocation ? 'not-allowed' : 'pointer',- opacity: searchingLocation ? 0.5 : 1- }}- >- LOCATION- </button>-- <button- onClick={searchCurrentView}- disabled={isLoading}- style={{- padding: '4px 10px',- background: '#06b6d4',- border: 'none',- color: '#000',- fontFamily: 'Consolas, monospace',- fontSize: '10px',- fontWeight: 'bold',- cursor: isLoading ? 'not-allowed' : 'pointer',- opacity: isLoading ? 0.5 : 1- }}- >- CURRENT VIEW- </button>-- <div style={{ width: '1px', height: '18px', background: '#333' }} />-- <select- value={searchMode}- onChange={(e) => setSearchMode(e.target.value as 'single' | 'multi')}- style={{- padding: '4px 6px',- background: '#1a1a1a',- border: '1px solid #333',- color: '#fff',- fontFamily: 'Consolas, monospace',- fontSize: '10px',- outline: 'none',- cursor: 'pointer'- }}- >- <option value="single">SINGLE</option>- <option value="multi">MULTI</option>- </select>-- {searchMode === 'single' ? (- <input- type="text"- placeholder="IMO"- value={searchImo}- onChange={(e) => setSearchImo(e.target.value)}- onKeyDown={(e) => e.key === 'Enter' && searchVessel()}- disabled={searchingVessel}- style={{- padding: '4px 8px',- background: '#1a1a1a',- border: '1px solid #333',- color: '#fff',- fontFamily: 'Consolas, monospace',- fontSize: '11px',- width: '100px',- outline: 'none'- }}- />- ) : (- <input- type="text"- placeholder="IMO1, IMO2..."- value={multiImoInput}- onChange={(e) => setMultiImoInput(e.target.value)}- onKeyDown={(e) => e.key === 'Enter' && searchMultiVessels()}- disabled={searchingVessel}- style={{- padding: '4px 8px',- background: '#1a1a1a',- border: '1px solid #333',- color: '#fff',- fontFamily: 'Consolas, monospace',- fontSize: '11px',- width: '120px',- outline: 'none'- }}- />- )}-- <button- onClick={searchMode === 'single' ? searchVessel : searchMultiVessels}- disabled={searchingVessel || (searchMode === 'single' ? !searchImo.trim() : !multiImoInput.trim())}- style={{- padding: '4px 12px',- background: '#ff6600',- border: 'none',- color: '#000',- fontFamily: 'Consolas, monospace',- fontSize: '10px',- fontWeight: 'bold',- cursor: searchingVessel ? 'not-allowed' : 'pointer',- opacity: searchingVessel ? 0.5 : 1- }}- >- GO- </button>-- {showHistory && (- <button- onClick={() => {- setShowHistory(false);- setVesselHistory([]);- setSelectedVessel(null);- }}- style={{- padding: '4px 10px',- background: '#000',- border: '1px solid #ffd700',- color: '#ffd700',- fontFamily: 'Consolas, monospace',- fontSize: '10px',- fontWeight: 'bold',- cursor: 'pointer'- }}- >- CLEAR- </button>- )}- </div>- </div>-- {/* Error Display */}- {error && (- <div- style={{- position: 'absolute',- top: '80px',- left: '20px',- right: '20px',- padding: '12px 20px',- background: 'rgba(255, 0, 0, 0.2)',- border: '1px solid #ff0000',- borderRadius: '4px',- color: '#ff6b6b',- fontFamily: 'Consolas, monospace',- fontSize: '13px',- zIndex: 10- }}- >- ERROR: {error}- </div>- )}-- {/* Deck.gl Map */}- <div style={{ flex: 1, position: 'relative', background: '#000', minHeight: 0 }}>- <DeckGL- viewState={viewState}- onViewStateChange={({ viewState: vs }: any) => setViewState(vs)}- controller={true}- layers={layers}- width="100%"- height="100%"- style={{ position: 'absolute', inset: '0' }}- getTooltip={({ object }: any) => object && {- html: `<strong>${object.name}</strong><br/>IMO: ${object.imo}<br/>Speed: ${object.speed.toFixed(1)} kts`,- style: {- backgroundColor: '#000',- color: '#fff',- padding: '8px',- borderRadius: '4px',- border: '1px solid #ff6600',- fontFamily: 'Consolas, monospace',- fontSize: '11px'- }- }}- />- </div>-- {/* Footer */}- <div style={{ flexShrink: 0 }}>- <TabFooter- tabName="MARITIME TRACKING"- leftInfo={[- { label: 'VESSELS', value: `${vesselPoints.length}/${vessels.length}`, color: vesselPoints.length > 0 ? '#10b981' : '#ef4444' },- { label: 'ZONE', value: 'MUMBAI', color: '#fbbf24' },- { label: 'ENGINE', value: 'DECK.GL v9.2', color: '#06b6d4' },- ...(healthStatus ? [{ label: 'API', value: healthStatus.status.toUpperCase(), color: healthStatus.status === 'healthy' ? '#10b981' : '#ef4444' }] : []),- ...(selectedVessel ? [{ label: 'TRACKING', value: selectedVessel.name, color: '#ffd700' }] : []),- ...(showHistory && vesselHistory.length > 0 ? [{ label: 'HISTORY', value: `${vesselHistory.length} PTS`, color: '#ffd700' }] : [])- ]}- statusInfo={`REAL-TIME AIS DATA | AUTO-REFRESH: 5MIN | ${new Date().toLocaleTimeString()}`}- backgroundColor="#000000"- borderColor="#ff6600"- />- </div>- </div>- );-}diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/AnalyticsView.tsx.backup b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/AnalyticsView.tsx.backupdeleted file mode 100644index 404436997..000000000--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/portfolio/AnalyticsView.tsx.backup+++ /dev/null@@ -1,542 +0,0 @@-import { useTerminalTheme } from '@/contexts/ThemeContext';-import React, { useState, useEffect } from 'react';-import { PortfolioSummary, portfolioService } from '../../../../services/portfolioService';-import { formatCurrency, formatPercent, formatLargeNumber } from './utils';-import { TrendingUp, Activity, PieChart, Target } from 'lucide-react';--interface AnalyticsViewProps {- portfolioSummary: PortfolioSummary;-}--const AnalyticsView: React.FC<AnalyticsViewProps> = ({ portfolioSummary }) => {- const { colors } = useTerminalTheme();- const currency = portfolioSummary.portfolio.currency;-- // Advanced analytics state- const [advancedMetrics, setAdvancedMetrics] = useState<any>(null);- const [optimizedPortfolio, setOptimizedPortfolio] = useState<any>(null);- const [loadingMetrics, setLoadingMetrics] = useState(false);- const [loadingOptimization, setLoadingOptimization] = useState(false);- const [analyticsError, setAnalyticsError] = useState<string | null>(null);-- // Calculate key metrics- const totalValue = portfolioSummary.total_market_value;- const totalPnL = portfolioSummary.total_unrealized_pnl;- const totalPnLPercent = portfolioSummary.total_unrealized_pnl_percent;- const dayChange = portfolioSummary.total_day_change;- const dayChangePercent = portfolioSummary.total_day_change_percent;- const positionsCount = portfolioSummary.total_positions;-- // Find top performers- const topGainers = [...portfolioSummary.holdings]- .sort((a, b) => b.unrealized_pnl_percent - a.unrealized_pnl_percent)- .slice(0, 5);-- const topLosers = [...portfolioSummary.holdings]- .sort((a, b) => a.unrealized_pnl_percent - b.unrealized_pnl_percent)- .slice(0, 5);-- // Largest positions by value- const largestPositions = [...portfolioSummary.holdings]- .sort((a, b) => b.market_value - a.market_value)- .slice(0, 5);-- // Load advanced analytics- useEffect(() => {- loadAdvancedAnalytics();- }, [portfolioSummary.portfolio.id]);-- const loadAdvancedAnalytics = async () => {- setLoadingMetrics(true);- setAnalyticsError(null);- try {- const metrics = await portfolioService.calculateAdvancedMetrics(portfolioSummary.portfolio.id);- setAdvancedMetrics(metrics);- } catch (error) {- console.error('Error loading advanced metrics:', error);- setAnalyticsError(error instanceof Error ? error.message : 'Failed to load analytics');- } finally {- setLoadingMetrics(false);- }- };-- const loadOptimization = async () => {- setLoadingOptimization(true);- setAnalyticsError(null);- try {- const optimized = await portfolioService.optimizePortfolioWeights(portfolioSummary.portfolio.id, 'max_sharpe');- setOptimizedPortfolio(optimized);- } catch (error) {- console.error('Error optimizing portfolio:', error);- setAnalyticsError(error instanceof Error ? error.message : 'Failed to optimize portfolio');- } finally {- setLoadingOptimization(false);- }- };-- return (- <div>- <div style={{- color: colors.primary,- fontSize: '12px',- fontWeight: 'bold',- marginBottom: '16px'- }}>- PORTFOLIO ANALYTICS DASHBOARD- </div>-- {/* Advanced Analytics Section */}- {analyticsError && (- <div style={{- backgroundColor: '`${colors.alert}1a`',- border: `1px solid ${colors.alert}`,- padding: '12px',- marginBottom: '16px',- borderRadius: '4px',- color: colors.alert,- fontSize: '10px'- }}>- [WARN] {analyticsError}- </div>- )}-- {advancedMetrics && (- <div style={{- backgroundColor: 'rgba(100,150,250,0.05)',- border: `1px solid ${colors.info}`,- padding: '16px',- marginBottom: '20px',- borderRadius: '4px'- }}>- <div style={{- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center',- marginBottom: '12px'- }}>- <div style={{ color: colors.info, fontSize: '11px', fontWeight: 'bold', display: 'flex', alignItems: 'center', gap: '6px' }}>- <Activity size={14} />- ADVANCED PORTFOLIO METRICS (Python-Powered)- </div>- <button- onClick={loadOptimization}- disabled={loadingOptimization}- style={{- background: loadingOptimization ? colors.textMuted : colors.primary,- color: 'black',- border: 'none',- padding: '4px 12px',- fontSize: '9px',- fontWeight: 'bold',- cursor: loadingOptimization ? 'not-allowed' : 'pointer',- display: 'flex',- alignItems: 'center',- gap: '4px'- }}- >- <Target size={10} />- {loadingOptimization ? 'OPTIMIZING...' : 'OPTIMIZE WEIGHTS'}- </button>- </div>-- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: '12px' }}>- <div style={{ textAlign: 'center' }}>- <div style={{ color: colors.textMuted, fontSize: '8px', marginBottom: '4px' }}>SHARPE RATIO</div>- <div style={{ color: colors.success, fontSize: '14px', fontWeight: 'bold' }}>- {advancedMetrics.sharpe_ratio?.toFixed(2) || 'N/A'}- </div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ color: colors.textMuted, fontSize: '8px', marginBottom: '4px' }}>VOLATILITY</div>- <div style={{ color: colors.warning, fontSize: '14px', fontWeight: 'bold' }}>- {(advancedMetrics.portfolio_volatility * 100)?.toFixed(2)}%- </div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ color: colors.textMuted, fontSize: '8px', marginBottom: '4px' }}>VaR (95%)</div>- <div style={{ color: colors.alert, fontSize: '14px', fontWeight: 'bold' }}>- {(advancedMetrics.value_at_risk_95 * 100)?.toFixed(2)}%- </div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ color: colors.textMuted, fontSize: '8px', marginBottom: '4px' }}>MAX DRAWDOWN</div>- <div style={{ color: colors.alert, fontSize: '14px', fontWeight: 'bold' }}>- {(advancedMetrics.max_drawdown * 100)?.toFixed(2)}%- </div>- </div>- <div style={{ textAlign: 'center' }}>- <div style={{ color: colors.textMuted, fontSize: '8px', marginBottom: '4px' }}>ANNUAL RETURN</div>- <div style={{ color: colors.success, fontSize: '14px', fontWeight: 'bold' }}>- {(advancedMetrics.portfolio_return * 100)?.toFixed(2)}%- </div>- </div>- </div>-- {optimizedPortfolio && (- <div style={{ marginTop: '12px', paddingTop: '12px', borderTop: `1px solid ${colors.textMuted}` }}>- <div style={{ color: colors.primary, fontSize: '10px', fontWeight: 'bold', marginBottom: '8px' }}>- OPTIMIZED ALLOCATION (Max Sharpe Ratio)- </div>- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(120px, 1fr))', gap: '8px' }}>- {portfolioSummary.holdings.map((holding, idx) => {- const currentWeight = holding.weight;- const optimalWeight = (optimizedPortfolio.optimal_weights[idx] * 100);- const diff = optimalWeight - currentWeight;-- return (- <div key={holding.id} style={{- padding: '6px',- backgroundColor: 'rgba(255,165,0,0.05)',- border: `1px solid ${colors.primary}`,- borderRadius: '2px'- }}>- <div style={{ color: colors.accent, fontSize: '9px', fontWeight: 'bold', marginBottom: '2px' }}>- {holding.symbol}- </div>- <div style={{ fontSize: '8px', color: colors.textMuted }}>- Current: {currentWeight.toFixed(1)}%- </div>- <div style={{ fontSize: '8px', color: colors.warning }}>- Optimal: {optimalWeight.toFixed(1)}%- </div>- <div style={{ fontSize: '8px', color: diff > 0 ? colors.success : diff < 0 ? colors.alert : colors.textMuted }}>- {diff > 0 ? '↑' : diff < 0 ? '↓' : '='} {Math.abs(diff).toFixed(1)}%- </div>- </div>- );- })}- </div>- <div style={{ marginTop: '8px', fontSize: '9px', color: colors.textMuted }}>- Optimized Sharpe: <span style={{ color: colors.success, fontWeight: 'bold' }}>- {optimizedPortfolio.sharpe_ratio?.toFixed(2)}- </span> |- Expected Return: <span style={{ color: colors.success, fontWeight: 'bold' }}>- {(optimizedPortfolio.expected_return * 100)?.toFixed(2)}%- </span> |- Volatility: <span style={{ color: colors.warning, fontWeight: 'bold' }}>- {(optimizedPortfolio.volatility * 100)?.toFixed(2)}%- </span>- </div>- </div>- )}- </div>- )}-- {loadingMetrics && !advancedMetrics && (- <div style={{- backgroundColor: 'rgba(100,150,250,0.05)',- border: `1px solid ${colors.info}`,- padding: '16px',- marginBottom: '20px',- borderRadius: '4px',- textAlign: 'center',- color: colors.accent,- fontSize: '10px'- }}>- Loading advanced analytics...- </div>- )}-- {/* Key Metrics Grid */}- <div style={{- display: 'grid',- gridTemplateColumns: 'repeat(4, 1fr)',- gap: '12px',- marginBottom: '20px'- }}>- {/* Total Value Card */}- <div style={{- backgroundColor: '`${colors.primary}1a`',- border: `1px solid ${colors.primary}`,- padding: '12px',- borderRadius: '4px'- }}>- <div style={{ color: colors.textMuted, fontSize: '9px', marginBottom: '4px' }}>TOTAL VALUE</div>- <div style={{ color: colors.warning, fontSize: '16px', fontWeight: 'bold' }}>- {formatLargeNumber(totalValue, currency)}- </div>- <div style={{ color: colors.textMuted, fontSize: '8px', marginTop: '2px' }}>- {formatCurrency(totalValue, currency)}- </div>- </div>-- {/* Total P&L Card */}- <div style={{- backgroundColor: totalPnL >= 0 ? 'rgba(0,200,0,0.1)' : '`${colors.alert}1a`',- border: `1px solid ${totalPnL >= 0 ? colors.success : colors.alert}`,- padding: '12px',- borderRadius: '4px'- }}>- <div style={{ color: colors.textMuted, fontSize: '9px', marginBottom: '4px' }}>TOTAL P&L</div>- <div style={{ color: totalPnL >= 0 ? colors.success : colors.alert, fontSize: '16px', fontWeight: 'bold' }}>- {formatLargeNumber(totalPnL, currency)}- </div>- <div style={{ color: totalPnL >= 0 ? colors.success : colors.alert, fontSize: '10px', marginTop: '2px' }}>- {formatPercent(totalPnLPercent)}- </div>- </div>-- {/* Day Change Card */}- <div style={{- backgroundColor: dayChange >= 0 ? 'rgba(0,200,0,0.1)' : '`${colors.alert}1a`',- border: `1px solid ${dayChange >= 0 ? colors.success : colors.alert}`,- padding: '12px',- borderRadius: '4px'- }}>- <div style={{ color: colors.textMuted, fontSize: '9px', marginBottom: '4px' }}>DAY CHANGE</div>- <div style={{ color: dayChange >= 0 ? colors.success : colors.alert, fontSize: '16px', fontWeight: 'bold' }}>- {formatLargeNumber(dayChange, currency)}- </div>- <div style={{ color: dayChange >= 0 ? colors.success : colors.alert, fontSize: '10px', marginTop: '2px' }}>- {formatPercent(dayChangePercent)}- </div>- </div>-- {/* Positions Card */}- <div style={{- backgroundColor: 'rgba(0,255,255,0.1)',- border: `1px solid ${colors.accent}`,- padding: '12px',- borderRadius: '4px'- }}>- <div style={{ color: colors.textMuted, fontSize: '9px', marginBottom: '4px' }}>POSITIONS</div>- <div style={{ color: colors.accent, fontSize: '16px', fontWeight: 'bold' }}>- {positionsCount}- </div>- <div style={{ color: colors.textMuted, fontSize: '8px', marginTop: '2px' }}>- Active Holdings- </div>- </div>- </div>-- {/* Performance Section */}- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '16px' }}>- {/* Top Gainers */}- <div>- <div style={{- color: colors.success,- fontSize: '11px',- fontWeight: 'bold',- marginBottom: '8px',- paddingBottom: '4px',- borderBottom: `1px solid ${colors.success}`- }}>- TOP GAINERS- </div>- {topGainers.length === 0 ? (- <div style={{ color: colors.textMuted, fontSize: '10px', padding: '8px' }}>No data</div>- ) : (- topGainers.map(holding => (- <div- key={holding.id}- style={{- padding: '8px',- marginBottom: '4px',- backgroundColor: 'rgba(0,200,0,0.05)',- borderLeft: `3px solid ${colors.success}`,- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center'- }}- >- <div>- <div style={{ color: colors.accent, fontSize: '10px', fontWeight: 'bold' }}>- {holding.symbol}- </div>- <div style={{ color: colors.textMuted, fontSize: '8px' }}>- {formatCurrency(holding.market_value, currency)}- </div>- </div>- <div style={{ textAlign: 'right' }}>- <div style={{ color: colors.success, fontSize: '10px', fontWeight: 'bold' }}>- {formatPercent(holding.unrealized_pnl_percent)}- </div>- <div style={{ color: colors.success, fontSize: '8px' }}>- {formatCurrency(holding.unrealized_pnl, currency)}- </div>- </div>- </div>- ))- )}- </div>-- {/* Top Losers */}- <div>- <div style={{- color: colors.alert,- fontSize: '11px',- fontWeight: 'bold',- marginBottom: '8px',- paddingBottom: '4px',- borderBottom: `1px solid ${colors.alert}`- }}>- TOP LOSERS- </div>- {topLosers.length === 0 ? (- <div style={{ color: colors.textMuted, fontSize: '10px', padding: '8px' }}>No data</div>- ) : (- topLosers.map(holding => (- <div- key={holding.id}- style={{- padding: '8px',- marginBottom: '4px',- backgroundColor: 'rgba(255,0,0,0.05)',- borderLeft: `3px solid ${colors.alert}`,- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center'- }}- >- <div>- <div style={{ color: colors.accent, fontSize: '10px', fontWeight: 'bold' }}>- {holding.symbol}- </div>- <div style={{ color: colors.textMuted, fontSize: '8px' }}>- {formatCurrency(holding.market_value, currency)}- </div>- </div>- <div style={{ textAlign: 'right' }}>- <div style={{ color: colors.alert, fontSize: '10px', fontWeight: 'bold' }}>- {formatPercent(holding.unrealized_pnl_percent)}- </div>- <div style={{ color: colors.alert, fontSize: '8px' }}>- {formatCurrency(holding.unrealized_pnl, currency)}- </div>- </div>- </div>- ))- )}- </div>-- {/* Largest Positions */}- <div>- <div style={{- color: colors.info,- fontSize: '11px',- fontWeight: 'bold',- marginBottom: '8px',- paddingBottom: '4px',- borderBottom: `1px solid ${colors.info}`- }}>- LARGEST POSITIONS- </div>- {largestPositions.length === 0 ? (- <div style={{ color: colors.textMuted, fontSize: '10px', padding: '8px' }}>No data</div>- ) : (- largestPositions.map(holding => (- <div- key={holding.id}- style={{- padding: '8px',- marginBottom: '4px',- backgroundColor: 'rgba(100,150,250,0.05)',- borderLeft: `3px solid ${colors.info}`,- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center'- }}- >- <div>- <div style={{ color: colors.accent, fontSize: '10px', fontWeight: 'bold' }}>- {holding.symbol}- </div>- <div style={{ color: colors.textMuted, fontSize: '8px' }}>- Weight: {holding.weight.toFixed(1)}%- </div>- </div>- <div style={{ textAlign: 'right' }}>- <div style={{ color: colors.text, fontSize: '10px', fontWeight: 'bold' }}>- {formatLargeNumber(holding.market_value, currency)}- </div>- <div style={{- color: holding.unrealized_pnl >= 0 ? colors.success : colors.alert,- fontSize: '8px'- }}>- {formatPercent(holding.unrealized_pnl_percent)}- </div>- </div>- </div>- ))- )}- </div>- </div>-- {/* Allocation Summary */}- <div style={{ marginTop: '20px' }}>- <div style={{- color: colors.primary,- fontSize: '11px',- fontWeight: 'bold',- marginBottom: '12px',- paddingBottom: '4px',- borderBottom: `1px solid ${colors.primary}`- }}>- ALLOCATION BREAKDOWN- </div>-- <div style={{- display: 'grid',- gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',- gap: '8px'- }}>- {portfolioSummary.holdings.map(holding => (- <div- key={holding.id}- style={{- padding: '8px',- backgroundColor: '`${colors.text}05`',- border: `1px solid rgba(120,120,120,0.3)`,- borderRadius: '2px'- }}- >- <div style={{- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center',- marginBottom: '4px'- }}>- <span style={{ color: colors.accent, fontSize: '10px', fontWeight: 'bold' }}>- {holding.symbol}- </span>- <span style={{ color: colors.warning, fontSize: '10px', fontWeight: 'bold' }}>- {holding.weight.toFixed(1)}%- </span>- </div>- <div style={{- width: '100%',- height: '4px',- backgroundColor: 'rgba(120,120,120,0.3)',- borderRadius: '2px',- overflow: 'hidden'- }}>- <div style={{- width: `${holding.weight}%`,- height: '100%',- backgroundColor: colors.warning,- transition: 'width 0.3s'- }} />- </div>- <div style={{- marginTop: '4px',- display: 'flex',- justifyContent: 'space-between',- fontSize: '8px',- color: colors.textMuted- }}>- <span>{formatLargeNumber(holding.market_value, currency)}</span>- <span style={{- color: holding.unrealized_pnl >= 0 ? colors.success : colors.alert- }}>- {formatPercent(holding.unrealized_pnl_percent)}- </span>- </div>- </div>- ))}- </div>- </div>- </div>- );-};--export default AnalyticsView;diff --git a/fincept-terminal-desktop/src/components/tabs/tours/dashboardTabTour.ts b/fincept-terminal-desktop/src/components/tabs/tours/dashboardTabTour.tsindex 1c10ea34c..72af56268 100644--- a/fincept-terminal-desktop/src/components/tabs/tours/dashboardTabTour.ts+++ b/fincept-terminal-desktop/src/components/tabs/tours/dashboardTabTour.ts@@ -15,25 +15,25 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '#dashboard-add-widget',popover: {title: 'Add Widget',- description: 'Click to add new widgets to your dashboard. Choose from market data, news feeds, watchlists, portfolios, and specialized analytics.',+ description: 'Click to add new widgets to your dashboard. Choose from 18+ widget types: market data, news feeds, watchlists, portfolios, crypto, commodities, forex, economic indicators, alerts, calendar, and more.',side: 'bottom',align: 'end'}},{- element: '#dashboard-reset',+ element: '#dashboard-save',popover: {- title: 'Reset Layout',- description: 'Restore the default dashboard layout. This will remove all custom widgets and arrangements.',+ title: 'Save Layout',+ description: 'Save your current dashboard configuration. Your widget arrangement, sizes, and settings are persisted automatically and restored on next login.',side: 'bottom',align: 'end'}},{- element: '#dashboard-save',+ element: '#dashboard-reset',popover: {- title: 'Save Layout',- description: 'Save your current dashboard configuration. Your widget arrangement and settings are persisted automatically.',+ title: 'Reset Layout',+ description: 'Restore the default dashboard layout. This will remove all custom widgets and arrangements, returning to the original configuration.',side: 'bottom',align: 'end'}@@ -42,7 +42,7 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '#dashboard-grid',popover: {title: 'Widget Grid',- description: 'Drag widgets to rearrange them. Resize by dragging the bottom-right corner. Each widget is interactive and updates in real-time.',+ description: 'Drag widgets to rearrange them. Resize by dragging the bottom-right corner. Each widget is interactive and updates in real-time. The layout is fully customizable.',side: 'top',align: 'center'}@@ -51,7 +51,7 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '.widget-indices',popover: {title: 'Global Indices Widget',- description: 'Monitor major global stock indices including S&P 500, NASDAQ, Dow Jones, and international markets. View real-time prices and changes.',+ description: 'Monitor major global stock indices: S&P 500, NASDAQ, Dow Jones, FTSE 100, DAX, Nikkei 225, and more. View real-time prices, daily changes, and percentage movements.',side: 'bottom',align: 'start'}@@ -60,7 +60,7 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '.widget-news',popover: {title: 'News Widget',- description: 'Stay updated with real-time financial news. Customize categories including markets, crypto, regulatory, and sector-specific news.',+ description: 'Stay updated with real-time financial news. Customize categories: Markets, Crypto, Regulatory (SEC Press Releases), Tech, and sector-specific news. Click any article to read full details.',side: 'left',align: 'start'}@@ -69,7 +69,7 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '.widget-forex',popover: {title: 'Forex Widget',- description: 'Track major currency pairs including EUR/USD, GBP/USD, USD/JPY, and more. Monitor exchange rates and changes in real-time.',+ description: 'Track major currency pairs: EUR/USD, GBP/USD, USD/JPY, AUD/USD, USD/CAD, and more. Monitor exchange rates, bid/ask spreads, and daily percentage changes in real-time.',side: 'right',align: 'start'}@@ -78,16 +78,43 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '.widget-commodities',popover: {title: 'Commodities Widget',- description: 'View prices for gold, silver, oil, natural gas, and other commodities. Track daily changes and trends.',+ description: 'View prices for gold, silver, crude oil, natural gas, copper, and agricultural commodities. Track daily changes, trends, and futures contracts.',side: 'left',align: 'start'}},{- element: '.widget-portfolio',+ element: '.widget-forum',popover: {- title: 'Portfolio Summary',- description: 'Overview of your portfolio performance including total value, daily P&L, allocations, and top holdings.',+ title: 'Forum Widget',+ description: 'Browse trending discussions from the Fincept community forum. View popular topics, latest posts, and engage with other traders and investors.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-maritime',+ popover: {+ title: 'Maritime Intelligence Widget',+ description: 'Track global shipping data, vessel movements, port congestion, freight rates, and trade routes. Essential for supply chain analysis and commodity trading.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-market',+ popover: {+ title: 'Market Data Widget',+ description: 'Monitor specific market segments like Tech Stocks (AAPL, MSFT, GOOGL, NVDA), Banking, Energy, or custom ticker lists. Fully customizable with real-time quotes.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-crypto',+ popover: {+ title: 'Crypto Widget',+ description: 'Track cryptocurrency prices: Bitcoin, Ethereum, Solana, Cardano, and 100+ altcoins. View market cap, 24h volume, price changes, and live charts.',side: 'top',align: 'start'}@@ -96,7 +123,88 @@ export const dashboardTabTourSteps: DriveStep[] = [element: '.widget-watchlist',popover: {title: 'Watchlist Widget',- description: 'Create and monitor custom watchlists. Track your favorite stocks, crypto, and other securities with real-time updates.',+ description: 'Create and monitor custom watchlists. Track your favorite stocks, crypto, ETFs, and other securities with real-time updates. Add/remove symbols easily.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-portfolio',+ popover: {+ title: 'Portfolio Summary',+ description: 'Overview of your portfolio performance: total value, daily P&L, asset allocations, top holdings, sector breakdown, and performance metrics. Syncs with broker accounts.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-alerts',+ popover: {+ title: 'Alerts Widget',+ description: 'Set price alerts, news alerts, and technical indicator triggers. Get notified when stocks hit target prices, volume spikes, or news breaks.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-calendar',+ popover: {+ title: 'Economic Calendar Widget',+ description: 'Track upcoming economic events: earnings releases, Fed meetings, GDP reports, unemployment data, and other market-moving events with impact ratings.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-quick-trade',+ popover: {+ title: 'Quick Trade Widget',+ description: 'Place orders directly from your dashboard. Quick buy/sell interface for connected brokers with real-time quotes and instant execution.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-geopolitics',+ popover: {+ title: 'Geopolitics Widget',+ description: 'AI-powered geopolitical analysis using frameworks from "The Grand Chessboard" and "Prisoners of Geography". Track global power dynamics affecting markets.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-performance',+ popover: {+ title: 'Performance Widget',+ description: 'Analyze portfolio performance metrics: Sharpe ratio, alpha, beta, max drawdown, win rate, and cumulative returns. Compare against benchmarks.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-data-source',+ popover: {+ title: 'Data Source Widget',+ description: 'Connect to 100+ data sources including Bloomberg, Reuters, Alpha Vantage, Polygon.io, and custom APIs. Configure data feeds for each widget.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-polymarket',+ popover: {+ title: 'Polymarket Widget',+ description: 'Track prediction market odds from Polymarket. Monitor betting markets on elections, economic events, tech releases, and real-world outcomes.',+ side: 'top',+ align: 'start'+ }+ },+ {+ element: '.widget-economic-indicators',+ popover: {+ title: 'Economic Indicators Widget',+ description: 'View key economic data: GDP growth, inflation (CPI/PPI), unemployment rate, interest rates, consumer confidence, manufacturing PMI, and more from global economies.',side: 'top',align: 'start'}@@ -108,15 +216,17 @@ export const createDashboardTabTour = () => {showProgress: true,steps: dashboardTabTourSteps,popoverClass: 'fincept-tour-popover',- overlayColor: 'rgba(0, 0, 0, 0.85)',animate: true,smoothScroll: true,allowClose: true,doneBtnText: 'FINISH',nextBtnText: 'NEXT',prevBtnText: 'BACK',- stagePadding: 10,- stageRadius: 5,+ showButtons: ['next', 'previous', 'close'],+ stagePadding: 6,+ stageRadius: 4,+ popoverOffset: 12,+onDestroyed: () => {console.log('Dashboard tab tour completed');}diff --git a/fincept-terminal-desktop/src/components/tabs/tours/equityResearchTabTour.ts b/fincept-terminal-desktop/src/components/tabs/tours/equityResearchTabTour.tsindex 59e16a546..96f740bf5 100644--- a/fincept-terminal-desktop/src/components/tabs/tours/equityResearchTabTour.ts+++ b/fincept-terminal-desktop/src/components/tabs/tours/equityResearchTabTour.ts@@ -150,15 +150,17 @@ export const createEquityResearchTabTour = (setActiveTab?: (tab: string) => voidshowProgress: true,steps: equityResearchTabTourSteps,popoverClass: 'fincept-tour-popover',- overlayColor: 'rgba(0, 0, 0, 0.85)',animate: true,smoothScroll: true,allowClose: true,doneBtnText: 'FINISH',nextBtnText: 'NEXT',prevBtnText: 'BACK',- stagePadding: 10,- stageRadius: 5,+ showButtons: ['next', 'previous', 'close'],+ stagePadding: 6,+ stageRadius: 4,+ popoverOffset: 12,+onHighlightStarted: (element, step, options) => {// Navigate to appropriate sub-tab based on stepif (setActiveTab) {@@ -189,6 +191,7 @@ export const createEquityResearchTabTour = (setActiveTab?: (tab: string) => void}}},+onDestroyed: () => {console.log('Equity Research tab tour completed');}diff --git a/fincept-terminal-desktop/src/components/tabs/tours/marketsTabTour.ts b/fincept-terminal-desktop/src/components/tabs/tours/marketsTabTour.tsindex 7cf4eef97..9c6c612b4 100644--- a/fincept-terminal-desktop/src/components/tabs/tours/marketsTabTour.ts+++ b/fincept-terminal-desktop/src/components/tabs/tours/marketsTabTour.ts@@ -72,15 +72,17 @@ export const createMarketsTabTour = () => {showProgress: true,steps: marketsTabTourSteps,popoverClass: 'fincept-tour-popover',- overlayColor: 'rgba(0, 0, 0, 0.85)',animate: true,smoothScroll: true,allowClose: true,doneBtnText: 'FINISH',nextBtnText: 'NEXT',prevBtnText: 'BACK',- stagePadding: 10,- stageRadius: 5,+ showButtons: ['next', 'previous', 'close'],+ stagePadding: 6,+ stageRadius: 4,+ popoverOffset: 12,+onDestroyed: () => {console.log('Markets tab tour completed');}diff --git a/fincept-terminal-desktop/src/components/tabs/tours/newsTabTour.ts b/fincept-terminal-desktop/src/components/tabs/tours/newsTabTour.tsindex 47af76e3e..c9f9597db 100644--- a/fincept-terminal-desktop/src/components/tabs/tours/newsTabTour.ts+++ b/fincept-terminal-desktop/src/components/tabs/tours/newsTabTour.ts@@ -90,15 +90,17 @@ export const createNewsTabTour = () => {showProgress: true,steps: newsTabTourSteps,popoverClass: 'fincept-tour-popover',- overlayColor: 'rgba(0, 0, 0, 0.85)',animate: true,smoothScroll: true,allowClose: true,doneBtnText: 'FINISH',nextBtnText: 'NEXT',prevBtnText: 'BACK',- stagePadding: 10,- stageRadius: 5,+ showButtons: ['next', 'previous', 'close'],+ stagePadding: 6,+ stageRadius: 4,+ popoverOffset: 12,+onDestroyed: () => {console.log('News tab tour completed');}diff --git a/fincept-terminal-desktop/src/components/tabs/tours/portfolioTabTour.ts b/fincept-terminal-desktop/src/components/tabs/tours/portfolioTabTour.tsindex 479726d9e..b7ee4274b 100644--- a/fincept-terminal-desktop/src/components/tabs/tours/portfolioTabTour.ts+++ b/fincept-terminal-desktop/src/components/tabs/tours/portfolioTabTour.ts@@ -190,15 +190,17 @@ export const createPortfolioTabTour = (setActiveSubTab?: (tab: string) => void)showProgress: true,steps: portfolioTabTourSteps,popoverClass: 'fincept-tour-popover',- overlayColor: 'rgba(0, 0, 0, 0.85)',animate: true,smoothScroll: true,allowClose: true,doneBtnText: 'FINISH',nextBtnText: 'NEXT',prevBtnText: 'BACK',- stagePadding: 10,- stageRadius: 5,+ showButtons: ['next', 'previous', 'close'],+ stagePadding: 6,+ stageRadius: 4,+ popoverOffset: 12,+onHighlightStarted: (element, step, options) => {// Navigate to appropriate sub-tab based on stepif (setActiveSubTab) {@@ -215,6 +217,7 @@ export const createPortfolioTabTour = (setActiveSubTab?: (tab: string) => void)else if (stepElement === 'alerts-view') setActiveSubTab('alerts');}},+onDestroyed: () => {console.log('Portfolio tab tour completed');}diff --git a/fincept-terminal-desktop/src/components/tabs/tours/tourStyles.css b/fincept-terminal-desktop/src/components/tabs/tours/tourStyles.cssindex 1ff340337..d6615cd21 100644--- a/fincept-terminal-desktop/src/components/tabs/tours/tourStyles.css+++ b/fincept-terminal-desktop/src/components/tabs/tours/tourStyles.css@@ -1,191 +1,427 @@-/* Custom driver.js styles for Fincept Terminal theme - Fincept Classic */+/* ============================================================================+ FINCEPT TERMINAL - DRIVER.JS TOUR STYLES+ Clean, modern design with proper layering and no conflicts+ ============================================================================ */-/* Main popover container - Multiple selectors for maximum specificity */-.driver-popover.fincept-tour-popover,-.fincept-tour-popover.driver-popover,-.fincept-tour-popover .driver-popover,-div.driver-popover {+/* Reset and base popover container */+.driver-popover {+ box-sizing: border-box !important;background-color: #1a1a1a !important;- background: #1a1a1a !important;border: 2px solid #FFA500 !important;+ border-radius: 4px !important;+ padding: 16px !important;+ min-width: 240px !important;+ max-width: 340px !important;+ width: auto !important;+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),+ 0 0 0 1px rgba(255, 165, 0, 0.1),+ 0 0 20px rgba(255, 165, 0, 0.3) !important;+ z-index: 2147483647 !important;+ pointer-events: auto !important;+ font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;color: #e0e0e0 !important;+}++/* Ensure all children inherit correct font and reset */+.driver-popover * {+ box-sizing: border-box !important;font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;- box-shadow: 0 0 20px rgba(255, 165, 0, 0.4), 0 0 40px rgba(255, 165, 0, 0.2) !important;- border-radius: 0 !important;- padding: 16px !important;+ margin: 0 !important;+ padding: 0 !important;+ pointer-events: auto !important;}-/* Title styling - Maximum specificity */-.driver-popover .driver-popover-title,-.fincept-tour-popover .driver-popover-title,-div.driver-popover-title,+/* Title - single layer, no duplication */.driver-popover-title {+ display: block !important;color: #FFA500 !important;- font-weight: bold !important;font-size: 13px !important;- border-bottom: 2px solid #404040 !important;- padding-bottom: 10px !important;- margin-bottom: 12px !important;+ font-weight: 700 !important;+ line-height: 1.3 !important;+ margin: 0 !important;+ margin-bottom: 10px !important;+ padding: 0 !important;+ padding-right: 32px !important;+ padding-bottom: 8px !important;+ border-bottom: 1px solid rgba(255, 165, 0, 0.3) !important;text-transform: uppercase !important;- letter-spacing: 1px !important;- font-family: 'Consolas', monospace !important;- background: transparent !important;+ letter-spacing: 0.5px !important;+ position: relative !important;}-/* Description text - Maximum specificity */-.driver-popover .driver-popover-description,-.fincept-tour-popover .driver-popover-description,-div.driver-popover-description,+/* Description - single layer, no duplication */.driver-popover-description {+ display: block !important;color: #cccccc !important;font-size: 12px !important;- line-height: 1.7 !important;- font-family: 'Consolas', monospace !important;font-weight: 400 !important;- background: transparent !important;+ line-height: 1.5 !important;+ margin-bottom: 14px !important;+ position: relative !important;}-/* Footer section */-.fincept-tour-popover .driver-popover-footer {- border-top: 1px solid #404040 !important;- padding-top: 12px !important;- margin-top: 16px !important;+/* Footer container */+.driver-popover-footer {display: flex !important;+ align-items: center !important;justify-content: space-between !important;+ margin-top: 12px !important;+ padding-top: 10px !important;+ border-top: 1px solid rgba(255, 255, 255, 0.1) !important;+}++/* Progress text */+.driver-popover-progress-text {+ display: inline-block !important;+ color: #00ff00 !important;+ font-size: 10px !important;+ font-weight: 600 !important;+ letter-spacing: 0.5px !important;+}++/* Navigation buttons container */+.driver-popover-navigation-btns {+ display: flex !important;+ gap: 6px !important;align-items: center !important;}/* Button base styles */-.fincept-tour-popover .driver-popover-next-btn,-.fincept-tour-popover .driver-popover-prev-btn {+.driver-popover-next-btn,+.driver-popover-prev-btn {+ all: unset !important;+ display: inline-block !important;background-color: #FFA500 !important;color: #000000 !important;border: none !important;- font-weight: bold !important;+ padding: 5px 12px !important;font-size: 10px !important;- padding: 6px 14px !important;- cursor: pointer !important;+ font-weight: 700 !important;text-transform: uppercase !important;- font-family: 'Consolas', monospace !important;- transition: all 0.15s ease !important;letter-spacing: 0.5px !important;- border-radius: 0 !important;-}--/* Next button hover */-.fincept-tour-popover .driver-popover-next-btn:hover {- background-color: #FFB833 !important;- box-shadow: 0 0 10px rgba(255, 165, 0, 0.5) !important;+ cursor: pointer !important;+ transition: all 0.2s ease !important;+ border-radius: 2px !important;+ pointer-events: auto !important;+ white-space: nowrap !important;}-/* Previous button styling */-.fincept-tour-popover .driver-popover-prev-btn {- background-color: #787878 !important;- color: #FFFFFF !important;+.driver-popover-next-btn:hover {+ background-color: #FFB533 !important;+ transform: translateY(-1px) !important;+ box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4) !important;}-.fincept-tour-popover .driver-popover-prev-btn:hover {- background-color: #969696 !important;- box-shadow: 0 0 10px rgba(120, 120, 120, 0.5) !important;+.driver-popover-prev-btn {+ background-color: #404040 !important;+ color: #ffffff !important;}-/* Close button */-.fincept-tour-popover .driver-popover-close-btn {- color: #cccccc !important;- font-size: 20px !important;- opacity: 1 !important;- font-weight: bold !important;- transition: color 0.2s ease !important;+.driver-popover-prev-btn:hover {+ background-color: #555555 !important;+ transform: translateY(-1px) !important;+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;}-.fincept-tour-popover .driver-popover-close-btn:hover {- color: #FFA500 !important;+/* Disabled button state */+.driver-popover-btn-disabled {+ opacity: 0.4 !important;+ cursor: not-allowed !important;+ pointer-events: none !important;}-/* Progress text */-.fincept-tour-popover .driver-popover-progress-text {- color: #00C800 !important;- font-size: 10px !important;- font-weight: bold !important;- font-family: 'Consolas', monospace !important;- letter-spacing: 0.5px !important;+/* Close button - CRITICAL: Must be clickable */+.driver-popover-close-btn {+ all: unset !important;+ position: absolute !important;+ top: 14px !important;+ right: 16px !important;+ width: 20px !important;+ height: 20px !important;+ display: flex !important;+ align-items: center !important;+ justify-content: center !important;+ color: #999999 !important;+ font-size: 20px !important;+ font-weight: 300 !important;+ line-height: 1 !important;+ cursor: pointer !important;+ z-index: 2147483647 !important;+ pointer-events: auto !important;+ transition: all 0.2s ease !important;+ border-radius: 3px !important;+ margin: 0 !important;+ padding: 0 !important;}-/* Active element highlight - Force higher stacking */-.driver-active-element {- outline: 4px solid #FFA500 !important;- outline-offset: 4px !important;- box-shadow: 0 0 0 8px rgba(255, 165, 0, 0.4), 0 0 30px rgba(255, 165, 0, 0.6) !important;- position: relative !important;- z-index: 10001 !important;- background-color: inherit !important;+.driver-popover-close-btn:hover {+ color: #FFA500 !important;+ background-color: rgba(255, 165, 0, 0.15) !important;+ transform: scale(1.05) !important;}-/* Overlay backdrop - Dark but no blur */-.driver-overlay {- background-color: rgba(0, 0, 0, 0.85) !important;+.driver-popover-close-btn:active {+ transform: scale(0.9) !important;}-/* Arrow base */-.fincept-tour-popover .driver-popover-arrow {- border-color: #FFA500 !important;+/* Arrow styling */+.driver-popover-arrow {+ position: absolute !important;+ width: 0 !important;+ height: 0 !important;+ border: 8px solid transparent !important;+ pointer-events: none !important;}-/* Arrow sides */-.fincept-tour-popover .driver-popover-arrow-side-top .driver-popover-arrow {+.driver-popover-arrow-side-top .driver-popover-arrow {border-bottom-color: #FFA500 !important;}-.fincept-tour-popover .driver-popover-arrow-side-bottom .driver-popover-arrow {+.driver-popover-arrow-side-bottom .driver-popover-arrow {border-top-color: #FFA500 !important;}-.fincept-tour-popover .driver-popover-arrow-side-left .driver-popover-arrow {+.driver-popover-arrow-side-left .driver-popover-arrow {border-right-color: #FFA500 !important;}-.fincept-tour-popover .driver-popover-arrow-side-right .driver-popover-arrow {+.driver-popover-arrow-side-right .driver-popover-arrow {border-left-color: #FFA500 !important;}-/* Animation overrides */-.driver-popover {- animation: none !important;+/* ============================================================================+ OVERLAY AND HIGHLIGHT SYSTEM+ ============================================================================ */++/* Overlay background */+.driver-overlay {+ position: fixed !important;+ top: 0 !important;+ left: 0 !important;+ right: 0 !important;+ bottom: 0 !important;+ z-index: 2147483646 !important;+ pointer-events: auto !important;}-/* Ensure proper z-index stacking */-.driver-popover-wrapper {- z-index: 10002 !important;+/* SVG overlay path */+.driver-overlay svg {+ width: 100% !important;+ height: 100% !important;+ position: absolute !important;+ top: 0 !important;+ left: 0 !important;}-.driver-overlay {- z-index: 9998 !important;+.driver-overlay svg path {+ fill: rgba(0, 0, 0, 0.75) !important;}-/* Highlighted element should be above overlay but below popover */+/* Highlighted element */+.driver-active-element,.driver-highlighted-element {- z-index: 10001 !important;position: relative !important;+ z-index: 2147483646 !important;+ outline: 2px solid #FFA500 !important;+ outline-offset: 4px !important;+ box-shadow: 0 0 0 4px rgba(255, 165, 0, 0.2),+ 0 0 20px rgba(255, 165, 0, 0.4) !important;}-/* Stage element (cutout in overlay) */-.driver-stage {- z-index: 10000 !important;+/* Popover wrapper - Allow driver.js to position it */+.driver-popover-wrapper {+ z-index: 2147483647 !important;+ pointer-events: none !important;}-/* Force dark theme on all driver elements */-[class*="driver-popover"] {- background-color: #1a1a1a !important;- background: #1a1a1a !important;- color: #cccccc !important;+.driver-popover-wrapper > * {+ pointer-events: auto !important;}-/* Prevent any white backgrounds */-.driver-popover *:not(button):not(.driver-popover-title):not(.driver-popover-progress-text) {- color: #cccccc !important;+/* ============================================================================+ INTERACTION CONTROL+ ============================================================================ */++/* Disable interactions on body when tour is active */+body:has(.driver-active) {+ overflow: hidden !important;+}++/* Disable grid item interactions during dashboard tour */+body:has(.driver-active) .react-grid-item {+ pointer-events: none !important;+}++/* Disable resize handles */+body:has(.driver-active) .react-resizable-handle {+ display: none !important;+}++/* Ensure tour elements remain interactive */+.driver-active .driver-popover,+.driver-active .driver-popover *,+.driver-active .driver-popover-wrapper,+.driver-active .driver-popover-wrapper *,+.driver-active .driver-overlay,+.driver-active .driver-active-element,+.driver-active .driver-highlighted-element {+ pointer-events: auto !important;+}++/* ============================================================================+ ANIMATIONS+ ============================================================================ */++/* Fade in animation */+@keyframes driver-fade-in {+ from {+ opacity: 0;+ transform: scale(0.95);+ }+ to {+ opacity: 1;+ transform: scale(1);+ }+}++.driver-popover {+ animation: driver-fade-in 0.2s ease-out !important;+}++/* ============================================================================+ RESPONSIVE DESIGN+ ============================================================================ */++/* Tablet and smaller */+@media (max-width: 768px) {+ .driver-popover {+ max-width: calc(100vw - 40px) !important;+ min-width: 220px !important;+ padding: 14px !important;+ }++ .driver-popover-title {+ font-size: 12px !important;+ padding-right: 26px !important;+ margin-bottom: 8px !important;+ }++ .driver-popover-description {+ font-size: 11px !important;+ margin-bottom: 12px !important;+ }++ .driver-popover-close-btn {+ top: 11px !important;+ right: 12px !important;+ width: 20px !important;+ height: 20px !important;+ font-size: 20px !important;+ }++ .driver-popover-next-btn,+ .driver-popover-prev-btn {+ padding: 4px 10px !important;+ font-size: 9px !important;+ }++ .driver-popover-progress-text {+ font-size: 9px !important;+ }++ .driver-popover-footer {+ margin-top: 10px !important;+ padding-top: 8px !important;+ }+}++/* Mobile */+@media (max-width: 480px) {+ .driver-popover {+ max-width: calc(100vw - 24px) !important;+ min-width: 200px !important;+ padding: 12px !important;+ }++ .driver-popover-title {+ font-size: 11px !important;+ margin-bottom: 8px !important;+ padding-bottom: 6px !important;+ padding-right: 24px !important;+ }++ .driver-popover-description {+ font-size: 10px !important;+ margin-bottom: 10px !important;+ line-height: 1.4 !important;+ }++ .driver-popover-close-btn {+ top: 9px !important;+ right: 10px !important;+ width: 18px !important;+ height: 18px !important;+ font-size: 18px !important;+ }++ .driver-popover-footer {+ flex-direction: column !important;+ align-items: stretch !important;+ gap: 8px !important;+ margin-top: 8px !important;+ padding-top: 8px !important;+ }++ .driver-popover-progress-text {+ text-align: center !important;+ font-size: 9px !important;+ }++ .driver-popover-navigation-btns {+ width: 100% !important;+ justify-content: space-between !important;+ }++ .driver-popover-next-btn,+ .driver-popover-prev-btn {+ flex: 1 !important;+ padding: 5px 8px !important;+ text-align: center !important;+ font-size: 9px !important;+ }+}++/* ============================================================================+ ACCESSIBILITY+ ============================================================================ */++/* Focus styles for keyboard navigation */+.driver-popover-next-btn:focus,+.driver-popover-prev-btn:focus,+.driver-popover-close-btn:focus {+ outline: none !important;+ box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.3) !important;+}++/* High contrast mode support */+@media (prefers-contrast: high) {+ .driver-popover {+ border-width: 3px !important;+ }++ .driver-active-element,+ .driver-highlighted-element {+ outline-width: 3px !important;+ }}-/* Ensure buttons stay styled correctly */-.driver-popover button {- font-family: 'Consolas', monospace !important;+/* Reduced motion support */+@media (prefers-reduced-motion: reduce) {+ .driver-popover,+ .driver-popover-next-btn,+ .driver-popover-prev-btn,+ .driver-popover-close-btn {+ animation: none !important;+ transition: none !important;+ }}diff --git a/fincept-terminal-desktop/src/components/tabs/trading/OrderBook_old.tsx.bak b/fincept-terminal-desktop/src/components/tabs/trading/OrderBook_old.tsx.bakdeleted file mode 100644index 83d9a7294..000000000--- a/fincept-terminal-desktop/src/components/tabs/trading/OrderBook_old.tsx.bak+++ /dev/null@@ -1,2 +0,0 @@-// Temporarily stubbed - migration to Rust WebSocket in progress-export function OrderBook() { return <div>Migrating to Rust WebSocket...</div>; }diff --git a/fincept-terminal-desktop/src/components/tabs/trading/TradesFeed_old.tsx.bak b/fincept-terminal-desktop/src/components/tabs/trading/TradesFeed_old.tsx.bakdeleted file mode 100644index 83d9a7294..000000000--- a/fincept-terminal-desktop/src/components/tabs/trading/TradesFeed_old.tsx.bak+++ /dev/null@@ -1,2 +0,0 @@-// Temporarily stubbed - migration to Rust WebSocket in progress-export function OrderBook() { return <div>Migrating to Rust WebSocket...</div>; }diff --git a/fincept-terminal-desktop/src/components/tabs/trading/TradingChart_old.tsx.bak b/fincept-terminal-desktop/src/components/tabs/trading/TradingChart_old.tsx.bakdeleted file mode 100644index 83d9a7294..000000000--- a/fincept-terminal-desktop/src/components/tabs/trading/TradingChart_old.tsx.bak+++ /dev/null@@ -1,2 +0,0 @@-// Temporarily stubbed - migration to Rust WebSocket in progress-export function OrderBook() { return <div>Migrating to Rust WebSocket...</div>; }diff --git a/fincept-terminal-desktop/src/components/tabs/visualization-3d/Visualization3DTab.tsx b/fincept-terminal-desktop/src/components/tabs/visualization-3d/Visualization3DTab.tsxindex 72d6c5256..0c4b28bef 100644--- a/fincept-terminal-desktop/src/components/tabs/visualization-3d/Visualization3DTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/visualization-3d/Visualization3DTab.tsx@@ -1,11 +1,13 @@-import React, { useState, useMemo } from 'react';+import React, { useState, useMemo, Suspense, lazy } from 'react';import { useTerminalTheme } from '@/contexts/ThemeContext';import { TabFooter } from '@/components/common/TabFooter';import { useTranslation } from 'react-i18next';-// @ts-ignore - react-plotly.js types are incomplete-import Plot from 'react-plotly.js';import { RefreshCw, TrendingUp, BarChart3, Activity, Network } from 'lucide-react';+// Lazy load Plotly to avoid production build issues+// @ts-ignore - react-plotly.js types are incomplete+const Plot = lazy(() => import('react-plotly.js'));+type ChartType = 'volatility' | 'correlation' | 'yield-curve' | 'pca';const Visualization3DTab: React.FC = () => {@@ -184,6 +186,7 @@ const Visualization3DTab: React.FC = () => {switch (activeChart) {case 'volatility':return (+ <Suspense fallback={<div className="flex items-center justify-center h-full"><RefreshCw className="animate-spin" /></div>}><Plotdata={[{type: 'surface',@@ -224,10 +227,12 @@ const Visualization3DTab: React.FC = () => {style={{ width: '100%', height: '100%' }}useResizeHandler={true}/>+ </Suspense>);case 'correlation':return (+ <Suspense fallback={<div className="flex items-center justify-center h-full"><RefreshCw className="animate-spin" /></div>}><Plotdata={[{type: 'surface',@@ -264,10 +269,12 @@ const Visualization3DTab: React.FC = () => {style={{ width: '100%', height: '100%' }}useResizeHandler={true}/>+ </Suspense>);case 'yield-curve':return (+ <Suspense fallback={<div className="flex items-center justify-center h-full"><RefreshCw className="animate-spin" /></div>}><Plotdata={[{type: 'surface',@@ -306,10 +313,12 @@ const Visualization3DTab: React.FC = () => {style={{ width: '100%', height: '100%' }}useResizeHandler={true}/>+ </Suspense>);case 'pca':return (+ <Suspense fallback={<div className="flex items-center justify-center h-full"><RefreshCw className="animate-spin" /></div>}><Plotdata={[{type: 'surface',@@ -346,7 +355,11 @@ const Visualization3DTab: React.FC = () => {style={{ width: '100%', height: '100%' }}useResizeHandler={true}/>+ </Suspense>);++ default:+ return null;}};diff --git a/fincept-terminal-desktop/vite.config.ts b/fincept-terminal-desktop/vite.config.tsindex 5d9aa61b8..889937db7 100644--- a/fincept-terminal-desktop/vite.config.ts+++ b/fincept-terminal-desktop/vite.config.ts@@ -142,6 +142,8 @@ export default defineConfig({'buffer','process','ccxt', // Include main CCXT package+ 'plotly.js', // Pre-bundle plotly for production+ 'react-plotly.js','readable-stream','stream-browserify','events',@@ -189,6 +191,7 @@ export default defineConfig({manualChunks: {'react-vendor': ['react', 'react-dom', 'react-router-dom'],'chart-vendor': ['recharts', 'lightweight-charts'],+ 'plotly-vendor': ['plotly.js', 'react-plotly.js'], // Separate chunk for Plotly (heavy 3D lib)'ui-vendor': ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', '@radix-ui/react-popover', '@radix-ui/react-tabs'],'flow-vendor': ['reactflow'],'tauri-vendor': ['@tauri-apps/api', '@tauri-apps/plugin-dialog'],