import React, { useState } from 'react'; import { AffiliateStats } from '../types'; import { GeminiService } from '../geminiService'; interface DashboardViewProps { earnings: number; onWithdraw: () => void; payoutMethod: string; setPayoutMethod: (method: string) => void; affiliateStats: AffiliateStats; isNodeActive: boolean; onToggleNode: () => void; } const DashboardView: React.FC = ({ earnings, onWithdraw, payoutMethod, setPayoutMethod, affiliateStats, isNodeActive, onToggleNode }) => { const [isEditingPayout, setIsEditingPayout] = useState(false); const [tempPayout, setTempPayout] = useState(payoutMethod); const [copied, setCopied] = useState(false); const [aiCaption, setAiCaption] = useState(''); const [isGeneratingCaption, setIsGeneratingCaption] = useState(false); const referralLink = `${window.location.origin}/#join-${affiliateStats.referralCode}`; const mockTransactions = [ { id: 1, type: 'Passive Royalty', tool: 'Gemini 3 Pro', amount: 4.00, date: 'Just Now' }, { id: 2, type: 'Referral Bonus', tool: 'User_4921 Top-up', amount: 159.90, date: '2 hours ago' }, { id: 3, type: 'Platform Reward', tool: 'Daily Active Node', amount: 10.00, date: 'Today' }, { id: 4, type: 'Passive Royalty', tool: 'Imagen 4.0 Pro', amount: 6.00, date: 'Today' }, ]; const savePayout = () => { setPayoutMethod(tempPayout); setIsEditingPayout(false); }; const handleCopy = () => { navigator.clipboard.writeText(referralLink); setCopied(true); setTimeout(() => setCopied(false), 2000); }; const generateViralCaption = async () => { setIsGeneratingCaption(true); try { const { text } = await GeminiService.chat( `Write a super catchy, high-conversion viral WhatsApp/Social Media message in Hinglish to promote my AI store "OmniNexus AI". The message should sound like a personal recommendation from a successful founder. Key points: - Users get 500 FREE credits on signup. - Access to Gemini 3 Pro, Imagen 4.0, and Veo Video Gen. - Earn passive income in INR via UPI by sharing. - Link is: ${referralLink} Use emojis and make it look like a viral 'loot' deal.` ); setAiCaption(text); } catch (err) { setAiCaption("Bhai! AI tools use karo aur ghar baithe paise kamao. 500 free credits yahan milenge: " + referralLink); } finally { setIsGeneratingCaption(false); } }; const shareOnWhatsApp = (customText?: string) => { const text = customText || `Bhai! Maine OmniNexus AI use karke passive income kamaana shuru kar diya hai. Aap bhi try karo: ${referralLink}`; window.open(`https://wa.me/?text=${encodeURIComponent(text)}`, '_blank'); }; const shareOnTwitter = (customText?: string) => { const text = customText || `Bhai! Maine OmniNexus AI use karke passive income kamaana shuru kar diya hai. Aap bhi try karo: ${referralLink}`; window.open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}`, '_blank'); }; const shareOnFacebook = () => { window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(referralLink)}`, '_blank'); }; const [messageCopied, setMessageCopied] = useState(false); const handleCopyMessage = (text: string) => { navigator.clipboard.writeText(text); setMessageCopied(true); setTimeout(() => setMessageCopied(false), 2000); }; return (

The Vault.

Primary Settlement Hub for {payoutMethod}

UPI Status

VERIFIED & LIVE

Node Level

FOUNDER ELITE 🚀

{/* EARNINGS CARD */}

Settled Balance (INR)

{isNodeActive ? 'Passive Mode Active' : 'Passive Mode Paused'}

₹{earnings.toFixed(2)}

Secure Payout Vault

{payoutMethod}
Private
{/* PASSIVE INCOME ENGINE */}

Income Engine

Your node captures micro-royalties from global AI traffic.

Node Status {isNodeActive ? 'ACTIVE' : 'PAUSED'}
Daily Yield ₹45 - ₹120
Referral Royalty 10% FIXED
{/* AI AD ENGINE */}

Viral Kit

Gemini generates viral scripts to grow your business.

{aiCaption ? (

"{aiCaption}"

) : (

Refer friends to earn 10% on every Top-up they make

)}
{aiCaption && (
)}
{/* REFERRAL LINK */}

Growth Center

QR

Business QR

Your Permanent Business Link

{referralLink}

Founder Tip: Put this in your Instagram bio to attract global nodes.

{/* TRANSACTION TABLE */}

Settlement Ledger

Real-time Stats
{mockTransactions.map((tx) => ( ))}
Source Description Income (INR) Status

{tx.tool}

{tx.type} • {tx.date}

+₹{tx.amount.toFixed(2)}

Settled
{isEditingPayout && (

Vault Update

Configure your INR Payout Address

setTempPayout(e.target.value)} placeholder="aditya@ptyes" className="w-full bg-[#020617] border border-slate-800 rounded-2xl px-6 py-5 text-white font-black uppercase text-xs focus:border-indigo-500 outline-none transition-all mb-6" />
)}
); }; export default DashboardView;