import React, { useState, useEffect } from 'react'; import { TrendingUp, ShieldCheck, Zap, Globe, DollarSign, Settings, Users, Sliders, Activity, ChevronRight, ChevronDown, CheckCircle, AlertTriangle, RefreshCw, Search, Filter, Lock, User, LogOut, ArrowUpRight, BarChart3, HelpCircle, CreditCard, Bell, Play, Pause, ExternalLink, Calculator, Layers, Check, X, Eye, EyeOff, Server, Cpu } from 'lucide-react'; // ========================================== // MOCK DATA & CONFIGURATIONS // ========================================== const INITIAL_OPPORTUNITIES = [ { id: 'arb-101', sport: 'Football', league: 'English Premier League', event: 'Arsenal vs Manchester City', startTime: '2026-10-12 16:30', market: '1X2 (Full Time)', isLive: false, country: 'UK', netRoi: 3.42, grossMargin: 3.85, totalImpliedProb: 96.28, lastUpdated: '2s ago', status: 'ACTIVE', legs: [ { outcome: '1 (Arsenal)', bookmaker: 'Bet365', odds: 2.35, stakePercent: 42.1, recommendedStake: 421.00, payout: 989.35 }, { outcome: 'X (Draw)', bookmaker: 'William Hill', odds: 3.60, stakePercent: 27.4, recommendedStake: 274.00, payout: 986.40 }, { outcome: '2 (Man City)', bookmaker: 'Sky Bet', odds: 3.40, stakePercent: 30.5, recommendedStake: 305.00, payout: 1037.00 } ], currency: 'USD', totalInvestment: 1000.00, estimatedProfit: 34.20, warning: 'Minor liquidity limits reported on William Hill draw market.' }, { id: 'arb-102', sport: 'Basketball', league: 'NBA', event: 'Boston Celtics vs LA Lakers', startTime: '2026-10-12 00:00', market: 'Moneyline (OT Included)', isLive: true, country: 'US', netRoi: 2.15, grossMargin: 2.40, totalImpliedProb: 97.65, lastUpdated: '1s ago', status: 'ACTIVE', legs: [ { outcome: 'Boston Celtics', bookmaker: 'DraftKings', odds: 1.85, stakePercent: 54.1, recommendedStake: 541.00, payout: 1000.85 }, { outcome: 'LA Lakers', bookmaker: 'FanDuel', odds: 2.22, stakePercent: 45.9, recommendedStake: 459.00, payout: 1018.98 } ], currency: 'USD', totalInvestment: 1000.00, estimatedProfit: 21.50, warning: 'Live odds fluctuating rapidly. Execute quickly.' }, { id: 'arb-103', sport: 'Football', league: 'Nigeria NPFL', event: 'Enyimba vs Rivers United', startTime: '2026-10-13 15:00', market: '1X2 (Full Time)', isLive: false, country: 'Nigeria', netRoi: 4.80, grossMargin: 5.20, totalImpliedProb: 95.05, lastUpdated: '8s ago', status: 'ACTIVE', legs: [ { outcome: '1 (Enyimba)', bookmaker: 'Bet9ja', odds: 2.10, stakePercent: 49.5, recommendedStake: 49500.00, payout: 103950.00 }, { outcome: 'X (Draw)', bookmaker: 'SportyBet', odds: 3.50, stakePercent: 29.7, recommendedStake: 29700.00, payout: 103950.00 }, { outcome: '2 (Rivers)', bookmaker: 'BetKing', odds: 4.20, stakePercent: 20.8, recommendedStake: 20800.00, payout: 103360.00 } ], currency: 'NGN', totalInvestment: 100000.00, estimatedProfit: 4800.00, warning: 'Ensure exact stake rounding per Nigerian bookmaker rules.' }, { id: 'arb-104', sport: 'Tennis', league: 'ATP Masters', event: 'Alcaraz C. vs Sinner J.', startTime: '2026-10-12 14:00', market: 'Match Winner', isLive: false, country: 'UK', netRoi: 1.85, grossMargin: 2.10, totalImpliedProb: 98.15, lastUpdated: '12s ago', status: 'STALE', legs: [ { outcome: 'Alcaraz C.', bookmaker: 'Bet365', odds: 1.72, stakePercent: 58.1, recommendedStake: 581.00, payout: 999.32 }, { outcome: 'Sinner J.', bookmaker: 'Betfair Exchange', odds: 2.45, stakePercent: 41.9, recommendedStake: 419.00, payout: 1026.55 } ], currency: 'USD', totalInvestment: 1000.00, estimatedProfit: 18.50, warning: 'Exchange commission (2%) already factored into net ROI calculation.' }, { id: 'arb-105', sport: 'Ice Hockey', league: 'NHL', event: 'Edmonton Oilers vs Toronto Maple Leafs', startTime: '2026-10-14 01:30', market: 'Moneyline', isLive: false, country: 'Canada', netRoi: 3.10, grossMargin: 3.45, totalImpliedProb: 96.90, lastUpdated: '5s ago', status: 'ACTIVE', legs: [ { outcome: 'Oilers', bookmaker: 'bet365 Canada', odds: 2.05, stakePercent: 49.2, recommendedStake: 492.00, payout: 1008.60 }, { outcome: 'Maple Leafs', bookmaker: 'BetMGM', odds: 1.98, stakePercent: 50.8, recommendedStake: 508.00, payout: 1005.84 } ], currency: 'CAD', totalInvestment: 1000.00, estimatedProfit: 31.00, warning: 'Provincial sports betting regulations apply.' } ]; const BOOKMAKERS_DIRECTORY = [ { name: 'Bet9ja', country: 'Nigeria', region: 'NG', status: 'Connected', latency: '140ms', apiType: 'Direct API', reliability: '99.4%' }, { name: 'SportyBet', country: 'Nigeria', region: 'NG', status: 'Connected', latency: '110ms', apiType: 'WebSocket', reliability: '99.8%' }, { name: 'BetKing', country: 'Nigeria', region: 'NG', status: 'Connected', latency: '180ms', apiType: 'REST API', reliability: '98.9%' }, { name: 'Bet365', country: 'United Kingdom', region: 'UK', status: 'Connected', latency: '65ms', apiType: 'Enterprise Feed', reliability: '99.9%' }, { name: 'William Hill', country: 'United Kingdom', region: 'UK', status: 'Connected', latency: '85ms', apiType: 'Direct API', reliability: '99.5%' }, { name: 'Sky Bet', country: 'United Kingdom', region: 'UK', status: 'Delayed', latency: '320ms', apiType: 'Polled API', reliability: '97.2%' }, { name: 'DraftKings', country: 'United States', region: 'US', status: 'Connected', latency: '75ms', apiType: 'WebSocket', reliability: '99.9%' }, { name: 'FanDuel', country: 'United States', region: 'US', status: 'Connected', latency: '80ms', apiType: 'Direct API', reliability: '99.8%' }, { name: 'BetMGM', country: 'United States', region: 'US', status: 'Connected', latency: '95ms', apiType: 'REST API', reliability: '99.1%' }, { name: 'Caesars', country: 'United States', region: 'US', status: 'Unavailable', latency: 'N/A', apiType: 'Maintenance', reliability: '94.0%' }, { name: 'bet365 Canada', country: 'Canada', region: 'CA', status: 'Connected', latency: '90ms', apiType: 'Enterprise Feed', reliability: '99.7%' } ]; const SUBSCRIPTION_PLANS = [ { id: 'free', name: 'Free Starter', priceNGN: '₦0', priceUSD: '$0', period: 'forever', features: ['Delayed Odds (60s delay)', 'Basic 2-Outcome Arbs', 'Community Support', 'Standard Calculator'], current: false }, { id: 'starter', name: 'Pro Arbitrageur', priceNGN: '₦24,500', priceUSD: '$39', period: 'per month', features: ['Real-time Instant Feed (<2s)', '2 & 3+ Outcome Arbs', 'All Regions (NG, UK, US, CA)', 'Advanced Stake Calculator', 'Email & Telegram Alerts'], current: true }, { id: 'enterprise', name: 'Institutional Syndicate', priceNGN: '₦85,000', priceUSD: '$149', period: 'per month', features: ['Dedicated Low-Latency Feeds', 'API & Webhook Access', 'Custom Bookmaker Filters', 'Multi-Account Stake Manager', 'Dedicated Account Manager'], current: false } ]; export default function ArbFinderApp() { // Navigation & View State const [currentView, setCurrentView] = useState('landing'); // landing, dashboard, calculator, bookmakers, settings, admin, auth const [authMode, setAuthMode] = useState('login'); // login, signup, forgot const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [toastMessage, setToastMessage] = useState(null); // User Session State const [user, setUser] = useState({ name: 'Adeola Johnson', email: 'adeola@arbfinder.io', role: 'SUPER_ADMIN', // FREE, PREMIUM, SUPER_ADMIN plan: 'Pro Arbitrageur', currency: 'USD' }); // Dashboard Filters & State const [opportunities, setOpportunities] = useState(INITIAL_OPPORTUNITIES); const [searchQuery, setSearchQuery] = useState(''); const [selectedCountry, setSelectedCountry] = useState('ALL'); const [selectedSport, setSelectedSport] = useState('ALL'); const [minRoi, setMinRoi] = useState(1.0); const [onlyLive, setOnlyLive] = useState(false); const [expandedRowId, setExpandedRowId] = useState(null); const [simulatedFeedActive, setSimulatedFeedActive] = useState(true); // Calculator State const [calcBankroll, setCalcBankroll] = useState(1000); const [calcCurrency, setCalcCurrency] = useState('USD'); const [calcOddsFormat, setCalcOddsFormat] = useState('decimal'); const [calcLegs, setCalcLegs] = useState([ { bookmaker: 'Bet365', odds: 2.10 }, { bookmaker: 'William Hill', odds: 3.40 } ]); // Toast notification helper const showToast = (msg) => { setToastMessage(msg); setTimeout(() => setToastMessage(null), 3500); }; // Simulated live feed tick effect useEffect(() => { if (!simulatedFeedActive) return; const interval = setInterval(() => { setOpportunities(prev => prev.map(item => { if (Math.random() > 0.7) { const delta = (Math.random() * 0.4 - 0.2); const newRoi = Math.max(0.5, Number((item.netRoi + delta).toFixed(2))); return { ...item, netRoi: newRoi, lastUpdated: 'Just now' }; } return item; })); }, 4000); return () => clearInterval(interval); }, [simulatedFeedActive]); // Filtered opportunities const filteredOpportunities = opportunities.filter(item => { const matchesSearch = item.event.toLowerCase().includes(searchQuery.toLowerCase()) || item.league.toLowerCase().includes(searchQuery.toLowerCase()); const matchesCountry = selectedCountry === 'ALL' || item.country === selectedCountry; const matchesSport = selectedSport === 'ALL' || item.sport === selectedSport; const matchesRoi = item.netRoi >= minRoi; const matchesLive = !onlyLive || item.isLive; return matchesSearch && matchesCountry && matchesSport && matchesRoi && matchesLive; }); // Calculator calculations const calcInverseSum = calcLegs.reduce((sum, leg) => sum + (1 / (Number(leg.odds) || 1.01)), 0); const calcGrossMargin = 1 - calcInverseSum; const calcNetRoi = (1 / calcInverseSum - 1) * 100; const calcStakes = calcLegs.map(leg => { const odds = Number(leg.odds) || 1.01; const stake = (calcBankroll * (1 / odds)) / calcInverseSum; const payout = stake * odds; return { bookmaker: leg.bookmaker, odds, stake: isNaN(stake) ? 0 : Number(stake.toFixed(2)), payout: isNaN(payout) ? 0 : Number(payout.toFixed(2)) }; }); const calcEstimatedProfit = calcStakes.length > 0 ? calcStakes[0].payout - calcBankroll : 0; return (
{/* Toast Notification */} {toastMessage && (
{toastMessage}
)} {/* TOP NAVIGATION BAR */}
setCurrentView('landing')} className="flex items-center space-x-2.5 cursor-pointer group" >
ArbFinder PRO v3.4
{/* Desktop Nav Links */}
{/* Right Nav Actions */}
{/* Simulated Feed Status Pill */}
Feed: {simulatedFeedActive ? 'Live WebSocket' : 'Paused'}
{user ? (
{user.name}
{user.plan}
setUser(null)} className="w-8 h-8 rounded-lg bg-gradient-to-tr from-emerald-500 to-teal-400 flex items-center justify-center text-slate-950 font-bold text-xs cursor-pointer hover:opacity-90" title="Logout" > AJ
) : (
)} {/* Mobile Menu Toggle */}
{/* Mobile Dropdown Nav */} {mobileMenuOpen && (
)} {/* ========================================== */} {/* MAIN VIEW ROUTER */} {/* ========================================== */}
{/* 1. PUBLIC LANDING VIEW */} {currentView === 'landing' && (
{/* Hero Section */}
Real-Time Odds Aggregation Across NG, UK, US & Canada

Mathematical Certainty in Sports Arbitrage

Scan live sportsbooks instantly. Discover guaranteed profit opportunities with positive expected value regardless of match outcomes.

{/* Live Ticker Bar on Landing */}
LIVE ARBITRAGE FEED SAMPLE Updated 1s ago
{opportunities.slice(0, 3).map((opp) => (
{opp.sport} • {opp.country} +{opp.netRoi}% ROI
{opp.event}
{opp.legs[0].bookmaker} vs {opp.legs[1].bookmaker}
))}
{/* Features Grid */}

Engineered for Maximum Yield

Professional-grade tools built to eliminate latency and human calculation errors.

Sub-Second Ingestion

Direct WebSocket and enterprise API feeds capture price discrepancies before bookmakers adjust their lines.

Advanced Stake Optimizer

Automatic stake balancing across 2-outcome and 3-outcome markets with exchange commission deductions.

Multi-Jurisdiction Coverage

Compliant bookmaker registry covering Nigeria (Bet9ja, SportyBet), UK, US, and Canadian regulated operators.

)} {/* 2. MAIN ARBITRAGE DASHBOARD (SUREBETS LISTING) */} {currentView === 'dashboard' && (
{/* Dashboard Header & Stats */}

Live Arbitrage Scanner

Real-time surebets detected across authorized regional bookmakers.

Active Opportunities: {filteredOpportunities.length}
{/* Filter Toolbar */}
setSearchQuery(e.target.value)} className="w-full bg-slate-950 border border-slate-800 rounded-xl pl-9 pr-3 py-2 text-sm text-white focus:outline-none focus:border-emerald-500" />
setMinRoi(Number(e.target.value))} className="w-full accent-emerald-500 mt-2" />
{/* Opportunities Table */}
{filteredOpportunities.length === 0 ? ( ) : ( filteredOpportunities.map((opp) => { const isExpanded = expandedRowId === opp.id; return ( {/* Expanded Row Breakdown */} {isExpanded && ( )} ); }) )}
Net ROI Sport / Event Market Outcomes & Bookmakers Est. Profit ($1k inv) Updated Action
No arbitrage opportunities found matching your filter criteria.
+{opp.netRoi}%
Gross: {opp.grossMargin}%
{opp.event}
{opp.league} • {opp.country}
{opp.market}
{opp.legs.map((leg, idx) => (
{leg.outcome}: {leg.odds} ({leg.bookmaker})
))}
{opp.currency === 'NGN' ? '₦' : opp.currency === 'CAD' ? 'CAD$' : '$'} {opp.estimatedProfit.toLocaleString()}
Stake: {opp.currency === 'NGN' ? '₦' : '$'}{opp.totalInvestment.toLocaleString()}
{opp.lastUpdated} {opp.status === 'STALE' && Stale Odds}

