import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { TrendingUp, TrendingDown, DollarSign, Activity, AlertTriangle, Clock, ArrowUpRight, ArrowDownRight, BarChart3, PieChart, Zap, Building2, Landmark, FileText, Shield, CheckSquare, ChevronRight, RefreshCw } from 'lucide-react'; import { financialSummary, sampleAccounts, treasuryPositions, complianceAlerts, recentActivity, portalModules } from '../data/portalData'; const formatCurrency = (amount: number, currency = 'USD') => { if (Math.abs(amount) >= 1_000_000_000) return `${currency === 'USD' ? '$' : ''}${(amount / 1_000_000_000).toFixed(2)}B`; if (Math.abs(amount) >= 1_000_000) return `${currency === 'USD' ? '$' : ''}${(amount / 1_000_000).toFixed(2)}M`; if (Math.abs(amount) >= 1_000) return `${currency === 'USD' ? '$' : ''}${(amount / 1_000).toFixed(1)}K`; return `${currency === 'USD' ? '$' : ''}${amount.toFixed(2)}`; }; const moduleIcons: Record = { 'dashboard': BarChart3, 'transaction-builder': Zap, 'accounts': Building2, 'treasury': Landmark, 'reporting': FileText, 'compliance': Shield, 'settlements': CheckSquare, }; const statusColors: Record = { success: '#22c55e', warning: '#eab308', error: '#ef4444', info: '#3b82f6', }; const severityColors: Record = { critical: '#ef4444', high: '#f97316', medium: '#eab308', low: '#3b82f6', }; export default function DashboardPage() { const navigate = useNavigate(); const [timeRange, setTimeRange] = useState<'1D' | '1W' | '1M' | '3M' | 'YTD'>('1D'); const totalPnL = financialSummary.unrealizedPnL + financialSummary.realizedPnL; const pnlPositive = totalPnL >= 0; const assetAllocation = [ { label: 'Fixed Income', value: 83_900_000, color: '#3b82f6', pct: 39 }, { label: 'Equities', value: 45_200_000, color: '#22c55e', pct: 21 }, { label: 'Digital Assets', value: 20_425_000, color: '#a855f7', pct: 10 }, { label: 'FX', value: 20_250_000, color: '#eab308', pct: 9 }, { label: 'Commodities', value: 11_500_000, color: '#f97316', pct: 5 }, { label: 'Cash & Equivalents', value: 33_175_000, color: '#6b7280', pct: 16 }, ]; const openAlerts = complianceAlerts.filter(a => a.status !== 'resolved'); return (

Portfolio Overview

Solace Bank Group PLC — Consolidated View

{(['1D', '1W', '1M', '3M', 'YTD'] as const).map(range => ( ))}
{/* KPI Cards Row */}
Total Assets (AUM)
{formatCurrency(financialSummary.totalAssets)}
+2.3% from yesterday
Net Position
{formatCurrency(financialSummary.netPosition)}
+1.8% from yesterday
Total P&L {pnlPositive ? : }
{pnlPositive ? '+' : ''}{formatCurrency(totalPnL)}
Realized: {formatCurrency(financialSummary.realizedPnL)} Unrealized: {formatCurrency(financialSummary.unrealizedPnL)}
Daily Volume
{formatCurrency(financialSummary.dailyVolume)}
-5.1% from yesterday
Pending Settlements
{formatCurrency(financialSummary.pendingSettlements)}
3 DVP · 1 PVP · 2 FOP
Active Alerts
{openAlerts.length}
{openAlerts.filter(a => a.severity === 'critical').length} critical {openAlerts.filter(a => a.severity === 'high').length} high
{/* Asset Allocation */}

Asset Allocation

{assetAllocation.map(a => (
))}
{assetAllocation.map(a => (
{a.label} {formatCurrency(a.value)} {a.pct}%
))}
{/* Top Positions */}

Top Positions

Instrument Market Value P&L
{treasuryPositions.slice(0, 6).map(pos => (
{pos.assetClass} {pos.instrument}
{formatCurrency(pos.marketValue)} = 0 ? 'positive' : 'negative'}`}> {pos.unrealizedPnL >= 0 ? '+' : ''}{formatCurrency(pos.unrealizedPnL)}
))}
{/* Accounts Overview */}

Accounts

{sampleAccounts.filter(a => !a.parentId).slice(0, 5).map(acc => (
{acc.type} {acc.name}
{acc.currency === 'BTC' ? `${acc.balance.toFixed(2)} BTC` : formatCurrency(acc.balance, acc.currency)} {acc.currency}
))}
{/* Compliance Alerts */}

Compliance Alerts

{complianceAlerts.filter(a => a.status !== 'resolved').slice(0, 4).map(alert => (
{alert.severity.toUpperCase()} {alert.category} {alert.message}
))}
{/* Recent Activity */}

Recent Activity

{recentActivity.map(item => (
{item.action} {item.detail}
{item.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
))}
{/* Quick Access Modules */}

Quick Access

{portalModules.filter(m => m.id !== 'dashboard').map(mod => { const Icon = moduleIcons[mod.id] || Zap; return ( ); })}
); }