"use client"; import { useState } from "react"; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Switch } from "@/components/ui/switch"; import { Badge } from "@/components/ui/badge"; import { User, Shield, Target, Bell, Save, Loader2 } from "lucide-react"; export interface UserProfile { riskTolerance: "conservative" | "moderate" | "aggressive"; investmentStyle: "day_trader" | "swing" | "long_term"; preferredChains: string[]; notifications: { priceAlerts: boolean; whaleAlerts: boolean; newsAlerts: boolean; }; } interface UserProfileSectionProps { profile: UserProfile; onSave: (profile: UserProfile) => void; } const CHAINS = ["solana", "ethereum", "base", "arbitrum", "polygon"]; export function UserProfileSection({ profile: initialProfile, onSave }: UserProfileSectionProps) { const [profile, setProfile] = useState(initialProfile); const [isSaving, setIsSaving] = useState(false); const [hasChanges, setHasChanges] = useState(false); const updateProfile = (updates: Partial) => { setProfile((prev) => ({ ...prev, ...updates })); setHasChanges(true); }; const toggleChain = (chain: string) => { const newChains = profile.preferredChains.includes(chain) ? profile.preferredChains.filter((c) => c !== chain) : [...profile.preferredChains, chain]; updateProfile({ preferredChains: newChains }); }; const handleSave = async () => { setIsSaving(true); await new Promise((resolve) => setTimeout(resolve, 500)); onSave(profile); setIsSaving(false); setHasChanges(false); }; return ( Investment Profile Configure your risk preferences and notification settings {/* Risk Tolerance */}
{/* Investment Style */}
{/* Preferred Chains */}
{CHAINS.map((chain) => ( toggleChain(chain)} > {chain} ))}
{/* Notifications */}
Price Alerts updateProfile({ notifications: { ...profile.notifications, priceAlerts: v } })} />
Whale Activity Alerts updateProfile({ notifications: { ...profile.notifications, whaleAlerts: v } })} />
News & Updates updateProfile({ notifications: { ...profile.notifications, newsAlerts: v } })} />
{/* Save Button */}
); }