Stake Allocation & Execution Breakdown

⚠️ {opp.warning}
{opp.legs.map((leg, idx) => (
{leg.outcome} ({leg.bookmaker})
Odds: {leg.odds}
Rec. Stake: {opp.currency === 'NGN' ? '₦' : '$'}{leg.recommendedStake.toLocaleString()}
Guaranteed Payout: {opp.currency === 'NGN' ? '₦' : '$'}{leg.payout.toLocaleString()}
))}
Total Implied Probability: {opp.totalImpliedProb}%
)} {/* 3. INTERACTIVE ARBITRAGE CALCULATOR */} {currentView === 'calculator' && (

Arbitrage Stake Calculator

Enter bankroll and odds to instantly calculate optimal stakes and guaranteed profit.

{/* Left Input Panel */}
setCalcBankroll(Number(e.target.value))} className="w-full bg-slate-950 border border-slate-800 rounded-xl px-4 py-2.5 text-sm text-white focus:outline-none focus:border-emerald-500" />
{calcLegs.map((leg, index) => (
#{index + 1} { const updated = [...calcLegs]; updated[index].bookmaker = e.target.value; setCalcLegs(updated); }} className="flex-1 bg-slate-900 border border-slate-800 rounded-lg px-3 py-1.5 text-xs text-white" placeholder="Bookmaker name" /> { const updated = [...calcLegs]; updated[index].odds = e.target.value; setCalcLegs(updated); }} className="w-24 bg-slate-900 border border-slate-800 rounded-lg px-3 py-1.5 text-xs text-white font-bold text-emerald-400" /> {calcLegs.length > 2 && ( )}
))}
{/* Right Output Summary Panel */}

Calculation Results

Net Arbitrage ROI
0 ? 'text-emerald-400' : 'text-red-400'}`}> {calcNetRoi > 0 ? `+${calcNetRoi.toFixed(2)}%` : `${calcNetRoi.toFixed(2)}%`}
{calcNetRoi > 0 ? '🟢 Profitable Surebet Opportunity' : '🔴 Negative Margin (No Arb)'}
Gross Margin: {(calcGrossMargin * 100).toFixed(2)}%
Total Implied Prob: {(calcInverseSum * 100).toFixed(2)}%
Estimated Profit: {calcCurrency === 'NGN' ? '₦' : '$'}{calcEstimatedProfit.toFixed(2)}
Recommended Stakes:
{calcStakes.map((s, i) => (
{s.bookmaker} ({s.odds}): {calcCurrency === 'NGN' ? '₦' : '$'}{s.stake.toLocaleString()}
))}
)} {/* 4. BOOKMAKER & PROVIDER DIRECTORY */} {currentView === 'bookmakers' && (

Bookmaker & Data Provider Registry

Operational health, latency, and regional availability across authorized jurisdictions.

{BOOKMAKERS_DIRECTORY.map((bm, index) => ( ))}
Operator / Provider Jurisdiction Operational Status Feed Latency Integration Type Reliability
{bm.name} {bm.country} ({bm.region}) {bm.status} {bm.latency} {bm.apiType} {bm.reliability}
)} {/* 5. USER SETTINGS & SUBSCRIPTION VIEW */} {currentView === 'settings' && (

Subscription & Account Settings

Manage your subscription tier, API keys, and notification preferences.

{SUBSCRIPTION_PLANS.map((plan) => (

{plan.name}

{plan.current && Current Plan}
{plan.priceUSD} / {plan.period}
({plan.priceNGN})
    {plan.features.map((feat, i) => (
  • {feat}
  • ))}
))}

API Credentials & Webhooks

Keep your API key secure. Never expose private keys in client-side applications.

)} {/* 6. ADMIN DASHBOARD (SUPER ADMIN VIEW) */} {currentView === 'admin' && (

Super Admin Control Center

System health, audit logs, and user role management.

🔐 SUPER_ADMIN ACCESS ACTIVE
{/* Metrics Grid */}
Total Registered Users
4,892
+342 this week
Active Subscribers
1,245
94% retention rate
Active Odds Providers
10 / 11
Caesars degraded
System Ingestion Latency
88ms
Optimal performance
{/* Audit Logs */}

Recent System Audit Logs

{[ { time: '2 mins ago', action: 'Provider Bet365 reconnected successfully', type: 'INFO' }, { time: '14 mins ago', action: 'User upgrade to Pro: michael@hedgecapital.co.uk', type: 'PAYMENT' }, { time: '45 mins ago', action: 'Manual access grant issued by Super Admin', type: 'SECURITY' }, { time: '2 hours ago', action: 'Database migration v3.4 executed successfully', type: 'SYSTEM' } ].map((log, i) => (
{log.time} {log.action}
{log.type}
))}
)} {/* 7. AUTH VIEWS (SIGN IN / SIGN UP) */} {currentView === 'auth' && (

{authMode === 'login' ? 'Welcome Back to ArbFinder' : 'Create Your Account'}

Professional sports arbitrage SaaS platform

{authMode === 'signup' && (
)}
{authMode === 'login' ? ( Don't have an account? ) : ( Already have an account? )}
)}
{/* FOOTER */}
); }