'use client'; import { useState, useEffect } from 'react'; import { investors, bikes, transactions } from '@/data/mockData'; import { Wallet, TrendingUp, Bike, Target, DollarSign, FileText, Phone, BarChart3, Clock, ArrowRight, ShieldCheck, Zap, AlertCircle, Download, X, ExternalLink } from 'lucide-react'; import Link from 'next/link'; import TransactionList from '@/components/TransactionList'; import InvestorNotification from '@/components/InvestorNotification'; export default function InvestorDashboardPage() { const investor = investors[0]; const investorBikes = bikes.filter(b => b.investorId === investor?.id); const recentTransactions = transactions.filter(t => t.investorId === investor.id).slice(0, 5); const availableBalance = investor.totalEarnings - investor.totalWithdrawn - investor.withdrawalPending; const [deferredPrompt, setDeferredPrompt] = useState(null); const [showInstallBanner, setShowInstallBanner] = useState(false); useEffect(() => { const handler = (e: Event) => { e.preventDefault(); setDeferredPrompt(e); setShowInstallBanner(true); }; window.addEventListener('beforeinstallprompt', handler); return () => window.removeEventListener('beforeinstallprompt', handler); }, []); const handleInstall = async () => { if (!deferredPrompt) return; deferredPrompt.prompt(); const { outcome } = await deferredPrompt.userChoice; if (outcome === 'accepted') { setDeferredPrompt(null); } setShowInstallBanner(false); }; const dismissBanner = () => { setShowInstallBanner(false); localStorage.setItem('pwa_install_dismissed', 'true'); }; useEffect(() => { if (localStorage.getItem('pwa_install_dismissed') === 'true') { setShowInstallBanner(false); } }, []); return (

Welcome back, {investor.name.split(' ')[0]} 👋

Here's what's happening with your investments today.

{investor.kycStatus === 'verified' ? ( KYC Verified ) : ( Complete KYC )} New Investment

Total Invested

à§³{(investor.totalInvested / 1000).toFixed(0)}k

Total Earnings

à§³{(investor.totalEarnings / 1000).toFixed(1)}k

Active Bikes

{investor.activeBikes}

Avg. ROI

{investor.roi}%

{/* PWA Install Banner */} {showInstallBanner && (

Install JML Investor App

Add to home screen for quick access & offline support

)}

My Portfolio Overview

View All
{investorBikes.length > 0 ? (
{investorBikes.slice(0, 3).map(bike => (
{bike.model}

{bike.model}

{bike.plateNumber}

à§³{bike.currentRent || 0}

Daily Rent

{bike.status}
))}
) : (

No bikes assigned yet

Once you make an investment, assigned bikes will appear here.

)}

Quick Actions

Available to Withdraw

à§³{availableBalance.toLocaleString()}

Withdraw Funds

Update KYC

Manage documents

Earnings & P&L

View detailed reports

Recent Transactions

); }