import React, { useState } from 'react'; import { Card } from '../../ui/card'; import { Button } from '../../ui/button'; import { useTheme } from '../../../context/ThemeContext'; import { ThemeVariant } from '../../../types'; import { Mail, User, Globe, Bell, Lock, ShieldAlert, Monitor, Moon, Sun, Laptop, } from 'lucide-react'; import { ChangeEmailModal } from './ChangeEmailModal'; import { ChangeUsernameModal } from './ChangeUsernameModal'; import { DeleteAccountView } from './DeleteAccountView'; import { useToast } from '../../../context/ToastContext'; import { Switch } from '../../ui/switch'; export const AccountSettings: React.FC = () => { const { theme, setTheme } = useTheme(); const { addToast } = useToast(); // State for sub-views and modals const [view, setView] = useState<'main' | 'delete'>('main'); const [showEmailModal, setShowEmailModal] = useState(false); const [showUsernameModal, setShowUsernameModal] = useState(false); // Mock User Data const [user] = useState({ username: 'Cyber_Producer', email: 'alex@veza.io', language: 'English (US)', }); // Toggles State const [toggles, setToggles] = useState({ emailNotif: true, pushNotif: true, publicProfile: true, showActivity: true, }); const toggle = (key: keyof typeof toggles) => { setToggles((prev) => ({ ...prev, [key]: !prev[key] })); addToast('Settings updated', 'info'); }; if (view === 'delete') { return ( setView('main')} onLogout={() => window.location.reload()} /> ); } return (
{/* 1. IDENTITY SECTION */}

Identity & Login

Email Address
{user.email}
Username
@{user.username}
{/* 2. PREFERENCES SECTION */}

Preferences

{[ { id: ThemeVariant.NEON, label: 'Dark', icon: , }, { id: ThemeVariant.LIGHT, label: 'Light', icon: , }, { id: ThemeVariant.GAMING, label: 'Game', icon: , }, ].map((opt) => ( ))}
{/* 3. NOTIFICATIONS & PRIVACY */}

Notifications

Email Notifications toggle('emailNotif')} />
Push Notifications toggle('pushNotif')} />

Privacy

Public Profile Allow others to find you
toggle('publicProfile')} />
Activity Status Show when you are online
toggle('showActivity')} />
{/* 4. DANGER ZONE */}

Danger Zone

Irreversible actions. Proceed with caution.

Delete Account
Permanently remove your account and all data.
{/* MODALS */} {showEmailModal && ( setShowEmailModal(false)} currentEmail={user.email} /> )} {showUsernameModal && ( setShowUsernameModal(false)} currentUsername={user.username} /> )}
); };