import React, { useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Badge } from '@/components/ui/badge'; import { Plus, Trash2, Target, Activity, DollarSign } from 'lucide-react'; import { useToast } from '@/hooks/use-toast'; interface TargetWalletManagerProps { wallets: string[]; setWallets: (wallets: string[]) => void; } export const TargetWalletManager: React.FC = ({ wallets, setWallets }) => { const [newWallet, setNewWallet] = useState(''); const { toast } = useToast(); const addWallet = () => { if (!newWallet.trim()) { toast({ title: "Invalid Address", description: "Please enter a valid Solana wallet address", variant: "destructive" }); return; } // Basic validation for Solana address (should be 32-44 characters) if (newWallet.length < 32 || newWallet.length > 44) { toast({ title: "Invalid Address Format", description: "Solana addresses should be 32-44 characters long", variant: "destructive" }); return; } if (wallets.includes(newWallet)) { toast({ title: "Wallet Already Added", description: "This wallet address is already in your target list", variant: "destructive" }); return; } setWallets([...wallets, newWallet]); setNewWallet(''); toast({ title: "Wallet Added", description: "Target wallet successfully added to monitoring list", }); }; const removeWallet = (wallet: string) => { setWallets(wallets.filter(w => w !== wallet)); toast({ title: "Wallet Removed", description: "Target wallet removed from monitoring list", }); }; // Mock data for demonstration const walletStats = { [wallets[0]]: { totalTrades: 156, profitLoss: 2341.56, successRate: 72.4, lastActive: '2 minutes ago' } }; return ( Target Wallets
setNewWallet(e.target.value)} className="flex-1" />
{wallets.length === 0 ? (

No target wallets added yet

Add wallet addresses to start copying trades

) : ( wallets.map((wallet, index) => (
#{index + 1} Active

{wallet.slice(0, 8)}...{wallet.slice(-8)}

{/* Mock stats for demonstration */} {walletStats[wallet] && (
{walletStats[wallet].totalTrades} trades
${walletStats[wallet].profitLoss.toFixed(2)}
Last active: {walletStats[wallet].lastActive}
)}
)) )}
); };