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
dashboard, news, maritime tab updates
tilakpatel22db3ca600e38c
diff --git a/fincept-terminal-desktop/package-lock.json b/fincept-terminal-desktop/package-lock.jsonindex e6954dc6c..79e0b9634 100644--- a/fincept-terminal-desktop/package-lock.json+++ b/fincept-terminal-desktop/package-lock.json@@ -40,7 +40,9 @@"@tauri-apps/plugin-dialog": "^2.4.2","@tauri-apps/plugin-http": "^2.5.2","@tauri-apps/plugin-opener": "^2",+ "@tauri-apps/plugin-shell": "^2.3.3","@tauri-apps/plugin-sql": "^2.3.0",+ "@types/react-grid-layout": "^1.3.5","axios": "^1.12.2","cheerio": "^1.1.2","class-variance-authority": "^0.7.1",@@ -66,6 +68,7 @@"react-confetti": "^6.4.0","react-day-picker": "^9.11.0","react-dom": "^19.1.0",+ "react-grid-layout": "^1.5.2","react-markdown": "^10.1.0","reactflow": "^11.11.4","recharts": "^2.15.4",@@ -4083,6 +4086,15 @@"@tauri-apps/api": "^2.8.0"}},+ "node_modules/@tauri-apps/plugin-shell": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.3.3.tgz",+ "integrity": "sha512-Xod+pRcFxmOWFWEnqH5yZcA7qwAMuaaDkMR1Sply+F8VfBj++CGnj2xf5UoialmjZ2Cvd8qrvSCbU+7GgNVsKQ==",+ "license": "MIT OR Apache-2.0",+ "dependencies": {+ "@tauri-apps/api": "^2.8.0"+ }+ },"node_modules/@tauri-apps/plugin-sql": {"version": "2.3.0","resolved": "https://registry.npmjs.org/@tauri-apps/plugin-sql/-/plugin-sql-2.3.0.tgz",@@ -4532,6 +4544,15 @@"@types/react": "^19.0.0"}},+ "node_modules/@types/react-grid-layout": {+ "version": "1.3.5",+ "resolved": "https://registry.npmjs.org/@types/react-grid-layout/-/react-grid-layout-1.3.5.tgz",+ "integrity": "sha512-WH/po1gcEcoR6y857yAnPGug+ZhkF4PaTUxgAbwfeSH/QOgVSakKHBXoPGad/sEznmkiaK3pqHk+etdWisoeBQ==",+ "license": "MIT",+ "dependencies": {+ "@types/react": "*"+ }+ },"node_modules/@types/retry": {"version": "0.12.0","resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz",@@ -8715,6 +8736,44 @@"react": "^19.1.1"}},+ "node_modules/react-draggable": {+ "version": "4.5.0",+ "resolved": "https://registry.npmjs.org/react-draggable/-/react-draggable-4.5.0.tgz",+ "integrity": "sha512-VC+HBLEZ0XJxnOxVAZsdRi8rD04Iz3SiiKOoYzamjylUcju/hP9np/aZdLHf/7WOD268WMoNJMvYfB5yAK45cw==",+ "license": "MIT",+ "dependencies": {+ "clsx": "^2.1.1",+ "prop-types": "^15.8.1"+ },+ "peerDependencies": {+ "react": ">= 16.3.0",+ "react-dom": ">= 16.3.0"+ }+ },+ "node_modules/react-grid-layout": {+ "version": "1.5.2",+ "resolved": "https://registry.npmjs.org/react-grid-layout/-/react-grid-layout-1.5.2.tgz",+ "integrity": "sha512-vT7xmQqszTT+sQw/LfisrEO4le1EPNnSEMVHy6sBZyzS3yGkMywdOd+5iEFFwQwt0NSaGkxuRmYwa1JsP6OJdw==",+ "license": "MIT",+ "dependencies": {+ "clsx": "^2.1.1",+ "fast-equals": "^4.0.3",+ "prop-types": "^15.8.1",+ "react-draggable": "^4.4.6",+ "react-resizable": "^3.0.5",+ "resize-observer-polyfill": "^1.5.1"+ },+ "peerDependencies": {+ "react": ">= 16.3.0",+ "react-dom": ">= 16.3.0"+ }+ },+ "node_modules/react-grid-layout/node_modules/fast-equals": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-4.0.3.tgz",+ "integrity": "sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg==",+ "license": "MIT"+ },"node_modules/react-is": {"version": "18.3.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",@@ -8805,6 +8864,19 @@}}},+ "node_modules/react-resizable": {+ "version": "3.0.5",+ "resolved": "https://registry.npmjs.org/react-resizable/-/react-resizable-3.0.5.tgz",+ "integrity": "sha512-vKpeHhI5OZvYn82kXOs1bC8aOXktGU5AmKAgaZS4F5JPburCtbmDPqE7Pzp+1kN4+Wb81LlF33VpGwWwtXem+w==",+ "license": "MIT",+ "dependencies": {+ "prop-types": "15.x",+ "react-draggable": "^4.0.3"+ },+ "peerDependencies": {+ "react": ">= 16.3"+ }+ },"node_modules/react-smooth": {"version": "4.0.4","resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz",@@ -9024,6 +9096,12 @@"license": "MIT","peer": true},+ "node_modules/resize-observer-polyfill": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",+ "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==",+ "license": "MIT"+ },"node_modules/retry": {"version": "0.13.1","resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",diff --git a/fincept-terminal-desktop/package.json b/fincept-terminal-desktop/package.jsonindex f6bd427a1..8284bf9b2 100644--- a/fincept-terminal-desktop/package.json+++ b/fincept-terminal-desktop/package.json@@ -42,7 +42,9 @@"@tauri-apps/plugin-dialog": "^2.4.2","@tauri-apps/plugin-http": "^2.5.2","@tauri-apps/plugin-opener": "^2",+ "@tauri-apps/plugin-shell": "^2.3.3","@tauri-apps/plugin-sql": "^2.3.0",+ "@types/react-grid-layout": "^1.3.5","axios": "^1.12.2","cheerio": "^1.1.2","class-variance-authority": "^0.7.1",@@ -68,6 +70,7 @@"react-confetti": "^6.4.0","react-day-picker": "^9.11.0","react-dom": "^19.1.0",+ "react-grid-layout": "^1.5.2","react-markdown": "^10.1.0","reactflow": "^11.11.4","recharts": "^2.15.4",diff --git a/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx b/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsxindex b6554f765..52b6c5e39 100644--- a/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx+++ b/fincept-terminal-desktop/src/components/dashboard/DashboardScreen.tsx@@ -497,13 +497,21 @@ export default function FinxeptTerminal() {position: 'relative',flexShrink: 0}}>- <div style={{- overflowX: 'auto',- overflowY: 'hidden',- height: '100%',- scrollbarWidth: 'none', // Firefox- msOverflowStyle: 'none', // IE/Edge- }} className="hide-scrollbar">+ <div+ style={{+ overflowX: 'auto',+ overflowY: 'hidden',+ height: '100%',+ scrollbarWidth: 'none',+ msOverflowStyle: 'none'+ }}+ className="hide-scrollbar"+ onWheel={(e) => {+ e.preventDefault();+ const container = e.currentTarget;+ container.scrollLeft += e.deltaY;+ }}+ ><style>{`.hide-scrollbar::-webkit-scrollbar {display: none;diff --git a/fincept-terminal-desktop/src/components/tabs/DashboardTab.tsx b/fincept-terminal-desktop/src/components/tabs/DashboardTab.tsxindex a48dca650..957df4afe 100644--- a/fincept-terminal-desktop/src/components/tabs/DashboardTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/DashboardTab.tsx@@ -1,55 +1,139 @@import React, { useState, useEffect } from 'react';+import GridLayout, { Layout } from 'react-grid-layout';+import { Plus, RotateCcw, Save } from 'lucide-react';+import {+ NewsWidget,+ MarketDataWidget,+ WatchlistWidget,+ ForumWidget,+ CryptoWidget,+ CommoditiesWidget,+ GlobalIndicesWidget,+ ForexWidget,+ MaritimeWidget,+ WidgetType,+ WidgetConfig+} from './dashboard/widgets';+import { AddWidgetModal } from './dashboard/AddWidgetModal';+import 'react-grid-layout/css/styles.css';+import 'react-resizable/css/styles.css';++const BLOOMBERG_ORANGE = '#FFA500';+const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_YELLOW = '#FFFF00';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_DARK_BG = '#000000';+const BLOOMBERG_PANEL_BG = '#0a0a0a';++interface WidgetInstance extends WidgetConfig {+ layout: Layout;+}++const DEFAULT_LAYOUT: WidgetInstance[] = [+ // Row 1 - Top indices and major markets+ {+ id: 'indices-1',+ type: 'indices',+ title: 'Global Indices - Top 12',+ config: {},+ layout: { i: 'indices-1', x: 0, y: 0, w: 4, h: 5, minW: 3, minH: 4 }+ },+ {+ id: 'crypto-1',+ type: 'crypto',+ title: 'Cryptocurrency Markets',+ config: {},+ layout: { i: 'crypto-1', x: 4, y: 0, w: 4, h: 5, minW: 3, minH: 4 }+ },+ {+ id: 'news-1',+ type: 'news',+ title: 'Market News',+ config: { newsCategory: 'MARKETS', newsLimit: 5 },+ layout: { i: 'news-1', x: 8, y: 0, w: 4, h: 5, minW: 2, minH: 3 }+ },+ // Row 2 - Forex, Commodities, Tech News+ {+ id: 'forex-1',+ type: 'forex',+ title: 'Forex - Major Pairs',+ config: {},+ layout: { i: 'forex-1', x: 0, y: 5, w: 3, h: 4, minW: 2, minH: 3 }+ },+ {+ id: 'commodities-1',+ type: 'commodities',+ title: 'Commodities',+ config: {},+ layout: { i: 'commodities-1', x: 3, y: 5, w: 3, h: 4, minW: 2, minH: 3 }+ },+ {+ id: 'news-2',+ type: 'news',+ title: 'Tech News',+ config: { newsCategory: 'TECH', newsLimit: 5 },+ layout: { i: 'news-2', x: 6, y: 5, w: 3, h: 4, minW: 2, minH: 3 }+ },+ {+ id: 'news-3',+ type: 'news',+ title: 'Earnings News',+ config: { newsCategory: 'EARNINGS', newsLimit: 5 },+ layout: { i: 'news-3', x: 9, y: 5, w: 3, h: 4, minW: 2, minH: 3 }+ },+ // Row 3 - Forum, Maritime Intelligence, and Tech Stocks+ {+ id: 'forum-1',+ type: 'forum',+ title: 'Trending Forum Posts',+ config: { forumCategoryName: 'Trending', forumLimit: 5 },+ layout: { i: 'forum-1', x: 0, y: 9, w: 4, h: 4, minW: 2, minH: 3 }+ },+ {+ id: 'maritime-1',+ type: 'maritime',+ title: 'Maritime Intelligence',+ config: {},+ layout: { i: 'maritime-1', x: 4, y: 9, w: 4, h: 4, minW: 2, minH: 3 }+ },+ {+ id: 'market-2',+ type: 'market',+ title: 'Tech Stocks',+ config: { marketCategory: 'Tech', marketTickers: ['AAPL', 'MSFT', 'GOOGL', 'AMZN', 'NVDA'] },+ layout: { i: 'market-2', x: 8, y: 9, w: 4, h: 4, minW: 2, minH: 3 }+ }+];++const STORAGE_KEY = 'dashboard-widgets';const DashboardTab: React.FC = () => {+ const [widgets, setWidgets] = useState<WidgetInstance[]>([]);+ const [showAddModal, setShowAddModal] = useState(false);const [currentTime, setCurrentTime] = useState(new Date());- const [stockData, setStockData] = useState({- 'AAPL': { price: 175.43, change: 2.34, changePct: 1.35, volume: 45200000, high: 177.89, low: 174.12, open: 175.00 },- 'MSFT': { price: 420.67, change: 4.12, changePct: 0.99, volume: 28700000, high: 422.45, low: 418.90, open: 420.00 },- 'GOOGL': { price: 140.23, change: -1.23, changePct: -0.87, volume: 32100000, high: 142.45, low: 139.78, open: 141.50 },- 'AMZN': { price: 145.32, change: 1.89, changePct: 1.32, volume: 41800000, high: 147.23, low: 144.56, open: 145.00 },- 'NVDA': { price: 800.45, change: 12.45, changePct: 1.58, volume: 52300000, high: 805.67, low: 795.23, open: 798.00 },- 'META': { price: 345.67, change: -2.34, changePct: -0.67, volume: 31500000, high: 348.90, low: 344.12, open: 347.50 }- });-- const [indices, setIndices] = useState({- 'S&P 500': { value: 5234.18, change: 0.45 },- 'NASDAQ': { value: 16421.67, change: -0.09 },- 'DOW JONES': { value: 38567.89, change: 0.41 },- 'RUSSELL 2000': { value: 2089.45, change: 0.43 },- 'VIX': { value: 18.23, change: -2.41 },- 'FTSE 100': { value: 7634.56, change: 0.16 }- });-- const [economicIndicators, setEconomicIndicators] = useState({- 'USD/EUR': { value: 1.0845, change: 0.21 },- 'USD/GBP': { value: 1.2578, change: -0.10 },- 'GOLD': { value: 2318.45, change: 0.55 },- 'OIL WTI': { value: 78.89, change: -1.53 },- '10Y TREASURY': { value: 4.35, change: 0.46 },- 'BITCOIN': { value: 67234.56, change: 1.87 }- });-- const [newsHeadlines, setNewsHeadlines] = useState([- 'Federal Reserve Signals Potential Rate Cut in Q2 2024',- 'Tech Stocks Rally on AI Investment Surge',- 'Oil Prices Drop on Increased Production Outlook',- 'European Markets Open Higher on GDP Data',- 'Cryptocurrency Regulation Bill Advances in Senate',- 'Banking Sector Shows Strong Q4 Earnings',- 'Supply Chain Disruptions Impact Manufacturing',- 'Green Energy Investments Reach Record High'- ]);-- // Bloomberg color scheme (exact from Python)- const BLOOMBERG_ORANGE = '#FFA500';- const BLOOMBERG_WHITE = '#FFFFFF';- const BLOOMBERG_RED = '#FF0000';- const BLOOMBERG_GREEN = '#00C800';- const BLOOMBERG_YELLOW = '#FFFF00';- const BLOOMBERG_GRAY = '#787878';- const BLOOMBERG_DARK_BG = '#1a1a1a';- const BLOOMBERG_PANEL_BG = '#000000';+ const [nextId, setNextId] = useState(1);+ const [containerWidth, setContainerWidth] = useState(1200);+ const containerRef = React.useRef<HTMLDivElement>(null);+ // Load widgets from localStorage on mount+ useEffect(() => {+ const saved = localStorage.getItem(STORAGE_KEY);+ if (saved) {+ try {+ const parsed = JSON.parse(saved);+ setWidgets(parsed.widgets);+ setNextId(parsed.nextId || 1);+ } catch (error) {+ console.error('Failed to load dashboard layout:', error);+ setWidgets(DEFAULT_LAYOUT);+ }+ } else {+ setWidgets(DEFAULT_LAYOUT);+ }+ }, []);++ // Update timeuseEffect(() => {const timer = setInterval(() => {setCurrentTime(new Date());@@ -57,373 +141,169 @@ const DashboardTab: React.FC = () => {return () => clearInterval(timer);}, []);- // Create left panel (Market Monitor) - Responsive- const createLeftPanel = () => (- <div style={{- flex: '1 1 300px',- minWidth: '280px',- maxWidth: '400px',- minHeight: '500px',- backgroundColor: BLOOMBERG_PANEL_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- padding: '8px',- overflow: 'auto'- }}>- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '14px', fontWeight: 'bold', marginBottom: '8px' }}>- MARKET MONITOR- </div>- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '12px' }}></div>-- {/* Global Indices */}- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '12px', fontWeight: 'bold', marginBottom: '8px' }}>- GLOBAL INDICES- </div>- <div style={{- display: 'grid',- gridTemplateColumns: '2fr 1fr 1fr',- gap: '4px',- fontSize: '9px',- marginBottom: '12px'- }}>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', borderBottom: `1px solid ${BLOOMBERG_GRAY}`, padding: '2px 0' }}>Index</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', borderBottom: `1px solid ${BLOOMBERG_GRAY}`, padding: '2px 0', textAlign: 'right' }}>Value</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', borderBottom: `1px solid ${BLOOMBERG_GRAY}`, padding: '2px 0', textAlign: 'right' }}>Change %</div>-- {Object.entries(indices).map(([index, data]) => (- <React.Fragment key={index}>- <div style={{ color: BLOOMBERG_WHITE, padding: '2px 0' }}>{index}</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right', padding: '2px 0' }}>{data.value.toFixed(2)}</div>- <div style={{- color: data.change > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,- textAlign: 'right',- padding: '2px 0'- }}>- {data.change > 0 ? '+' : ''}{data.change.toFixed(2)}%- </div>- </React.Fragment>- ))}- </div>-- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '12px' }}></div>-- {/* Economic Indicators */}- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '12px', fontWeight: 'bold', marginBottom: '8px' }}>- ECONOMIC INDICATORS- </div>- <div style={{- display: 'grid',- gridTemplateColumns: '2fr 1fr 1fr',- gap: '4px',- fontSize: '9px',- marginBottom: '12px'- }}>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', borderBottom: `1px solid ${BLOOMBERG_GRAY}`, padding: '2px 0' }}>Indicator</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', borderBottom: `1px solid ${BLOOMBERG_GRAY}`, padding: '2px 0', textAlign: 'right' }}>Value</div>- <div style={{ color: BLOOMBERG_WHITE, fontWeight: 'bold', borderBottom: `1px solid ${BLOOMBERG_GRAY}`, padding: '2px 0', textAlign: 'right' }}>Change</div>-- {Object.entries(economicIndicators).map(([indicator, data]) => (- <React.Fragment key={indicator}>- <div style={{ color: BLOOMBERG_WHITE, padding: '2px 0' }}>{indicator}</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right', padding: '2px 0' }}>{data.value.toFixed(2)}</div>- <div style={{- color: data.change > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,- textAlign: 'right',- padding: '2px 0'- }}>- {data.change > 0 ? '+' : ''}{data.change.toFixed(2)}- </div>- </React.Fragment>- ))}- </div>-- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '12px' }}></div>-- {/* Latest News */}- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '12px', fontWeight: 'bold', marginBottom: '8px' }}>- LATEST NEWS- </div>- {newsHeadlines.slice(0, 4).map((headline, index) => (- <div key={index} style={{ marginBottom: '8px' }}>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '9px', lineHeight: '1.3' }}>- {currentTime.toTimeString().substring(0, 5)} - {headline.length > 50 ? headline.substring(0, 47) + '...' : headline}- </div>- </div>- ))}- </div>- );-- // Create center panel (Stock Data with Tabs) - Responsive- const createCenterPanel = () => (- <div style={{- flex: '2 1 500px',- minWidth: '400px',- minHeight: '500px',- backgroundColor: BLOOMBERG_PANEL_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- padding: '8px',- overflow: 'auto'- }}>- {/* Tab Bar */}- <div style={{ display: 'flex', marginBottom: '12px', borderBottom: `1px solid ${BLOOMBERG_GRAY}` }}>- <div style={{- padding: '8px 16px',- backgroundColor: BLOOMBERG_ORANGE,- color: 'black',- fontSize: '11px',- fontWeight: 'bold',- marginRight: '2px'- }}>- Market Data- </div>- <div style={{- padding: '8px 16px',- backgroundColor: BLOOMBERG_DARK_BG,- color: BLOOMBERG_WHITE,- fontSize: '11px',- fontWeight: 'bold',- marginRight: '2px'- }}>- Charts- </div>- <div style={{- padding: '8px 16px',- backgroundColor: BLOOMBERG_DARK_BG,- color: BLOOMBERG_WHITE,- fontSize: '11px',- fontWeight: 'bold'- }}>- News- </div>- </div>-- {/* Market Data Tab Content */}- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '14px', fontWeight: 'bold', marginBottom: '8px' }}>- TOP STOCKS- </div>-- {/* Stock Table */}- <div style={{ marginBottom: '20px' }}>- <div style={{- display: 'grid',- gridTemplateColumns: '1fr 1fr 1fr 1fr 1.5fr 1fr 1fr',- gap: '4px',- fontSize: '10px',- fontWeight: 'bold',- borderBottom: `1px solid ${BLOOMBERG_GRAY}`,- padding: '4px 0',- marginBottom: '4px'- }}>- <div style={{ color: BLOOMBERG_WHITE }}>Ticker</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>Last</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>Chg</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>Chg%</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>Volume</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>High</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>Low</div>- </div>-- {Object.entries(stockData).map(([ticker, data]) => (- <div key={ticker} style={{- display: 'grid',- gridTemplateColumns: '1fr 1fr 1fr 1fr 1.5fr 1fr 1fr',- gap: '4px',- fontSize: '9px',- borderBottom: `1px solid rgba(120,120,120,0.3)`,- padding: '2px 0',- alignItems: 'center'- }}>- <div style={{ color: BLOOMBERG_WHITE }}>{ticker}</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>{data.price.toFixed(2)}</div>- <div style={{- color: data.change > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,- textAlign: 'right'- }}>- {data.change > 0 ? '+' : ''}{data.change.toFixed(2)}- </div>- <div style={{- color: data.changePct > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,- textAlign: 'right'- }}>- {data.changePct > 0 ? '+' : ''}{data.changePct.toFixed(2)}%- </div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>{data.volume.toLocaleString()}</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>{data.high.toFixed(2)}</div>- <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>{data.low.toFixed(2)}</div>- </div>- ))}- </div>-- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '12px' }}></div>-- {/* Stock Details */}- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '14px', fontWeight: 'bold', marginBottom: '8px' }}>- STOCK DETAILS- </div>-- <div style={{ display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '12px' }}>- <input- type="text"- defaultValue="AAPL"- style={{- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: BLOOMBERG_WHITE,- padding: '4px 8px',- fontSize: '11px',- width: '150px'- }}- />- <button style={{- backgroundColor: BLOOMBERG_ORANGE,- color: 'black',- border: 'none',- padding: '4px 12px',- fontSize: '11px',- fontWeight: 'bold'- }}>- Load- </button>- </div>-- {/* AAPL Details */}- <div style={{ display: 'flex', gap: '20px' }}>- <div>- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '12px', fontWeight: 'bold' }}>Apple Inc (AAPL US Equity)</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px', marginBottom: '4px' }}>Technology - Consumer Electronics</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>Last Price: {stockData.AAPL.price.toFixed(2)}</div>- <div style={{- color: stockData.AAPL.changePct > 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,- fontSize: '10px'- }}>- Change: {stockData.AAPL.change > 0 ? '+' : ''}{stockData.AAPL.change.toFixed(2)} ({stockData.AAPL.changePct > 0 ? '+' : ''}{stockData.AAPL.changePct.toFixed(2)}%)- </div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>Volume: {stockData.AAPL.volume.toLocaleString()}</div>- </div>- <div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>High: {stockData.AAPL.high.toFixed(2)}</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>Low: {stockData.AAPL.low.toFixed(2)}</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>Open: {stockData.AAPL.open.toFixed(2)}</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>P/E Ratio: 28.5</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px' }}>Market Cap: $2.8T</div>- </div>- </div>- </div>- );-- // Create right panel (Command Line) - Responsive- const createRightPanel = () => (- <div style={{- flex: '1 1 300px',- minWidth: '280px',- maxWidth: '400px',- minHeight: '500px',- backgroundColor: BLOOMBERG_PANEL_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- padding: '8px',- overflow: 'auto'- }}>- <div style={{ color: BLOOMBERG_ORANGE, fontSize: '14px', fontWeight: 'bold', marginBottom: '8px' }}>- COMMAND LINE- </div>- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '12px' }}></div>-- {/* Command History */}- <div style={{- height: '200px',- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- padding: '8px',- marginBottom: '12px',- overflow: 'auto'- }}>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px', marginBottom: '4px' }}>> AAPL US Equity <GO></div>- <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', marginBottom: '8px', marginLeft: '8px' }}>Loading AAPL US Equity...</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px', marginBottom: '4px' }}>> TOP <GO></div>- <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', marginBottom: '8px', marginLeft: '8px' }}>Loading TOP news...</div>- <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px', marginBottom: '4px' }}>> WEI <GO></div>- <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', marginBottom: '8px', marginLeft: '8px' }}>Loading World Equity Indices...</div>- </div>-- {/* Command Input */}- <div style={{ display: 'flex', alignItems: 'center', marginBottom: '8px' }}>- <span style={{ color: BLOOMBERG_WHITE, marginRight: '8px' }}>></span>- <input- type="text"- style={{- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: BLOOMBERG_WHITE,- padding: '4px 8px',- fontSize: '11px',- flex: 1- }}- />- </div>- <div style={{ color: BLOOMBERG_GRAY, fontSize: '9px', marginBottom: '12px' }}>- <HELP> for commands. Press <GO> to execute.- </div>-- <div style={{ borderBottom: `1px solid ${BLOOMBERG_GRAY}`, marginBottom: '12px' }}></div>-- {/* Quick Actions */}- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '12px', fontWeight: 'bold', marginBottom: '8px' }}>- QUICK ACTIONS- </div>- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>- <button style={{- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: BLOOMBERG_WHITE,- padding: '4px 8px',- fontSize: '10px',- textAlign: 'left'- }}>- WEI - World Equity Indices- </button>- <button style={{- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: BLOOMBERG_WHITE,- padding: '4px 8px',- fontSize: '10px',- textAlign: 'left'- }}>- TOP - Top News- </button>- <button style={{- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: BLOOMBERG_WHITE,- padding: '4px 8px',- fontSize: '10px',- textAlign: 'left'- }}>- CURY - Currency Rates- </button>- <button style={{- backgroundColor: BLOOMBERG_DARK_BG,- border: `1px solid ${BLOOMBERG_GRAY}`,- color: BLOOMBERG_WHITE,- padding: '4px 8px',- fontSize: '10px',- textAlign: 'left'- }}>- PORT - Portfolio- </button>- </div>+ // Handle responsive width+ useEffect(() => {+ const updateWidth = () => {+ if (containerRef.current) {+ const width = containerRef.current.offsetWidth;+ console.log('[Dashboard] Container width updated:', width);+ setContainerWidth(width);+ }+ };++ // Initial width+ updateWidth();++ // Update on window resize+ window.addEventListener('resize', updateWidth);++ // Use ResizeObserver for more accurate tracking+ const resizeObserver = new ResizeObserver(() => {+ updateWidth();+ });++ if (containerRef.current) {+ resizeObserver.observe(containerRef.current);+ }++ // Also check after a short delay (for initial render)+ const timeout = setTimeout(updateWidth, 100);++ return () => {+ window.removeEventListener('resize', updateWidth);+ resizeObserver.disconnect();+ clearTimeout(timeout);+ };+ }, []);- {/* Status */}- <div style={{ marginTop: '16px' }}>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '12px', fontWeight: 'bold', marginBottom: '8px' }}>- STATUS- </div>- <div style={{ color: BLOOMBERG_GREEN, fontSize: '10px' }}>● Market Data: LIVE</div>- <div style={{ color: BLOOMBERG_GREEN, fontSize: '10px' }}>● News Feed: ACTIVE</div>- <div style={{ color: BLOOMBERG_GREEN, fontSize: '10px' }}>● API: CONNECTED</div>- <div style={{ color: BLOOMBERG_YELLOW, fontSize: '10px' }}>● Latency: ~200ms</div>- </div>- </div>- );+ // Save layout to localStorage+ const saveLayout = () => {+ localStorage.setItem(STORAGE_KEY, JSON.stringify({ widgets, nextId }));+ alert('Dashboard layout saved!');+ };++ // Reset to default layout+ const resetLayout = () => {+ if (confirm('Reset dashboard to default layout? This will remove all custom widgets.')) {+ setWidgets(DEFAULT_LAYOUT);+ localStorage.removeItem(STORAGE_KEY);+ }+ };++ // Add new widget+ const handleAddWidget = (widgetType: WidgetType, config?: any) => {+ const newWidget: WidgetInstance = {+ id: `${widgetType}-${nextId}`,+ type: widgetType,+ title: config.watchlistName || config.marketCategory || config.newsCategory || config.forumCategoryName || widgetType,+ config,+ layout: {+ i: `${widgetType}-${nextId}`,+ x: (widgets.length * 3) % 12,+ y: Infinity, // Put at bottom+ w: 4,+ h: 4,+ minW: 2,+ minH: 3+ }+ };++ setWidgets([...widgets, newWidget]);+ setNextId(nextId + 1);+ };++ // Remove widget+ const handleRemoveWidget = (id: string) => {+ setWidgets(widgets.filter(w => w.id !== id));+ };++ // Handle layout change+ const handleLayoutChange = (layout: Layout[]) => {+ setWidgets(widgets.map(widget => {+ const newLayout = layout.find(l => l.i === widget.id);+ return newLayout ? { ...widget, layout: newLayout } : widget;+ }));+ };++ // Render widget based on type+ const renderWidget = (widget: WidgetInstance) => {+ switch (widget.type) {+ case 'news':+ return (+ <NewsWidget+ id={widget.id}+ category={widget.config?.newsCategory}+ limit={widget.config?.newsLimit}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'market':+ return (+ <MarketDataWidget+ id={widget.id}+ category={widget.config?.marketCategory}+ tickers={widget.config?.marketTickers}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'watchlist':+ return (+ <WatchlistWidget+ id={widget.id}+ watchlistId={widget.config?.watchlistId}+ watchlistName={widget.config?.watchlistName}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'forum':+ return (+ <ForumWidget+ id={widget.id}+ categoryId={widget.config?.forumCategoryId}+ categoryName={widget.config?.forumCategoryName}+ limit={widget.config?.forumLimit}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'crypto':+ return (+ <CryptoWidget+ id={widget.id}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'commodities':+ return (+ <CommoditiesWidget+ id={widget.id}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'indices':+ return (+ <GlobalIndicesWidget+ id={widget.id}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'forex':+ return (+ <ForexWidget+ id={widget.id}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ case 'maritime':+ return (+ <MaritimeWidget+ id={widget.id}+ onRemove={() => handleRemoveWidget(widget.id)}+ />+ );+ default:+ return <div>Unknown widget type</div>;+ }+ };return (<div style={{@@ -435,70 +315,257 @@ const DashboardTab: React.FC = () => {display: 'flex',flexDirection: 'column'}}>- {/* Header - Responsive */}+ <style>{`+ /* Scrollbar styling */+ *::-webkit-scrollbar {+ width: 8px;+ height: 8px;+ }+ *::-webkit-scrollbar-track {+ background: #1a1a1a;+ }+ *::-webkit-scrollbar-thumb {+ background: #404040;+ border-radius: 4px;+ }+ *::-webkit-scrollbar-thumb:hover {+ background: #525252;+ }++ /* Grid layout drag handle styling */+ .react-grid-item.react-grid-placeholder {+ background: ${BLOOMBERG_ORANGE} !important;+ opacity: 0.3;+ border-radius: 4px;+ }++ .react-grid-item.resizing {+ opacity: 0.9;+ z-index: 100;+ }++ .react-grid-item {+ transition: all 200ms ease;+ transition-property: left, top, width, height;+ }++ .react-grid-item.cssTransforms {+ transition-property: transform, width, height;+ }++ .react-grid-item.react-draggable-dragging {+ transition: none;+ z-index: 100;+ will-change: transform;+ }++ .react-resizable-handle {+ opacity: 0;+ transition: opacity 0.2s;+ }++ .react-grid-item:hover .react-resizable-handle {+ opacity: 0.5;+ }++ .react-resizable-handle::after {+ border-right: 2px solid ${BLOOMBERG_ORANGE};+ border-bottom: 2px solid ${BLOOMBERG_ORANGE};+ }+ `}</style>++ {/* Header Bar */}<div style={{- display: 'flex',- alignItems: 'center',- flexWrap: 'wrap',- padding: '8px 12px',backgroundColor: BLOOMBERG_PANEL_BG,borderBottom: `1px solid ${BLOOMBERG_GRAY}`,- fontSize: '12px',- gap: '12px',+ padding: '8px 12px',flexShrink: 0}}>- <span style={{ color: BLOOMBERG_ORANGE, fontWeight: 'bold' }}>BLOOMBERG TERMINAL</span>- <span style={{ color: BLOOMBERG_WHITE, fontSize: '11px' }}>- {currentTime.toISOString().replace('T', ' ').substring(0, 19)}- </span>- <div style={{ marginLeft: 'auto', display: 'flex', alignItems: 'center', gap: '8px' }}>- <span style={{ color: BLOOMBERG_GREEN, fontSize: '14px' }}>●</span>- <span style={{ color: BLOOMBERG_GREEN, fontSize: '10px', fontWeight: 'bold' }}>LIVE</span>+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>+ <span style={{ color: BLOOMBERG_ORANGE, fontWeight: 'bold', fontSize: '14px' }}>+ CUSTOMIZABLE DASHBOARD+ </span>+ <span style={{ color: BLOOMBERG_WHITE }}>|</span>+ <span style={{ color: BLOOMBERG_GREEN, fontSize: '10px' }}>+ ● LIVE+ </span>+ <span style={{ color: BLOOMBERG_WHITE }}>|</span>+ <span style={{ color: BLOOMBERG_YELLOW, fontSize: '11px' }}>+ {currentTime.toISOString().replace('T', ' ').substring(0, 19)} UTC+ </span>+ <span style={{ color: BLOOMBERG_WHITE }}>|</span>+ <span style={{ color: BLOOMBERG_GRAY, fontSize: '10px' }}>+ WIDGETS: {widgets.length}+ </span>+ </div>++ <div style={{ display: 'flex', gap: '8px' }}>+ <button+ onClick={() => setShowAddModal(true)}+ style={{+ background: BLOOMBERG_GREEN,+ color: 'black',+ border: 'none',+ padding: '6px 12px',+ fontSize: '10px',+ fontWeight: 'bold',+ cursor: 'pointer',+ display: 'flex',+ alignItems: 'center',+ gap: '4px',+ borderRadius: '2px'+ }}+ >+ <Plus size={12} />+ ADD WIDGET+ </button>+ <button+ onClick={saveLayout}+ style={{+ background: BLOOMBERG_ORANGE,+ color: 'black',+ border: 'none',+ padding: '6px 12px',+ fontSize: '10px',+ fontWeight: 'bold',+ cursor: 'pointer',+ display: 'flex',+ alignItems: 'center',+ gap: '4px',+ borderRadius: '2px'+ }}+ >+ <Save size={12} />+ SAVE LAYOUT+ </button>+ <button+ onClick={resetLayout}+ style={{+ background: BLOOMBERG_GRAY,+ color: 'black',+ border: 'none',+ padding: '6px 12px',+ fontSize: '10px',+ fontWeight: 'bold',+ cursor: 'pointer',+ display: 'flex',+ alignItems: 'center',+ gap: '4px',+ borderRadius: '2px'+ }}+ >+ <RotateCcw size={12} />+ RESET+ </button>+ </div></div></div>- {/* Main Content - Responsive 3 Panel Layout */}+ {/* Info Bar */}<div style={{- flex: 1,- overflow: 'auto',- padding: '12px',- display: 'flex',- flexDirection: 'column'+ backgroundColor: BLOOMBERG_PANEL_BG,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 12px',+ fontSize: '10px',+ color: BLOOMBERG_GRAY,+ flexShrink: 0}}>- <div style={{- display: 'flex',- flexWrap: 'wrap',- gap: '12px',- justifyContent: 'center'- }}>- {createLeftPanel()}- {createCenterPanel()}- {createRightPanel()}+ <div style={{ display: 'flex', gap: '16px' }}>+ <span>💡 <span style={{ color: BLOOMBERG_WHITE }}>Drag widgets to rearrange</span></span>+ <span>🔧 <span style={{ color: BLOOMBERG_WHITE }}>Resize from bottom-right corner</span></span>+ <span>✖️ <span style={{ color: BLOOMBERG_WHITE }}>Remove widgets with X button</span></span>+ <span>📐 <span style={{ color: BLOOMBERG_WHITE }}>Responsive layout - uses full width</span></span></div></div>- {/* Status Bar - Responsive */}+ {/* Main Content - Grid Layout */}+ <div+ ref={containerRef}+ style={{+ flex: 1,+ overflow: 'auto',+ padding: '8px',+ backgroundColor: '#050505'+ }}+ >+ {widgets.length === 0 ? (+ <div style={{+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'center',+ justifyContent: 'center',+ height: '100%',+ gap: '16px'+ }}>+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '14px' }}>+ No widgets on dashboard+ </div>+ <button+ onClick={() => setShowAddModal(true)}+ style={{+ background: BLOOMBERG_ORANGE,+ color: 'black',+ border: 'none',+ padding: '12px 24px',+ fontSize: '12px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '4px'+ }}+ >+ ADD YOUR FIRST WIDGET+ </button>+ </div>+ ) : (+ <GridLayout+ className="layout"+ layout={widgets.map(w => w.layout)}+ cols={12}+ rowHeight={60}+ width={containerWidth - 16}+ onLayoutChange={handleLayoutChange}+ draggableHandle=".drag-handle"+ isDraggable={true}+ isResizable={true}+ compactType="vertical"+ preventCollision={false}+ >+ {widgets.map(widget => (+ <div key={widget.id} className="drag-handle">+ {renderWidget(widget)}+ </div>+ ))}+ </GridLayout>+ )}+ </div>++ {/* Status Bar */}<div style={{borderTop: `1px solid ${BLOOMBERG_GRAY}`,backgroundColor: BLOOMBERG_PANEL_BG,- padding: '6px 12px',- fontSize: '10px',+ padding: '4px 12px',+ fontSize: '9px',color: BLOOMBERG_GRAY,flexShrink: 0}}>- <div style={{- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center',- flexWrap: 'wrap',- gap: '8px'- }}>- <span>Bloomberg Professional Service | Real-time financial data</span>- <span style={{ whiteSpace: 'nowrap' }}>Session: {currentTime.toTimeString().substring(0, 8)}</span>+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>+ <span>Fincept Customizable Dashboard v2.0.0 | Drag & drop workspace</span>+ <span>+ Widgets: {widgets.length} | Layout: {widgets.length > 0 ? 'Custom' : 'Empty'} |+ Status: <span style={{ color: BLOOMBERG_GREEN }}>ACTIVE</span>+ </span></div></div>++ {/* Add Widget Modal */}+ <AddWidgetModal+ isOpen={showAddModal}+ onClose={() => setShowAddModal(false)}+ onAdd={handleAddWidget}+ /></div>);};-export default DashboardTab;\ No newline at end of file+export default DashboardTab;diff --git a/fincept-terminal-desktop/src/components/tabs/NewsTab.tsx b/fincept-terminal-desktop/src/components/tabs/NewsTab.tsxindex 24f8f3391..cd1121f94 100644--- a/fincept-terminal-desktop/src/components/tabs/NewsTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/NewsTab.tsx@@ -9,6 +9,8 @@ const NewsTab: React.FC = () => {const [newsArticles, setNewsArticles] = useState<NewsArticle[]>([]);const [loading, setLoading] = useState(true);const [activeSources, setActiveSources] = useState<string[]>([]);+ const [selectedArticle, setSelectedArticle] = useState<NewsArticle | null>(null);+ const [showWebView, setShowWebView] = useState(false);// Professional Financial Terminal Colorsconst TERMINAL_ORANGE = '#FFA500';@@ -23,6 +25,24 @@ const NewsTab: React.FC = () => {const TERMINAL_DARK_BG = '#000000';const TERMINAL_PANEL_BG = '#0a0a0a';+ // Manual refresh function with force refresh+ const handleRefresh = async () => {+ setLoading(true);+ try {+ // Force refresh to bypass cache+ const articles = await fetchNewsWithCache(true);+ setNewsArticles(articles);+ setAlertCount(articles.filter(a => a.priority === 'FLASH' || a.priority === 'URGENT').length);+ setActiveSources(getActiveSources());+ setNewsUpdateCount(prev => prev + 1);+ setTickerIndex(0); // Reset ticker to first article+ } catch (error) {+ console.error('Error fetching news:', error);+ } finally {+ setLoading(false);+ }+ };+// Fetch real news on mount and every 5 minutesuseEffect(() => {const loadNews = async () => {@@ -55,10 +75,23 @@ const NewsTab: React.FC = () => {return () => clearInterval(timer);}, []);- // Generate news ticker from articles- const newsTickerText = newsArticles.slice(0, 15).map(a =>- `🔴 ${a.headline.toUpperCase().slice(0, 100)}`- ).join(' • ') || 'Loading news feeds...';+ // Generate continuous ticker text with all news items+ const generateContinuousTickerText = () => {+ if (newsArticles.length === 0) {+ return 'Loading news feeds...';+ }++ // Create a long string of all news items+ return newsArticles.map(article =>+ `🔴 ${article.priority} | ${article.source} | ${article.headline.toUpperCase()} `+ ).join('');+ };++ const newsTickerText = generateContinuousTickerText();++ // Calculate animation duration based on content length (more content = slower speed)+ // Base: 1600 seconds for 1000 characters, scale proportionally+ const tickerDuration = Math.max(1200, Math.min(4800, (newsTickerText.length / 1000) * 1600));const getPriorityColor = (priority: string) => {switch (priority) {@@ -133,24 +166,46 @@ const NewsTab: React.FC = () => {<span style={{ color: TERMINAL_GREEN }}>● {getRSSFeedCount()} SOURCES</span><span style={{ color: TERMINAL_WHITE }}>|</span><span style={{ color: TERMINAL_WHITE }}>{currentTime.toISOString().replace('T', ' ').substring(0, 19)} UTC</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <button+ onClick={handleRefresh}+ disabled={loading}+ style={{+ backgroundColor: loading ? TERMINAL_GRAY : TERMINAL_GREEN,+ color: TERMINAL_DARK_BG,+ border: 'none',+ padding: '2px 8px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: loading ? 'not-allowed' : 'pointer',+ borderRadius: '2px',+ display: 'flex',+ alignItems: 'center',+ gap: '4px'+ }}+ title="Refresh news feeds"+ >+ 🔄 {loading ? 'UPDATING...' : 'REFRESH'}+ </button></div>- {/* News Ticker */}+ {/* News Ticker - Continuous seamless scroll like Bloomberg */}<div style={{ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '11px', marginBottom: '2px' }}><span style={{ color: TERMINAL_YELLOW, fontWeight: 'bold' }}>BREAKING:</span>- <div style={{+ <div className="ticker-wrap" style={{flex: 1,overflow: 'hidden',- whiteSpace: 'nowrap'+ position: 'relative',+ height: '20px'}}>- <div style={{- display: 'inline-block',- animation: 'scroll-left 90s linear infinite',- color: TERMINAL_WHITE- }}>- {newsTickerText}+ <div className="ticker-move">+ <span className="ticker-item">{newsTickerText}</span>+ <span className="ticker-item">{newsTickerText}</span></div></div>+ <span style={{ color: TERMINAL_GREEN, fontSize: '9px' }}>+ ● LIVE+ </span></div>{/* Sources and Stats */}@@ -261,7 +316,7 @@ const NewsTab: React.FC = () => {backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',cursor: article.link ? 'pointer' : 'default'}}- onClick={() => article.link && window.open(article.link, '_blank')}+ onClick={() => setSelectedArticle(article)}><div style={{ display: 'flex', gap: '4px', marginBottom: '1px', fontSize: '8px' }}><span style={{ color: TERMINAL_GRAY, minWidth: '50px' }}>{article.time}</span>@@ -310,7 +365,7 @@ const NewsTab: React.FC = () => {backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',cursor: article.link ? 'pointer' : 'default'}}- onClick={() => article.link && window.open(article.link, '_blank')}+ onClick={() => setSelectedArticle(article)}><div style={{ display: 'flex', gap: '4px', marginBottom: '1px', fontSize: '8px' }}><span style={{ color: TERMINAL_GRAY, minWidth: '50px' }}>{article.time}</span>@@ -421,7 +476,7 @@ const NewsTab: React.FC = () => {backgroundColor: index % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',cursor: article.link ? 'pointer' : 'default'}}- onClick={() => article.link && window.open(article.link, '_blank')}+ onClick={() => setSelectedArticle(article)}><div style={{ display: 'flex', gap: '4px', marginBottom: '1px', fontSize: '8px' }}><span style={{ color: TERMINAL_GRAY, minWidth: '50px' }}>{article.time}</span>@@ -474,12 +529,461 @@ const NewsTab: React.FC = () => {</div></div>+ {/* Article Detail Modal */}+ {selectedArticle && (+ <div style={{+ position: 'fixed',+ top: 0,+ left: 0,+ right: 0,+ bottom: 0,+ backgroundColor: 'rgba(0, 0, 0, 0.8)',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ zIndex: 9999+ }}+ onClick={() => setSelectedArticle(null)}+ >+ <div style={{+ backgroundColor: TERMINAL_PANEL_BG,+ border: `2px solid ${TERMINAL_ORANGE}`,+ borderRadius: '4px',+ width: showWebView ? '90vw' : '600px',+ maxWidth: '95vw',+ height: showWebView ? '90vh' : 'auto',+ maxHeight: '90vh',+ display: 'flex',+ flexDirection: 'column',+ overflow: 'hidden',+ boxShadow: `0 0 20px ${TERMINAL_ORANGE}`,+ transition: 'all 0.3s ease'+ }}+ onClick={(e) => e.stopPropagation()}+ >+ {/* Modal Header */}+ <div style={{+ backgroundColor: TERMINAL_DARK_BG,+ borderBottom: `2px solid ${TERMINAL_ORANGE}`,+ padding: '8px 12px',+ display: 'flex',+ justifyContent: 'space-between',+ alignItems: 'center',+ flexShrink: 0+ }}>+ <div style={{ display: 'flex', gap: '8px', alignItems: 'center', fontSize: '11px' }}>+ <span style={{ color: TERMINAL_ORANGE, fontWeight: 'bold' }}>ARTICLE DETAILS</span>+ <span style={{ color: TERMINAL_WHITE }}>|</span>+ <span style={{ color: getPriorityColor(selectedArticle.priority), fontWeight: 'bold' }}>+ [{selectedArticle.priority}]+ </span>+ <span style={{ color: TERMINAL_BLUE }}>[{selectedArticle.category}]</span>+ </div>+ <button+ onClick={() => {+ setSelectedArticle(null);+ setShowWebView(false);+ }}+ style={{+ backgroundColor: TERMINAL_RED,+ color: TERMINAL_WHITE,+ border: 'none',+ padding: '4px 8px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px'+ }}+ >+ ✕ CLOSE+ </button>+ </div>++ {/* Modal Content */}+ <div style={{+ padding: showWebView ? '0' : '12px',+ overflow: 'auto',+ flex: 1,+ display: 'flex',+ flexDirection: 'column'+ }}>+ {/* Reader View */}+ {showWebView && selectedArticle.link ? (+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>+ {/* Reader View Header */}+ <div style={{+ backgroundColor: TERMINAL_DARK_BG,+ padding: '8px',+ borderBottom: `1px solid ${TERMINAL_GRAY}`,+ display: 'flex',+ alignItems: 'center',+ gap: '8px',+ fontSize: '10px'+ }}>+ <button+ onClick={() => setShowWebView(false)}+ style={{+ backgroundColor: TERMINAL_ORANGE,+ color: TERMINAL_DARK_BG,+ border: 'none',+ padding: '4px 8px',+ fontSize: '10px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px'+ }}+ >+ ← BACK TO SUMMARY+ </button>+ <span style={{ color: TERMINAL_GRAY }}>|</span>+ <span style={{ color: TERMINAL_YELLOW, fontWeight: 'bold' }}>READER VIEW</span>+ <span style={{ color: TERMINAL_GRAY }}>|</span>+ <span style={{ color: TERMINAL_WHITE, flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {selectedArticle.source}+ </span>+ <button+ onClick={async () => {+ if (window.__TAURI__) {+ const { openUrl } = await import('@tauri-apps/plugin-opener');+ await openUrl(selectedArticle.link!);+ } else {+ window.open(selectedArticle.link, '_blank');+ }+ }}+ style={{+ backgroundColor: TERMINAL_BLUE,+ color: TERMINAL_WHITE,+ border: 'none',+ padding: '4px 8px',+ fontSize: '10px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px'+ }}+ >+ 🔗 OPEN FULL ARTICLE+ </button>+ </div>++ {/* Reader View Content */}+ <div style={{+ flex: 1,+ overflow: 'auto',+ padding: '24px',+ backgroundColor: '#1a1a1a',+ color: '#e0e0e0'+ }}>+ {/* Article Header */}+ <div style={{+ marginBottom: '24px',+ paddingBottom: '16px',+ borderBottom: `2px solid ${TERMINAL_ORANGE}`+ }}>+ <div style={{+ display: 'flex',+ gap: '8px',+ marginBottom: '12px',+ fontSize: '11px'+ }}>+ <span style={{+ backgroundColor: getPriorityColor(selectedArticle.priority),+ color: TERMINAL_DARK_BG,+ padding: '2px 8px',+ borderRadius: '2px',+ fontWeight: 'bold'+ }}>+ {selectedArticle.priority}+ </span>+ <span style={{+ backgroundColor: TERMINAL_BLUE,+ color: TERMINAL_WHITE,+ padding: '2px 8px',+ borderRadius: '2px',+ fontWeight: 'bold'+ }}>+ {selectedArticle.category}+ </span>+ <span style={{+ backgroundColor: getSentimentColor(selectedArticle.sentiment),+ color: TERMINAL_DARK_BG,+ padding: '2px 8px',+ borderRadius: '2px',+ fontWeight: 'bold'+ }}>+ {selectedArticle.sentiment}+ </span>+ </div>++ <h1 style={{+ fontSize: '24px',+ fontWeight: 'bold',+ lineHeight: '1.3',+ marginBottom: '12px',+ color: TERMINAL_WHITE+ }}>+ {selectedArticle.headline}+ </h1>++ <div style={{+ display: 'flex',+ gap: '16px',+ fontSize: '12px',+ color: TERMINAL_GRAY+ }}>+ <span>📰 {selectedArticle.source}</span>+ <span>🕒 {selectedArticle.time}</span>+ <span>🌍 {selectedArticle.region}</span>+ {selectedArticle.tickers && selectedArticle.tickers.length > 0 && (+ <span>📊 {selectedArticle.tickers.join(', ')}</span>+ )}+ </div>+ </div>++ {/* Article Content */}+ <div style={{+ fontSize: '16px',+ lineHeight: '1.8',+ color: '#d0d0d0',+ maxWidth: '800px',+ margin: '0 auto'+ }}>+ <p style={{ marginBottom: '16px', fontSize: '18px', fontWeight: '500', color: '#e0e0e0' }}>+ {selectedArticle.summary}+ </p>++ <div style={{+ backgroundColor: 'rgba(255, 165, 0, 0.1)',+ border: `1px solid ${TERMINAL_ORANGE}`,+ borderRadius: '4px',+ padding: '16px',+ marginTop: '24px'+ }}>+ <p style={{ fontSize: '14px', color: TERMINAL_YELLOW, marginBottom: '8px', fontWeight: 'bold' }}>+ ℹ️ Reader View Limitation+ </p>+ <p style={{ fontSize: '13px', lineHeight: '1.6', color: TERMINAL_GRAY, marginBottom: '12px' }}>+ Most news websites block embedding for security reasons. This reader view shows the article summary from the RSS feed.+ </p>+ <p style={{ fontSize: '13px', lineHeight: '1.6', color: TERMINAL_GRAY }}>+ For the complete article with images, videos, and full content, please click the "🔗 OPEN FULL ARTICLE" button above to view it in your browser.+ </p>+ </div>+ </div>+ </div>+ </div>+ ) : (+ <>+ {/* Article Metadata */}+ <div style={{+ display: 'grid',+ gridTemplateColumns: '1fr 1fr',+ gap: '8px',+ marginBottom: '12px',+ padding: '8px',+ backgroundColor: 'rgba(255, 165, 0, 0.05)',+ border: `1px solid ${TERMINAL_GRAY}`,+ fontSize: '10px'+ }}>+ <div>+ <span style={{ color: TERMINAL_GRAY }}>SOURCE: </span>+ <span style={{ color: TERMINAL_CYAN, fontWeight: 'bold' }}>{selectedArticle.source}</span>+ </div>+ <div>+ <span style={{ color: TERMINAL_GRAY }}>TIME: </span>+ <span style={{ color: TERMINAL_WHITE }}>{selectedArticle.time}</span>+ </div>+ <div>+ <span style={{ color: TERMINAL_GRAY }}>REGION: </span>+ <span style={{ color: TERMINAL_PURPLE }}>{selectedArticle.region}</span>+ </div>+ <div>+ <span style={{ color: TERMINAL_GRAY }}>SENTIMENT: </span>+ <span style={{ color: getSentimentColor(selectedArticle.sentiment), fontWeight: 'bold' }}>+ {selectedArticle.sentiment}+ </span>+ </div>+ <div>+ <span style={{ color: TERMINAL_GRAY }}>IMPACT: </span>+ <span style={{ color: getImpactColor(selectedArticle.impact), fontWeight: 'bold' }}>+ {selectedArticle.impact}+ </span>+ </div>+ {selectedArticle.tickers && selectedArticle.tickers.length > 0 && (+ <div>+ <span style={{ color: TERMINAL_GRAY }}>TICKERS: </span>+ <span style={{ color: TERMINAL_GREEN, fontWeight: 'bold' }}>+ {selectedArticle.tickers.join(', ')}+ </span>+ </div>+ )}+ </div>++ {/* Article Headline */}+ <div style={{+ color: TERMINAL_WHITE,+ fontSize: '14px',+ fontWeight: 'bold',+ lineHeight: '1.4',+ marginBottom: '12px',+ padding: '8px',+ backgroundColor: 'rgba(255, 255, 255, 0.05)',+ borderLeft: `4px solid ${getPriorityColor(selectedArticle.priority)}`+ }}>+ {selectedArticle.headline}+ </div>++ {/* Article Summary */}+ <div style={{+ color: TERMINAL_GRAY,+ fontSize: '12px',+ lineHeight: '1.6',+ marginBottom: '16px'+ }}>+ {selectedArticle.summary}+ </div>++ {/* Action Buttons */}+ {selectedArticle.link && (+ <div style={{+ display: 'flex',+ gap: '8px',+ paddingTop: '12px',+ borderTop: `1px solid ${TERMINAL_GRAY}`+ }}>+ <button+ onClick={(e) => {+ e.stopPropagation();+ setShowWebView(true);+ }}+ style={{+ backgroundColor: TERMINAL_GREEN,+ color: TERMINAL_DARK_BG,+ border: 'none',+ padding: '6px 12px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px',+ flex: 1+ }}+ >+ 📖 READ IN APP+ </button>+ <button+ onClick={async (e) => {+ e.stopPropagation();+ const link = selectedArticle.link;+ console.log('📰 Opening link in external browser:', link);++ if (!link) {+ console.error('❌ No link available');+ return;+ }++ try {+ if (window.__TAURI__) {+ const { openUrl } = await import('@tauri-apps/plugin-opener');+ await openUrl(link);+ console.log('✅ Link opened via Tauri opener');+ } else {+ const a = document.createElement('a');+ a.href = link;+ a.target = '_blank';+ a.rel = 'noopener noreferrer';+ document.body.appendChild(a);+ a.click();+ document.body.removeChild(a);+ console.log('✅ Link opened via anchor element');+ }+ } catch (error) {+ console.error('❌ Failed to open link:', error);+ await navigator.clipboard.writeText(link);+ console.log('📋 Link copied to clipboard');+ }+ }}+ style={{+ backgroundColor: TERMINAL_BLUE,+ color: TERMINAL_WHITE,+ border: 'none',+ padding: '6px 12px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px',+ flex: 1+ }}+ >+ 🔗 OPEN IN BROWSER+ </button>+ <button+ onClick={(e) => {+ e.stopPropagation();+ const link = selectedArticle.link;+ if (link) {+ navigator.clipboard.writeText(link);+ console.log('Link copied to clipboard:', link);+ e.currentTarget.textContent = '✓ COPIED!';+ setTimeout(() => {+ e.currentTarget.textContent = '📋 COPY';+ }, 2000);+ }+ }}+ style={{+ backgroundColor: TERMINAL_GRAY,+ color: TERMINAL_WHITE,+ border: 'none',+ padding: '6px 12px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px'+ }}+ title="Copy link to clipboard"+ >+ 📋 COPY+ </button>+ </div>+ )}+ </>+ )}+ </div>+ </div>+ </div>+ )}+{/* CSS for animations and transparent scrollbars */}<style>{`- @keyframes scroll-left {- 0% { transform: translateX(100%); }- 100% { transform: translateX(-100%); }+ .ticker-wrap {+ width: 100%;+ overflow: hidden;+ background-color: transparent;+ padding: 0;+ }++ .ticker-move {+ display: inline-block;+ white-space: nowrap;+ animation: tickerScroll ${tickerDuration}s linear infinite;+ padding-right: 100%;+ }++ .ticker-item {+ display: inline-block;+ padding-right: 3em;+ color: ${TERMINAL_WHITE};+ font-size: 11px;+ white-space: nowrap;+ }++ @keyframes tickerScroll {+ 0% {+ transform: translateX(0);+ }+ 100% {+ transform: translateX(-50%);+ }}+@keyframes blink {0%, 50% { opacity: 1; }51%, 100% { opacity: 0.3; }diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsxnew file mode 100644index 000000000..c76dda56f--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsx@@ -0,0 +1,305 @@+import React, { useState, useEffect } from 'react';+import { X } from 'lucide-react';+import { WidgetType, DEFAULT_WIDGET_CONFIGS } from './widgets';+import { watchlistService } from '../../../services/watchlistService';++const BLOOMBERG_ORANGE = '#FFA500';+const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_DARK_BG = '#000000';+const BLOOMBERG_PANEL_BG = '#0a0a0a';++interface AddWidgetModalProps {+ isOpen: boolean;+ onClose: () => void;+ onAdd: (widgetType: WidgetType, config?: any) => void;+}++export const AddWidgetModal: React.FC<AddWidgetModalProps> = ({+ isOpen,+ onClose,+ onAdd+}) => {+ const [selectedType, setSelectedType] = useState<WidgetType>('news');+ const [watchlists, setWatchlists] = useState<any[]>([]);++ // Widget-specific configs+ const [newsCategory, setNewsCategory] = useState('ALL');+ const [marketCategory, setMarketCategory] = useState('Indices');+ const [selectedWatchlist, setSelectedWatchlist] = useState('');+ const [forumCategory, setForumCategory] = useState('Trending');++ useEffect(() => {+ if (isOpen && selectedType === 'watchlist') {+ loadWatchlists();+ }+ }, [isOpen, selectedType]);++ const loadWatchlists = async () => {+ try {+ await watchlistService.initialize();+ const wls = await watchlistService.getWatchlistsWithCounts();+ setWatchlists(wls);+ if (wls.length > 0) {+ setSelectedWatchlist(wls[0].id);+ }+ } catch (error) {+ console.error('Failed to load watchlists:', error);+ }+ };++ const handleAdd = () => {+ let config = {};++ switch (selectedType) {+ case 'news':+ config = { newsCategory, newsLimit: 5 };+ break;+ case 'market':+ const tickers = marketCategory === 'Indices'+ ? ['^GSPC', '^IXIC', '^DJI', '^RUT']+ : marketCategory === 'Tech'+ ? ['AAPL', 'MSFT', 'GOOGL', 'AMZN', 'NVDA']+ : ['GC=F', 'CL=F', 'SI=F'];+ config = { marketCategory, marketTickers: tickers };+ break;+ case 'watchlist':+ const wl = watchlists.find(w => w.id === selectedWatchlist);+ config = {+ watchlistId: selectedWatchlist,+ watchlistName: wl?.name || 'Watchlist'+ };+ break;+ case 'forum':+ config = { forumCategoryName: forumCategory, forumLimit: 5 };+ break;+ }++ onAdd(selectedType, config);+ onClose();+ };++ if (!isOpen) return null;++ return (+ <div style={{+ position: 'fixed',+ top: 0,+ left: 0,+ right: 0,+ bottom: 0,+ backgroundColor: 'rgba(0, 0, 0, 0.85)',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ zIndex: 1000+ }}>+ <div style={{+ backgroundColor: BLOOMBERG_PANEL_BG,+ border: `2px solid ${BLOOMBERG_ORANGE}`,+ borderRadius: '4px',+ width: '500px',+ maxHeight: '80vh',+ overflow: 'auto',+ boxShadow: `0 0 20px ${BLOOMBERG_ORANGE}`+ }}>+ {/* Header */}+ <div style={{+ backgroundColor: BLOOMBERG_DARK_BG,+ borderBottom: `2px solid ${BLOOMBERG_ORANGE}`,+ padding: '12px 16px',+ display: 'flex',+ justifyContent: 'space-between',+ alignItems: 'center'+ }}>+ <div style={{+ color: BLOOMBERG_ORANGE,+ fontSize: '14px',+ fontWeight: 'bold'+ }}>+ ADD WIDGET+ </div>+ <button+ onClick={onClose}+ style={{+ background: 'none',+ border: 'none',+ color: BLOOMBERG_GRAY,+ cursor: 'pointer',+ padding: '0',+ display: 'flex'+ }}+ >+ <X size={20} />+ </button>+ </div>++ {/* Content */}+ <div style={{ padding: '16px' }}>+ {/* Widget Type Selection */}+ <div style={{ marginBottom: '16px' }}>+ <div style={{ color: BLOOMBERG_WHITE, fontSize: '11px', marginBottom: '8px', fontWeight: 'bold' }}>+ WIDGET TYPE+ </div>+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '8px' }}>+ {(['news', 'market', 'watchlist', 'forum', 'crypto', 'commodities', 'indices', 'forex', 'maritime'] as WidgetType[]).map(type => (+ <button+ key={type}+ onClick={() => setSelectedType(type)}+ style={{+ backgroundColor: selectedType === type ? BLOOMBERG_ORANGE : BLOOMBERG_DARK_BG,+ color: selectedType === type ? BLOOMBERG_DARK_BG : BLOOMBERG_WHITE,+ border: `1px solid ${selectedType === type ? BLOOMBERG_ORANGE : BLOOMBERG_GRAY}`,+ padding: '8px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: 'pointer',+ textTransform: 'uppercase'+ }}+ >+ {type}+ </button>+ ))}+ </div>+ </div>++ {/* Widget Configuration */}+ <div style={{ marginBottom: '16px' }}>+ <div style={{ color: BLOOMBERG_WHITE, fontSize: '11px', marginBottom: '8px', fontWeight: 'bold' }}>+ CONFIGURATION+ </div>++ {/* News Config */}+ {selectedType === 'news' && (+ <select+ value={newsCategory}+ onChange={(e) => setNewsCategory(e.target.value)}+ style={{+ width: '100%',+ backgroundColor: BLOOMBERG_DARK_BG,+ border: `1px solid ${BLOOMBERG_GRAY}`,+ color: BLOOMBERG_WHITE,+ padding: '8px',+ fontSize: '11px'+ }}+ >+ <option value="ALL">All News</option>+ <option value="MARKETS">Markets</option>+ <option value="TECH">Technology</option>+ <option value="EARNINGS">Earnings</option>+ <option value="ECONOMIC">Economic</option>+ </select>+ )}++ {/* Market Config */}+ {selectedType === 'market' && (+ <select+ value={marketCategory}+ onChange={(e) => setMarketCategory(e.target.value)}+ style={{+ width: '100%',+ backgroundColor: BLOOMBERG_DARK_BG,+ border: `1px solid ${BLOOMBERG_GRAY}`,+ color: BLOOMBERG_WHITE,+ padding: '8px',+ fontSize: '11px'+ }}+ >+ <option value="Indices">Market Indices</option>+ <option value="Tech">Tech Stocks</option>+ <option value="Commodities">Commodities</option>+ </select>+ )}++ {/* Watchlist Config */}+ {selectedType === 'watchlist' && (+ watchlists.length > 0 ? (+ <select+ value={selectedWatchlist}+ onChange={(e) => setSelectedWatchlist(e.target.value)}+ style={{+ width: '100%',+ backgroundColor: BLOOMBERG_DARK_BG,+ border: `1px solid ${BLOOMBERG_GRAY}`,+ color: BLOOMBERG_WHITE,+ padding: '8px',+ fontSize: '11px'+ }}+ >+ {watchlists.map(wl => (+ <option key={wl.id} value={wl.id}>{wl.name}</option>+ ))}+ </select>+ ) : (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', padding: '8px' }}>+ No watchlists available. Create one in the Watchlist tab first.+ </div>+ )+ )}++ {/* Forum Config */}+ {selectedType === 'forum' && (+ <select+ value={forumCategory}+ onChange={(e) => setForumCategory(e.target.value)}+ style={{+ width: '100%',+ backgroundColor: BLOOMBERG_DARK_BG,+ border: `1px solid ${BLOOMBERG_GRAY}`,+ color: BLOOMBERG_WHITE,+ padding: '8px',+ fontSize: '11px'+ }}+ >+ <option value="Trending">Trending Posts</option>+ <option value="Recent">Recent Posts</option>+ </select>+ )}++ {/* Crypto, Commodities, Indices, Forex, Maritime - No Config */}+ {['crypto', 'commodities', 'indices', 'forex', 'maritime'].includes(selectedType) && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', padding: '8px', fontStyle: 'italic' }}>+ This widget shows live {selectedType === 'maritime' ? 'maritime intelligence' : selectedType} data with automatic updates. No configuration required.+ </div>+ )}+ </div>++ {/* Action Buttons */}+ <div style={{ display: 'flex', gap: '8px', justifyContent: 'flex-end' }}>+ <button+ onClick={onClose}+ style={{+ backgroundColor: BLOOMBERG_GRAY,+ color: BLOOMBERG_DARK_BG,+ border: 'none',+ padding: '8px 16px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: 'pointer',+ borderRadius: '2px'+ }}+ >+ CANCEL+ </button>+ <button+ onClick={handleAdd}+ disabled={selectedType === 'watchlist' && watchlists.length === 0}+ style={{+ backgroundColor: (selectedType === 'watchlist' && watchlists.length === 0) ? BLOOMBERG_GRAY : BLOOMBERG_ORANGE,+ color: BLOOMBERG_DARK_BG,+ border: 'none',+ padding: '8px 16px',+ fontSize: '11px',+ fontWeight: 'bold',+ cursor: (selectedType === 'watchlist' && watchlists.length === 0) ? 'not-allowed' : 'pointer',+ borderRadius: '2px'+ }}+ >+ ADD WIDGET+ </button>+ </div>+ </div>+ </div>+ </div>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/BaseWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/BaseWidget.tsxnew file mode 100644index 000000000..c65cbd2a3--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/BaseWidget.tsx@@ -0,0 +1,163 @@+import React from 'react';+import { X, RefreshCw, Settings } from 'lucide-react';++export interface BaseWidgetProps {+ id: string;+ title: string;+ onRemove?: () => void;+ onRefresh?: () => void;+ onConfigure?: () => void;+ children: React.ReactNode;+ isLoading?: boolean;+ error?: string | null;+ headerColor?: string;+}++const BLOOMBERG_ORANGE = '#FFA500';+const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_PANEL_BG = '#000000';++export const BaseWidget: React.FC<BaseWidgetProps> = ({+ title,+ onRemove,+ onRefresh,+ onConfigure,+ children,+ isLoading = false,+ error = null,+ headerColor = BLOOMBERG_ORANGE+}) => {+ return (+ <div style={{+ height: '100%',+ width: '100%',+ backgroundColor: BLOOMBERG_PANEL_BG,+ border: `1px solid ${BLOOMBERG_GRAY}`,+ display: 'flex',+ flexDirection: 'column',+ overflow: 'hidden'+ }}>+ {/* Widget Header */}+ <div style={{+ backgroundColor: '#1a1a1a',+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 8px',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'space-between',+ minHeight: '28px',+ flexShrink: 0+ }}>+ <div style={{+ color: headerColor,+ fontSize: '11px',+ fontWeight: 'bold',+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap'+ }}>+ {title}+ </div>+ <div style={{ display: 'flex', gap: '4px', flexShrink: 0 }}>+ {onConfigure && (+ <button+ onClick={onConfigure}+ style={{+ background: 'none',+ border: 'none',+ color: BLOOMBERG_GRAY,+ cursor: 'pointer',+ padding: '2px',+ display: 'flex',+ alignItems: 'center'+ }}+ onMouseEnter={(e) => e.currentTarget.style.color = BLOOMBERG_WHITE}+ onMouseLeave={(e) => e.currentTarget.style.color = BLOOMBERG_GRAY}+ title="Configure"+ >+ <Settings size={12} />+ </button>+ )}+ {onRefresh && (+ <button+ onClick={onRefresh}+ disabled={isLoading}+ style={{+ background: 'none',+ border: 'none',+ color: isLoading ? BLOOMBERG_GRAY : BLOOMBERG_WHITE,+ cursor: isLoading ? 'not-allowed' : 'pointer',+ padding: '2px',+ display: 'flex',+ alignItems: 'center'+ }}+ onMouseEnter={(e) => !isLoading && (e.currentTarget.style.color = headerColor)}+ onMouseLeave={(e) => !isLoading && (e.currentTarget.style.color = BLOOMBERG_WHITE)}+ title="Refresh"+ >+ <RefreshCw size={12} style={{ animation: isLoading ? 'spin 1s linear infinite' : 'none' }} />+ </button>+ )}+ {onRemove && (+ <button+ onClick={onRemove}+ style={{+ background: 'none',+ border: 'none',+ color: BLOOMBERG_GRAY,+ cursor: 'pointer',+ padding: '2px',+ display: 'flex',+ alignItems: 'center'+ }}+ onMouseEnter={(e) => e.currentTarget.style.color = BLOOMBERG_RED}+ onMouseLeave={(e) => e.currentTarget.style.color = BLOOMBERG_GRAY}+ title="Remove"+ >+ <X size={12} />+ </button>+ )}+ </div>+ </div>++ {/* Widget Content */}+ <div style={{+ flex: 1,+ overflow: 'auto',+ position: 'relative'+ }}>+ {error ? (+ <div style={{+ padding: '12px',+ color: BLOOMBERG_RED,+ fontSize: '10px',+ textAlign: 'center'+ }}>+ Error: {error}+ </div>+ ) : isLoading ? (+ <div style={{+ padding: '12px',+ color: BLOOMBERG_GRAY,+ fontSize: '10px',+ textAlign: 'center'+ }}>+ Loading...+ </div>+ ) : (+ children+ )}+ </div>++ {/* Global spin animation */}+ <style>{`+ @keyframes spin {+ from { transform: rotate(0deg); }+ to { transform: rotate(360deg); }+ }+ `}</style>+ </div>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/CommoditiesWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/CommoditiesWidget.tsxnew file mode 100644index 000000000..63e3c5f2f--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/CommoditiesWidget.tsx@@ -0,0 +1,120 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { marketDataService, QuoteData } from '../../../../services/marketDataService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_YELLOW = '#FFFF00';++interface CommoditiesWidgetProps {+ id: string;+ onRemove?: () => void;+}++const TOP_COMMODITIES = ['GC=F', 'SI=F', 'CL=F', 'NG=F', 'HG=F', 'ZC=F', 'ZS=F', 'ZW=F'];++const COMMODITY_NAMES: { [key: string]: string } = {+ 'GC=F': 'Gold',+ 'SI=F': 'Silver',+ 'CL=F': 'Crude Oil',+ 'NG=F': 'Nat Gas',+ 'HG=F': 'Copper',+ 'ZC=F': 'Corn',+ 'ZS=F': 'Soybeans',+ 'ZW=F': 'Wheat'+};++export const CommoditiesWidget: React.FC<CommoditiesWidgetProps> = ({ id, onRemove }) => {+ const [quotes, setQuotes] = useState<QuoteData[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadQuotes = async () => {+ setLoading(true);+ setError(null);+ try {+ const data = await marketDataService.getQuotes(TOP_COMMODITIES);+ setQuotes(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load commodities data');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadQuotes();+ const interval = setInterval(loadQuotes, 60000); // Refresh every minute+ return () => clearInterval(interval);+ }, []);++ const formatChange = (value: number) => value >= 0 ? `+${value.toFixed(2)}` : value.toFixed(2);+ const formatPercent = (value: number) => value >= 0 ? `+${value.toFixed(2)}%` : `${value.toFixed(2)}%`;++ return (+ <BaseWidget+ id={id}+ title="COMMODITIES"+ onRemove={onRemove}+ onRefresh={loadQuotes}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '4px' }}>+ <div style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ fontWeight: 'bold',+ color: BLOOMBERG_WHITE,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 0',+ marginBottom: '4px'+ }}>+ <div>COMMODITY</div>+ <div style={{ textAlign: 'right' }}>PRICE</div>+ <div style={{ textAlign: 'right' }}>CHG</div>+ <div style={{ textAlign: 'right' }}>%CHG</div>+ </div>+ {quotes.map((quote, index) => (+ <div+ key={index}+ style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ padding: '2px 0',+ borderBottom: `1px solid rgba(120,120,120,0.3)`+ }}+ >+ <div style={{ color: BLOOMBERG_YELLOW }}>{COMMODITY_NAMES[quote.symbol] || quote.symbol}</div>+ <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>+ ${quote.price.toFixed(2)}+ </div>+ <div style={{+ color: quote.change >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatChange(quote.change)}+ </div>+ <div style={{+ color: quote.change_percent >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatPercent(quote.change_percent)}+ </div>+ </div>+ ))}+ {quotes.length === 0 && !loading && !error && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', textAlign: 'center', padding: '12px' }}>+ No commodities data available+ </div>+ )}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/CryptoWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/CryptoWidget.tsxnew file mode 100644index 000000000..e7d37b96a--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/CryptoWidget.tsx@@ -0,0 +1,109 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { marketDataService, QuoteData } from '../../../../services/marketDataService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_CYAN = '#00FFFF';++interface CryptoWidgetProps {+ id: string;+ onRemove?: () => void;+}++const TOP_CRYPTOS = ['BTC-USD', 'ETH-USD', 'BNB-USD', 'XRP-USD', 'ADA-USD', 'DOGE-USD', 'SOL-USD', 'DOT-USD', 'MATIC-USD', 'LTC-USD'];++export const CryptoWidget: React.FC<CryptoWidgetProps> = ({ id, onRemove }) => {+ const [quotes, setQuotes] = useState<QuoteData[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadQuotes = async () => {+ setLoading(true);+ setError(null);+ try {+ const data = await marketDataService.getQuotes(TOP_CRYPTOS);+ setQuotes(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load crypto data');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadQuotes();+ const interval = setInterval(loadQuotes, 30000); // Refresh every 30 seconds+ return () => clearInterval(interval);+ }, []);++ const formatChange = (value: number) => value >= 0 ? `+${value.toFixed(2)}` : value.toFixed(2);+ const formatPercent = (value: number) => value >= 0 ? `+${value.toFixed(2)}%` : `${value.toFixed(2)}%`;++ return (+ <BaseWidget+ id={id}+ title="CRYPTOCURRENCY MARKETS"+ onRemove={onRemove}+ onRefresh={loadQuotes}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '4px' }}>+ <div style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ fontWeight: 'bold',+ color: BLOOMBERG_WHITE,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 0',+ marginBottom: '4px'+ }}>+ <div>SYMBOL</div>+ <div style={{ textAlign: 'right' }}>PRICE</div>+ <div style={{ textAlign: 'right' }}>CHG</div>+ <div style={{ textAlign: 'right' }}>%CHG</div>+ </div>+ {quotes.map((quote, index) => (+ <div+ key={index}+ style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ padding: '2px 0',+ borderBottom: `1px solid rgba(120,120,120,0.3)`+ }}+ >+ <div style={{ color: BLOOMBERG_CYAN }}>{quote.symbol.replace('-USD', '')}</div>+ <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>+ ${quote.price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}+ </div>+ <div style={{+ color: quote.change >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatChange(quote.change)}+ </div>+ <div style={{+ color: quote.change_percent >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatPercent(quote.change_percent)}+ </div>+ </div>+ ))}+ {quotes.length === 0 && !loading && !error && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', textAlign: 'center', padding: '12px' }}>+ No crypto data available+ </div>+ )}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/ForexWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/ForexWidget.tsxnew file mode 100644index 000000000..560f9d98b--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/ForexWidget.tsx@@ -0,0 +1,120 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { marketDataService, QuoteData } from '../../../../services/marketDataService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_PURPLE = '#C864FF';++interface ForexWidgetProps {+ id: string;+ onRemove?: () => void;+}++const MAJOR_FOREX_PAIRS = ['EURUSD=X', 'GBPUSD=X', 'USDJPY=X', 'AUDUSD=X', 'USDCAD=X', 'USDCHF=X', 'NZDUSD=X', 'EURC HF=X'];++const FOREX_NAMES: { [key: string]: string } = {+ 'EURUSD=X': 'EUR/USD',+ 'GBPUSD=X': 'GBP/USD',+ 'USDJPY=X': 'USD/JPY',+ 'AUDUSD=X': 'AUD/USD',+ 'USDCAD=X': 'USD/CAD',+ 'USDCHF=X': 'USD/CHF',+ 'NZDUSD=X': 'NZD/USD',+ 'EURCHF=X': 'EUR/CHF'+};++export const ForexWidget: React.FC<ForexWidgetProps> = ({ id, onRemove }) => {+ const [quotes, setQuotes] = useState<QuoteData[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadQuotes = async () => {+ setLoading(true);+ setError(null);+ try {+ const data = await marketDataService.getQuotes(MAJOR_FOREX_PAIRS);+ setQuotes(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load forex data');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadQuotes();+ const interval = setInterval(loadQuotes, 30000); // Refresh every 30 seconds+ return () => clearInterval(interval);+ }, []);++ const formatChange = (value: number) => value >= 0 ? `+${value.toFixed(4)}` : value.toFixed(4);+ const formatPercent = (value: number) => value >= 0 ? `+${value.toFixed(2)}%` : `${value.toFixed(2)}%`;++ return (+ <BaseWidget+ id={id}+ title="FOREX - MAJOR PAIRS"+ onRemove={onRemove}+ onRefresh={loadQuotes}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '4px' }}>+ <div style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ fontWeight: 'bold',+ color: BLOOMBERG_WHITE,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 0',+ marginBottom: '4px'+ }}>+ <div>PAIR</div>+ <div style={{ textAlign: 'right' }}>RATE</div>+ <div style={{ textAlign: 'right' }}>CHG</div>+ <div style={{ textAlign: 'right' }}>%CHG</div>+ </div>+ {quotes.map((quote, index) => (+ <div+ key={index}+ style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ padding: '2px 0',+ borderBottom: `1px solid rgba(120,120,120,0.3)`+ }}+ >+ <div style={{ color: BLOOMBERG_PURPLE }}>{FOREX_NAMES[quote.symbol] || quote.symbol}</div>+ <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>+ {quote.price.toFixed(4)}+ </div>+ <div style={{+ color: quote.change >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatChange(quote.change)}+ </div>+ <div style={{+ color: quote.change_percent >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatPercent(quote.change_percent)}+ </div>+ </div>+ ))}+ {quotes.length === 0 && !loading && !error && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', textAlign: 'center', padding: '12px' }}>+ No forex data available+ </div>+ )}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/ForumWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/ForumWidget.tsxnew file mode 100644index 000000000..ba13ec625--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/ForumWidget.tsx@@ -0,0 +1,118 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { ForumApiService } from '../../../../services/forumApi';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_BLUE = '#6496FA';+const BLOOMBERG_CYAN = '#00FFFF';+const BLOOMBERG_GREEN = '#00C800';++interface ForumPost {+ id: string;+ title: string;+ author: string;+ category: string;+ likes: number;+ replies: number;+ time: string;+}++interface ForumWidgetProps {+ id: string;+ categoryId?: number;+ categoryName?: string;+ limit?: number;+ onRemove?: () => void;+}++export const ForumWidget: React.FC<ForumWidgetProps> = ({+ id,+ categoryId,+ categoryName = 'Recent Posts',+ limit = 5,+ onRemove+}) => {+ const [posts, setPosts] = useState<ForumPost[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadPosts = async () => {+ setLoading(true);+ setError(null);+ try {+ const response = categoryId+ ? await ForumApiService.getPostsByCategory(categoryId, 'latest', limit)+ : await ForumApiService.getTrendingPosts(limit, 'week');++ if (response.success) {+ // Handle both response formats+ const postsData = (response.data as any)?.data?.posts || (response.data as any)?.posts || [];+ const formattedPosts = postsData.map((post: any) => ({+ id: post.post_uuid,+ title: post.title,+ author: post.author_display_name || 'Anonymous',+ category: post.category_name || 'General',+ likes: post.likes || 0,+ replies: post.reply_count || 0,+ time: new Date(post.created_at).toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit' })+ }));+ setPosts(formattedPosts);+ } else {+ setError(response.error || 'Failed to load forum posts');+ }+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load forum posts');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadPosts();+ const interval = setInterval(loadPosts, 2 * 60 * 1000); // Refresh every 2 minutes+ return () => clearInterval(interval);+ }, [categoryId, limit]);++ return (+ <BaseWidget+ id={id}+ title={`FORUM - ${categoryName}`}+ onRemove={onRemove}+ onRefresh={loadPosts}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '8px' }}>+ {posts.map((post, index) => (+ <div+ key={post.id}+ style={{+ marginBottom: '8px',+ paddingBottom: '8px',+ borderBottom: index < posts.length - 1 ? `1px solid ${BLOOMBERG_GRAY}` : 'none'+ }}+ >+ <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px', fontWeight: 'bold', marginBottom: '2px', lineHeight: '1.2' }}>+ {post.title.substring(0, 60)}{post.title.length > 60 ? '...' : ''}+ </div>+ <div style={{ display: 'flex', gap: '8px', fontSize: '8px', color: BLOOMBERG_GRAY }}>+ <span style={{ color: BLOOMBERG_CYAN }}>@{post.author}</span>+ <span style={{ color: BLOOMBERG_BLUE }}>[{post.category}]</span>+ <span>{post.time}</span>+ </div>+ <div style={{ display: 'flex', gap: '8px', fontSize: '8px', color: BLOOMBERG_GRAY, marginTop: '2px' }}>+ <span style={{ color: BLOOMBERG_GREEN }}>👍 {post.likes}</span>+ <span>💬 {post.replies}</span>+ </div>+ </div>+ ))}+ {posts.length === 0 && !loading && !error && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', textAlign: 'center', padding: '12px' }}>+ No forum posts available+ </div>+ )}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/GlobalIndicesWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/GlobalIndicesWidget.tsxnew file mode 100644index 000000000..496a3def3--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/GlobalIndicesWidget.tsx@@ -0,0 +1,138 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { marketDataService, QuoteData } from '../../../../services/marketDataService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_CYAN = '#00FFFF';++interface GlobalIndicesWidgetProps {+ id: string;+ onRemove?: () => void;+}++// 12 Most Traded Global Indices+const TOP_12_INDICES = [+ '^GSPC', // S&P 500+ '^DJI', // Dow Jones+ '^IXIC', // NASDAQ+ '^RUT', // Russell 2000+ '^FTSE', // FTSE 100+ '^GDAXI', // DAX+ '^FCHI', // CAC 40+ '^N225', // Nikkei 225+ '^HSI', // Hang Seng+ '000001.SS', // Shanghai Composite+ '^BSESN', // BSE Sensex+ '^NSEI' // Nifty 50+];++const INDEX_NAMES: { [key: string]: string } = {+ '^GSPC': 'S&P 500',+ '^DJI': 'Dow Jones',+ '^IXIC': 'NASDAQ',+ '^RUT': 'Russell 2000',+ '^FTSE': 'FTSE 100',+ '^GDAXI': 'DAX',+ '^FCHI': 'CAC 40',+ '^N225': 'Nikkei 225',+ '^HSI': 'Hang Seng',+ '000001.SS': 'Shanghai',+ '^BSESN': 'Sensex',+ '^NSEI': 'Nifty 50'+};++export const GlobalIndicesWidget: React.FC<GlobalIndicesWidgetProps> = ({ id, onRemove }) => {+ const [quotes, setQuotes] = useState<QuoteData[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadQuotes = async () => {+ setLoading(true);+ setError(null);+ try {+ const data = await marketDataService.getQuotes(TOP_12_INDICES);+ setQuotes(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load indices data');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadQuotes();+ const interval = setInterval(loadQuotes, 60000); // Refresh every minute+ return () => clearInterval(interval);+ }, []);++ const formatChange = (value: number) => value >= 0 ? `+${value.toFixed(2)}` : value.toFixed(2);+ const formatPercent = (value: number) => value >= 0 ? `+${value.toFixed(2)}%` : `${value.toFixed(2)}%`;++ return (+ <BaseWidget+ id={id}+ title="GLOBAL INDICES - TOP 12"+ onRemove={onRemove}+ onRefresh={loadQuotes}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '4px' }}>+ <div style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ fontWeight: 'bold',+ color: BLOOMBERG_WHITE,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 0',+ marginBottom: '4px'+ }}>+ <div>INDEX</div>+ <div style={{ textAlign: 'right' }}>PRICE</div>+ <div style={{ textAlign: 'right' }}>CHG</div>+ <div style={{ textAlign: 'right' }}>%CHG</div>+ </div>+ {quotes.map((quote, index) => (+ <div+ key={index}+ style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ padding: '2px 0',+ borderBottom: `1px solid rgba(120,120,120,0.3)`+ }}+ >+ <div style={{ color: BLOOMBERG_CYAN }}>{INDEX_NAMES[quote.symbol] || quote.symbol}</div>+ <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>+ {quote.price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}+ </div>+ <div style={{+ color: quote.change >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatChange(quote.change)}+ </div>+ <div style={{+ color: quote.change_percent >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatPercent(quote.change_percent)}+ </div>+ </div>+ ))}+ {quotes.length === 0 && !loading && !error && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', textAlign: 'center', padding: '12px' }}>+ No indices data available+ </div>+ )}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/MaritimeWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/MaritimeWidget.tsxnew file mode 100644index 000000000..4dd747169--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/MaritimeWidget.tsx@@ -0,0 +1,326 @@+import React, { useState, useEffect, useRef } from 'react';+import { BaseWidget } from './BaseWidget';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_CYAN = '#00FFFF';+const BLOOMBERG_YELLOW = '#FFFF00';++interface TradeRoute {+ name: string;+ value: string;+ status: 'active' | 'delayed' | 'critical';+ vessels: number;+}++interface MaritimeWidgetProps {+ id: string;+ onRemove?: () => void;+ onNavigate?: () => void;+}++const TRADE_ROUTES: TradeRoute[] = [+ { name: 'Mumbai → Shanghai', value: '$156B', status: 'active', vessels: 89 },+ { name: 'Mumbai → Singapore', value: '$89B', status: 'active', vessels: 45 },+ { name: 'Mumbai → New York', value: '$123B', status: 'active', vessels: 56 },+ { name: 'Chennai → Tokyo', value: '$67B', status: 'delayed', vessels: 34 },+ { name: 'Mumbai → Dubai', value: '$78B', status: 'critical', vessels: 12 }+];++export const MaritimeWidget: React.FC<MaritimeWidgetProps> = ({ id, onRemove, onNavigate }) => {+ const [intelligence, setIntelligence] = useState({+ active_vessels: 1247,+ monitored_routes: 48,+ trade_volume: '$847.3B'+ });+ const mapRef = useRef<HTMLIFrameElement>(null);++ useEffect(() => {+ const interval = setInterval(() => {+ setIntelligence(prev => ({+ ...prev,+ active_vessels: prev.active_vessels + Math.floor(Math.random() * 10 - 5)+ }));+ }, 5000);+ return () => clearInterval(interval);+ }, []);++ const getStatusColor = (status: string) => {+ switch (status) {+ case 'critical': return BLOOMBERG_RED;+ case 'delayed': return BLOOMBERG_YELLOW;+ case 'active': return BLOOMBERG_GREEN;+ default: return BLOOMBERG_GRAY;+ }+ };++ // Compact globe HTML with animations+ const globeHTML = `+<!DOCTYPE html>+<html>+<head>+ <meta charset="utf-8" />+ <style>+ body { margin: 0; padding: 0; background: #000; overflow: hidden; }+ #globeViz { height: 100%; width: 100%; background: #000; cursor: pointer; }+ </style>+</head>+<body>+ <div id="globeViz"></div>+ <script src="https://unpkg.com/[email protected]/build/three.min.js"></script>+ <script src="https://unpkg.com/[email protected]/dist/globe.gl.min.js"></script>+ <script>+ setTimeout(() => {+ try {+ const world = Globe()+ (document.getElementById('globeViz'))+ .globeImageUrl('https://unpkg.com/[email protected]/example/img/earth-blue-marble.jpg')+ .bumpImageUrl('https://unpkg.com/[email protected]/example/img/earth-topology.png')+ .backgroundColor('#000000')+ .backgroundImageUrl('https://unpkg.com/three-globe/example/img/night-sky.png')+ .showAtmosphere(true)+ .atmosphereColor('#00ffff')+ .atmosphereAltitude(0.12)+ .width(window.innerWidth)+ .height(window.innerHeight);++ const scene = world.scene();+ const ambientLight = new THREE.AmbientLight(0x808080, 0.7);+ const directionalLight = new THREE.DirectionalLight(0xaaaaaa, 0.6);+ directionalLight.position.set(5, 3, 5);+ scene.add(ambientLight);+ scene.add(directionalLight);++ world.pointOfView({ lat: 20, lng: 75, altitude: 2.0 }, 1000);++ // Trade routes+ const oceanRoutes = [+ { start: {lat: 18.9388, lng: 72.8354}, end: {lat: 51.9553, lng: 4.1392}, color: 'rgba(100, 180, 255, 0.6)', width: 0.8 },+ { start: {lat: 18.9388, lng: 72.8354}, end: {lat: 31.3548, lng: 121.6431}, color: 'rgba(120, 200, 255, 0.7)', width: 1.2 },+ { start: {lat: 18.9388, lng: 72.8354}, end: {lat: 1.2644, lng: 103.8224}, color: 'rgba(100, 180, 255, 0.65)', width: 1.0 },+ { start: {lat: 13.0827, lng: 80.2707}, end: {lat: 35.4437, lng: 139.6380}, color: 'rgba(150, 220, 255, 0.6)', width: 0.9 },+ { start: {lat: 22.5726, lng: 88.3639}, end: {lat: 22.2855, lng: 114.1577}, color: 'rgba(100, 180, 255, 0.55)', width: 0.8 },+ { start: {lat: 18.9388, lng: 72.8354}, end: {lat: 24.9857, lng: 55.0272}, color: 'rgba(255, 160, 100, 0.6)', width: 0.9 },+ { start: {lat: 18.9388, lng: 72.8354}, end: {lat: 40.6655, lng: -74.0781}, color: 'rgba(120, 200, 255, 0.75)', width: 1.2 },+ { start: {lat: 13.0827, lng: 80.2707}, end: {lat: -33.9544, lng: 151.2093}, color: 'rgba(130, 190, 255, 0.6)', width: 0.9 }+ ];++ const arcsData = oceanRoutes.map(route => ({+ startLat: route.start.lat,+ startLng: route.start.lng,+ endLat: route.end.lat,+ endLng: route.end.lng,+ color: route.color,+ width: route.width+ }));++ world.arcsData(arcsData)+ .arcColor('color')+ .arcStroke('width')+ .arcDashLength(1.0)+ .arcDashGap(0)+ .arcAltitude(0.1)+ .arcAltitudeAutoScale(0.5);++ // Ports+ const ports = [+ {lat: 18.9388, lng: 72.8354}, {lat: 31.3548, lng: 121.6431}, {lat: 1.2644, lng: 103.8224},+ {lat: 51.9553, lng: 4.1392}, {lat: 24.9857, lng: 55.0272}, {lat: 40.6655, lng: -74.0781}+ ];++ world.pointsData(ports)+ .pointAltitude(0.002)+ .pointRadius(0.6)+ .pointColor(() => 'rgba(255, 180, 100, 0.85)');++ // Ships+ const shipData = oceanRoutes.map((route, idx) => ({+ routeIdx: idx,+ progress: Math.random(),+ startLat: route.start.lat,+ startLng: route.start.lng,+ endLat: route.end.lat,+ endLng: route.end.lng+ }));++ function updateShips() {+ const shipPoints = shipData.map(ship => {+ const lat = ship.startLat + (ship.endLat - ship.startLat) * ship.progress;+ const lng = ship.startLng + (ship.endLng - ship.startLng) * ship.progress;+ return { lat, lng, size: 0.15, color: 'rgba(255, 255, 255, 0.95)', altitude: 0.003 };+ });+ world.customLayerData(shipPoints)+ .customThreeObject(() => {+ const geometry = new THREE.TetrahedronGeometry(0.7);+ const material = new THREE.MeshBasicMaterial({ color: 0x00ccff, transparent: true, opacity: 0.9 });+ return new THREE.Mesh(geometry, material);+ })+ .customThreeObjectUpdate((obj, d) => {+ Object.assign(obj.position, world.getCoords(d.lat, d.lng, d.altitude));+ });+ }++ updateShips();++ setInterval(() => {+ shipData.forEach(ship => {+ ship.progress = (ship.progress + 0.0002) % 1.0;+ });+ updateShips();+ }, 200);++ // Auto-rotate+ world.controls().autoRotate = true;+ world.controls().autoRotateSpeed = 0.3;+ world.controls().enableDamping = true;+ world.controls().dampingFactor = 0.05;++ // Click to notify parent+ document.getElementById('globeViz').addEventListener('click', () => {+ window.parent.postMessage('navigate-to-maritime', '*');+ });++ window.addEventListener('resize', () => {+ world.width(window.innerWidth).height(window.innerHeight);+ });+ } catch (error) {+ console.error('Globe error:', error);+ }+ }, 500);+ </script>+</body>+</html>+ `;++ // Listen for navigation message from iframe+ useEffect(() => {+ const handleMessage = (event: MessageEvent) => {+ if (event.data === 'navigate-to-maritime' && onNavigate) {+ onNavigate();+ }+ };+ window.addEventListener('message', handleMessage);+ return () => window.removeEventListener('message', handleMessage);+ }, [onNavigate]);++ return (+ <BaseWidget+ id={id}+ title="⚓ MARITIME INTELLIGENCE"+ onRemove={onRemove}+ headerColor={BLOOMBERG_CYAN}+ >+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>+ {/* 3D Globe Section - Top 60% */}+ <div+ style={{+ flex: '0 0 60%',+ position: 'relative',+ overflow: 'hidden',+ cursor: 'pointer',+ borderBottom: `2px solid ${BLOOMBERG_CYAN}`+ }}+ title="Click to open full Maritime Intelligence view"+ >+ <iframe+ ref={mapRef}+ srcDoc={globeHTML}+ style={{+ width: '100%',+ height: '100%',+ border: 'none',+ background: '#000'+ }}+ />+ <div style={{+ position: 'absolute',+ top: '4px',+ right: '4px',+ background: 'rgba(0, 255, 255, 0.9)',+ color: '#000',+ padding: '2px 6px',+ fontSize: '7px',+ fontWeight: 'bold',+ borderRadius: '2px'+ }}>+ 3D GLOBE+ </div>+ </div>++ {/* Trade Data Section - Bottom 40% */}+ <div style={{ flex: '0 0 40%', padding: '6px', fontSize: '8px', overflowY: 'auto' }}>+ {/* Intelligence Stats */}+ <div style={{+ display: 'grid',+ gridTemplateColumns: 'repeat(3, 1fr)',+ gap: '4px',+ marginBottom: '6px',+ paddingBottom: '4px',+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`+ }}>+ <div style={{ textAlign: 'center' }}>+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '6px' }}>VESSELS</div>+ <div style={{ color: BLOOMBERG_CYAN, fontWeight: 'bold', fontSize: '10px' }}>+ {intelligence.active_vessels}+ </div>+ </div>+ <div style={{ textAlign: 'center' }}>+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '6px' }}>ROUTES</div>+ <div style={{ color: BLOOMBERG_CYAN, fontWeight: 'bold', fontSize: '10px' }}>+ {intelligence.monitored_routes}+ </div>+ </div>+ <div style={{ textAlign: 'center' }}>+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '6px' }}>VOL 24H</div>+ <div style={{ color: BLOOMBERG_GREEN, fontWeight: 'bold', fontSize: '10px' }}>+ {intelligence.trade_volume}+ </div>+ </div>+ </div>++ {/* Top Trade Routes */}+ <div style={{ color: BLOOMBERG_CYAN, fontSize: '7px', fontWeight: 'bold', marginBottom: '3px' }}>+ TOP TRADE CORRIDORS+ </div>+ {TRADE_ROUTES.map((route, idx) => (+ <div+ key={idx}+ style={{+ background: idx % 2 === 0 ? 'rgba(255,255,255,0.02)' : 'transparent',+ padding: '3px',+ marginBottom: '2px',+ borderLeft: `2px solid ${getStatusColor(route.status)}`,+ paddingLeft: '4px'+ }}+ >+ <div style={{+ display: 'flex',+ justifyContent: 'space-between',+ alignItems: 'center',+ marginBottom: '1px'+ }}>+ <span style={{ color: BLOOMBERG_WHITE, fontSize: '7px', fontWeight: 'bold' }}>+ {route.name}+ </span>+ <span style={{+ color: getStatusColor(route.status),+ fontSize: '5px',+ padding: '1px 2px',+ border: `1px solid ${getStatusColor(route.status)}`+ }}>+ {route.status.toUpperCase()}+ </span>+ </div>+ <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: '6px' }}>+ <span style={{ color: BLOOMBERG_GRAY }}>{route.value}</span>+ <span style={{ color: BLOOMBERG_CYAN }}>{route.vessels} ships</span>+ </div>+ </div>+ ))}+ </div>+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/MarketDataWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/MarketDataWidget.tsxnew file mode 100644index 000000000..1ad5b7181--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/MarketDataWidget.tsx@@ -0,0 +1,106 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { marketDataService, QuoteData } from '../../../../services/marketDataService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';++interface MarketDataWidgetProps {+ id: string;+ category?: string;+ tickers?: string[];+ onRemove?: () => void;+}++export const MarketDataWidget: React.FC<MarketDataWidgetProps> = ({+ id,+ category = 'Indices',+ tickers = ['^GSPC', '^IXIC', '^DJI', '^RUT'],+ onRemove+}) => {+ const [quotes, setQuotes] = useState<QuoteData[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadQuotes = async () => {+ setLoading(true);+ setError(null);+ try {+ const data = await marketDataService.getQuotes(tickers);+ setQuotes(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load market data');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadQuotes();+ const interval = setInterval(loadQuotes, 60000); // Refresh every minute+ return () => clearInterval(interval);+ }, [tickers.join(',')]);++ const formatChange = (value: number) => value >= 0 ? `+${value.toFixed(2)}` : value.toFixed(2);+ const formatPercent = (value: number) => value >= 0 ? `+${value.toFixed(2)}%` : `${value.toFixed(2)}%`;++ return (+ <BaseWidget+ id={id}+ title={`MARKETS - ${category}`}+ onRemove={onRemove}+ onRefresh={loadQuotes}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '4px' }}>+ <div style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ fontWeight: 'bold',+ color: BLOOMBERG_WHITE,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 0',+ marginBottom: '4px'+ }}>+ <div>SYMBOL</div>+ <div style={{ textAlign: 'right' }}>PRICE</div>+ <div style={{ textAlign: 'right' }}>CHG</div>+ <div style={{ textAlign: 'right' }}>%CHG</div>+ </div>+ {quotes.map((quote, index) => (+ <div+ key={index}+ style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ padding: '2px 0',+ borderBottom: `1px solid rgba(120,120,120,0.3)`+ }}+ >+ <div style={{ color: BLOOMBERG_WHITE }}>{quote.symbol}</div>+ <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>{quote.price.toFixed(2)}</div>+ <div style={{+ color: quote.change >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatChange(quote.change)}+ </div>+ <div style={{+ color: quote.change_percent >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {formatPercent(quote.change_percent)}+ </div>+ </div>+ ))}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/NewsWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/NewsWidget.tsxnew file mode 100644index 000000000..ae70f72c3--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/NewsWidget.tsx@@ -0,0 +1,100 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { fetchNewsWithCache, NewsArticle } from '../../../../services/newsService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_YELLOW = '#FFFF00';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_BLUE = '#6496FA';++interface NewsWidgetProps {+ id: string;+ category?: string;+ limit?: number;+ onRemove?: () => void;+}++export const NewsWidget: React.FC<NewsWidgetProps> = ({+ id,+ category = 'ALL',+ limit = 5,+ onRemove+}) => {+ const [news, setNews] = useState<NewsArticle[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadNews = async () => {+ setLoading(true);+ setError(null);+ try {+ const articles = await fetchNewsWithCache();+ const filtered = category === 'ALL'+ ? articles+ : articles.filter(a => a.category === category);+ setNews(filtered.slice(0, limit));+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load news');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadNews();+ const interval = setInterval(loadNews, 5 * 60 * 1000); // Refresh every 5 minutes+ return () => clearInterval(interval);+ }, [category, limit]);++ const getPriorityColor = (priority: string) => {+ switch (priority) {+ case 'FLASH': return BLOOMBERG_RED;+ case 'URGENT': return '#FFA500';+ case 'BREAKING': return BLOOMBERG_YELLOW;+ default: return BLOOMBERG_GREEN;+ }+ };++ return (+ <BaseWidget+ id={id}+ title={`NEWS - ${category}`}+ onRemove={onRemove}+ onRefresh={loadNews}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '8px' }}>+ {news.map((article, index) => (+ <div+ key={article.id}+ style={{+ marginBottom: '8px',+ paddingBottom: '8px',+ borderBottom: index < news.length - 1 ? `1px solid ${BLOOMBERG_GRAY}` : 'none'+ }}+ >+ <div style={{ display: 'flex', gap: '4px', marginBottom: '2px', fontSize: '8px' }}>+ <span style={{ color: getPriorityColor(article.priority), fontWeight: 'bold' }}>+ [{article.priority}]+ </span>+ <span style={{ color: BLOOMBERG_BLUE }}>[{article.category}]</span>+ <span style={{ color: BLOOMBERG_GRAY }}>{article.time}</span>+ </div>+ <div style={{ color: BLOOMBERG_WHITE, fontSize: '10px', fontWeight: 'bold', marginBottom: '2px', lineHeight: '1.2' }}>+ {article.headline}+ </div>+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '9px', lineHeight: '1.2' }}>+ {article.summary.substring(0, 100)}...+ </div>+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '8px', marginTop: '2px' }}>+ {article.source}+ </div>+ </div>+ ))}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/WatchlistWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/WatchlistWidget.tsxnew file mode 100644index 000000000..cf3a5fc29--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/WatchlistWidget.tsx@@ -0,0 +1,121 @@+import React, { useState, useEffect } from 'react';+import { BaseWidget } from './BaseWidget';+import { watchlistService, WatchlistStockWithQuote } from '../../../../services/watchlistService';++const BLOOMBERG_WHITE = '#FFFFFF';+const BLOOMBERG_GREEN = '#00C800';+const BLOOMBERG_RED = '#FF0000';+const BLOOMBERG_GRAY = '#787878';+const BLOOMBERG_CYAN = '#00FFFF';++interface WatchlistWidgetProps {+ id: string;+ watchlistId?: string;+ watchlistName?: string;+ onRemove?: () => void;+}++export const WatchlistWidget: React.FC<WatchlistWidgetProps> = ({+ id,+ watchlistId,+ watchlistName = 'Watchlist',+ onRemove+}) => {+ const [stocks, setStocks] = useState<WatchlistStockWithQuote[]>([]);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const loadStocks = async () => {+ if (!watchlistId) {+ setError('No watchlist selected');+ setLoading(false);+ return;+ }++ setLoading(true);+ setError(null);+ try {+ await watchlistService.initialize();+ const data = await watchlistService.getWatchlistStocksWithQuotes(watchlistId);+ setStocks(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : 'Failed to load watchlist');+ } finally {+ setLoading(false);+ }+ };++ useEffect(() => {+ loadStocks();+ const interval = setInterval(loadStocks, 60000); // Refresh every minute+ return () => clearInterval(interval);+ }, [watchlistId]);++ const formatChange = (value: number) => value >= 0 ? `+${value.toFixed(2)}` : value.toFixed(2);+ const formatPercent = (value: number) => value >= 0 ? `+${value.toFixed(2)}%` : `${value.toFixed(2)}%`;++ return (+ <BaseWidget+ id={id}+ title={`WATCHLIST - ${watchlistName}`}+ onRemove={onRemove}+ onRefresh={loadStocks}+ isLoading={loading}+ error={error}+ >+ <div style={{ padding: '4px' }}>+ <div style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ fontWeight: 'bold',+ color: BLOOMBERG_WHITE,+ borderBottom: `1px solid ${BLOOMBERG_GRAY}`,+ padding: '4px 0',+ marginBottom: '4px'+ }}>+ <div>SYMBOL</div>+ <div style={{ textAlign: 'right' }}>PRICE</div>+ <div style={{ textAlign: 'right' }}>CHG</div>+ <div style={{ textAlign: 'right' }}>%CHG</div>+ </div>+ {stocks.map((stock, index) => (+ <div+ key={index}+ style={{+ display: 'grid',+ gridTemplateColumns: '2fr 1fr 1fr 1fr',+ gap: '4px',+ fontSize: '9px',+ padding: '2px 0',+ borderBottom: `1px solid rgba(120,120,120,0.3)`+ }}+ >+ <div style={{ color: BLOOMBERG_CYAN }}>{stock.symbol}</div>+ <div style={{ color: BLOOMBERG_WHITE, textAlign: 'right' }}>+ {stock.quote?.price?.toFixed(2) || '-'}+ </div>+ <div style={{+ color: (stock.quote?.change || 0) >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {stock.quote ? formatChange(stock.quote.change) : '-'}+ </div>+ <div style={{+ color: (stock.quote?.change_percent || 0) >= 0 ? BLOOMBERG_GREEN : BLOOMBERG_RED,+ textAlign: 'right'+ }}>+ {stock.quote ? formatPercent(stock.quote.change_percent) : '-'}+ </div>+ </div>+ ))}+ {stocks.length === 0 && !loading && !error && (+ <div style={{ color: BLOOMBERG_GRAY, fontSize: '10px', textAlign: 'center', padding: '12px' }}>+ No stocks in watchlist+ </div>+ )}+ </div>+ </BaseWidget>+ );+};diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.ts b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.tsnew file mode 100644index 000000000..f80415d32--- /dev/null+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.ts@@ -0,0 +1,96 @@+export { BaseWidget } from './BaseWidget';+export { NewsWidget } from './NewsWidget';+export { MarketDataWidget } from './MarketDataWidget';+export { WatchlistWidget } from './WatchlistWidget';+export { ForumWidget } from './ForumWidget';+export { CryptoWidget } from './CryptoWidget';+export { CommoditiesWidget } from './CommoditiesWidget';+export { GlobalIndicesWidget } from './GlobalIndicesWidget';+export { ForexWidget } from './ForexWidget';+export { MaritimeWidget } from './MaritimeWidget';++// Widget type definitions+export type WidgetType = 'news' | 'market' | 'watchlist' | 'forum' | 'crypto' | 'commodities' | 'indices' | 'forex' | 'maritime';++export interface WidgetConfig {+ id: string;+ type: WidgetType;+ title: string;+ config?: {+ // News widget config+ newsCategory?: string;+ newsLimit?: number;++ // Market widget config+ marketCategory?: string;+ marketTickers?: string[];++ // Watchlist widget config+ watchlistId?: string;+ watchlistName?: string;++ // Forum widget config+ forumCategoryId?: number;+ forumCategoryName?: string;+ forumLimit?: number;+ };+}++export const DEFAULT_WIDGET_CONFIGS: Record<WidgetType, Partial<WidgetConfig>> = {+ news: {+ type: 'news',+ title: 'Latest News',+ config: {+ newsCategory: 'ALL',+ newsLimit: 5+ }+ },+ market: {+ type: 'market',+ title: 'Market Indices',+ config: {+ marketCategory: 'Indices',+ marketTickers: ['^GSPC', '^IXIC', '^DJI', '^RUT']+ }+ },+ watchlist: {+ type: 'watchlist',+ title: 'My Watchlist',+ config: {+ watchlistName: 'Default'+ }+ },+ forum: {+ type: 'forum',+ title: 'Forum Posts',+ config: {+ forumCategoryName: 'Trending',+ forumLimit: 5+ }+ },+ crypto: {+ type: 'crypto',+ title: 'Cryptocurrency Markets',+ config: {}+ },+ commodities: {+ type: 'commodities',+ title: 'Commodities',+ config: {}+ },+ indices: {+ type: 'indices',+ title: 'Global Indices',+ config: {}+ },+ forex: {+ type: 'forex',+ title: 'Forex - Major Pairs',+ config: {}+ },+ maritime: {+ type: 'maritime',+ title: 'Maritime Intelligence',+ config: {}+ }+};diff --git a/fincept-terminal-desktop/src/components/tabs/watchlist/WatchlistSidebar.tsx b/fincept-terminal-desktop/src/components/tabs/watchlist/WatchlistSidebar.tsxindex 7a72768fe..b1cc6782d 100644--- a/fincept-terminal-desktop/src/components/tabs/watchlist/WatchlistSidebar.tsx+++ b/fincept-terminal-desktop/src/components/tabs/watchlist/WatchlistSidebar.tsx@@ -88,9 +88,8 @@ const WatchlistSidebar: React.FC<WatchlistSidebarProps> = ({</div>) : (watchlists.map((watchlist) => (- <button+ <divkey={watchlist.id}- onClick={() => onSelectWatchlist(watchlist.id)}style={{width: '100%',display: 'flex',@@ -102,12 +101,12 @@ const WatchlistSidebar: React.FC<WatchlistSidebarProps> = ({? 'rgba(255,165,0,0.1)': 'rgba(255,255,255,0.02)',border: `1px solid ${selectedWatchlistId === watchlist.id ? ORANGE : 'transparent'}`,- textAlign: 'left',cursor: 'pointer',fontSize: '10px',fontFamily: 'Consolas, monospace',transition: 'all 0.2s'}}+ onClick={() => onSelectWatchlist(watchlist.id)}onMouseEnter={(e) => {if (selectedWatchlistId !== watchlist.id) {e.currentTarget.style.backgroundColor = 'rgba(255,255,255,0.05)';@@ -148,7 +147,7 @@ const WatchlistSidebar: React.FC<WatchlistSidebarProps> = ({><Trash2 size={12} /></button>- </button>+ </div>)))}</div>diff --git a/fincept-terminal-desktop/src/services/newsService.ts b/fincept-terminal-desktop/src/services/newsService.tsindex e1952bb8f..3b9af4ea7 100644--- a/fincept-terminal-desktop/src/services/newsService.ts+++ b/fincept-terminal-desktop/src/services/newsService.ts@@ -192,13 +192,23 @@ function parseRSSFeed(xmlText: string, feedConfig: typeof RSS_FEEDS[0]): NewsArtconst articles: NewsArticle[] = [];try {+ // Validate XML text before parsing+ if (!xmlText || xmlText.trim().length === 0) {+ return articles;+ }++ // Check if it's actually XML/RSS content+ if (!xmlText.trim().startsWith('<')) {+ return articles;+ }+const parser = new DOMParser();const xmlDoc = parser.parseFromString(xmlText, 'text/xml');// Check for parsing errorsconst parserError = xmlDoc.querySelector('parsererror');if (parserError) {- console.error('XML parsing error:', parserError.textContent);+ // Silently skip instead of logging - many feeds have minor issuesreturn articles;}@@ -287,44 +297,52 @@ function parseRSSFeed(xmlText: string, feedConfig: typeof RSS_FEEDS[0]): NewsArtreturn articles;}-// Fetch single RSS feed with single proxy attempt (optimized for speed)+// Fetch single RSS feed with proxy fallbackasync function fetchRSSFeed(feedConfig: typeof RSS_FEEDS[0]): Promise<NewsArticle[]> {- try {- // Only use first proxy for speed- const proxyUrl = `${CORS_PROXIES[0]}${encodeURIComponent(feedConfig.url)}`;-- const response = await fetch(proxyUrl, {- headers: {- 'Accept': 'application/rss+xml, application/xml, text/xml, */*'- },- signal: AbortSignal.timeout(5000) // Reduced to 5 second timeout- });+ // Try each proxy until one works+ for (const proxy of CORS_PROXIES) {+ try {+ const proxyUrl = `${proxy}${encodeURIComponent(feedConfig.url)}`;++ const response = await fetch(proxyUrl, {+ headers: {+ 'Accept': 'application/rss+xml, application/xml, text/xml, */*'+ },+ signal: AbortSignal.timeout(10000) // 10 second timeout per proxy+ });++ if (!response.ok) {+ continue; // Try next proxy+ }- if (!response.ok) {- return [];- }+ const xmlText = await response.text();- const xmlText = await response.text();- const articles = parseRSSFeed(xmlText, feedConfig);+ // Validate response is XML before parsing+ if (!xmlText || !xmlText.trim().startsWith('<')) {+ continue; // Try next proxy+ }- if (articles.length > 0) {- console.log(`✓ Fetched ${articles.length} articles from ${feedConfig.name}`);- }+ const articles = parseRSSFeed(xmlText, feedConfig);- return articles;- } catch (error) {- // Silent fail for speed- return [];+ if (articles.length > 0) {+ console.log(`✓ Fetched ${articles.length} articles from ${feedConfig.name}`);+ return articles;+ }+ } catch (error) {+ // Silently try next proxy+ continue;+ }}++ // All proxies failed - don't log to reduce console noise+ return [];}-// Fetch all RSS feeds with batching (optimized for speed)+// Fetch all RSS feeds with batchingexport async function fetchAllNews(): Promise<NewsArticle[]> {- console.log('Fetching news feeds (optimized batch mode)...');-const allArticles: NewsArticle[] = [];- const BATCH_SIZE = 5; // Fetch 5 feeds at a time- const TARGET_ARTICLES = 30; // Stop early if we get enough articles+ const BATCH_SIZE = 8; // Fetch 8 feeds at a time for better performance+ let successfulFeeds = 0;// Process feeds in batchesfor (let i = 0; i < RSS_FEEDS.length; i += BATCH_SIZE) {@@ -335,16 +353,9 @@ export async function fetchAllNews(): Promise<NewsArticle[]> {results.forEach((result) => {if (result.status === 'fulfilled' && result.value.length > 0) {allArticles.push(...result.value);+ successfulFeeds++;}});-- console.log(`Batch ${Math.floor(i / BATCH_SIZE) + 1}: Total articles: ${allArticles.length}`);-- // Early exit if we have enough articles- if (allArticles.length >= TARGET_ARTICLES) {- console.log(`✓ Reached ${allArticles.length} articles, stopping fetch`);- break;- }}// Sort by publication date (newest first)@@ -354,7 +365,7 @@ export async function fetchAllNews(): Promise<NewsArticle[]> {return dateB.getTime() - dateA.getTime();});- console.log(`✓ Total articles loaded: ${allArticles.length}`);+ console.log(`✓ Loaded ${allArticles.length} articles from ${successfulFeeds}/${RSS_FEEDS.length} feeds`);return allArticles;}@@ -364,37 +375,39 @@ let lastFetchTime = 0;const CACHE_DURATION = 5 * 60 * 1000; // 5 minuteslet useMockData = false;-export async function fetchNewsWithCache(): Promise<NewsArticle[]> {+export async function fetchNewsWithCache(forceRefresh: boolean = false): Promise<NewsArticle[]> {const now = Date.now();- // Return cached news if still valid- if (cachedNews.length > 0 && (now - lastFetchTime) < CACHE_DURATION) {- console.log('Returning cached news');+ // Return cached news if still valid and not forcing refresh+ if (!forceRefresh && cachedNews.length > 0 && (now - lastFetchTime) < CACHE_DURATION) {return cachedNews;}- console.log('Fetching fresh news...');-- // Start with mock data immediately for instant display- if (cachedNews.length === 0) {- cachedNews = generateMockNews();- useMockData = true;- }+ // On first load or force refresh, fetch real news immediately+ try {+ const fetchedNews = await fetchAllNews();- // Try to fetch real news in background- fetchAllNews().then(fetchedNews => {- // If we got at least 10 articles, replace with real data- if (fetchedNews.length >= 10) {- console.log(`✓ Successfully loaded ${fetchedNews.length} real news articles`);+ if (fetchedNews.length > 0) {cachedNews = fetchedNews;useMockData = false;lastFetchTime = Date.now();+ return cachedNews;} else {- console.warn(`⚠ Only fetched ${fetchedNews.length} articles, keeping mock data`);+ // Only use mock data if real fetch completely fails and we have no cache+ if (cachedNews.length === 0) {+ console.log('⚠ Using demo data - no live feeds available');+ cachedNews = generateMockNews();+ useMockData = true;+ }}- }).catch(err => {- console.error('Failed to fetch news:', err);- });+ } catch (err) {+ // Only use mock data if real fetch completely fails and we have no cache+ if (cachedNews.length === 0) {+ console.log('⚠ Using demo data - fetch failed');+ cachedNews = generateMockNews();+ useMockData = true;+ }+ }lastFetchTime = now;return cachedNews;diff --git a/fincept-terminal-desktop/temp.txt b/fincept-terminal-desktop/temp.txtdeleted file mode 100644index f2afebe87..000000000--- a/fincept-terminal-desktop/temp.txt+++ /dev/null@@ -1,8 +0,0 @@- TCP [::1]:1420 [::]:0 LISTENING 8452- TCP [::1]:1420 [::1]:49774 TIME_WAIT 0- TCP [::1]:1420 [::1]:51945 TIME_WAIT 0- TCP [::1]:1420 [::1]:55589 TIME_WAIT 0- TCP [::1]:1420 [::1]:59273 TIME_WAIT 0- TCP [::1]:1420 [::1]:61966 TIME_WAIT 0- TCP [::1]:1420 [::1]:64211 TIME_WAIT 0- TCP [::1]:57094 [::1]:1420 TIME_WAIT 0