import { useState } from "react"; import { useAuth } from "@/context/AuthContext"; import { useTranslation } from "react-i18next"; import { useTheme } from "@/context/ThemeContext"; import { Card, CardContent, CardDescription, 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 { Switch } from "@/components/ui/switch"; import { Separator } from "@/components/ui/separator"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { LanguageSwitcher } from "@/components/LanguageSwitcher"; import { PageHeader } from "@/components/ui/page-header"; import { useToast } from "@/hooks/use-toast"; import Sidebar from "@/components/layout/Sidebar"; import { User, Bell, Shield, Palette, Moon, Sun, Globe, Download, Trash2 } from "lucide-react"; export default function SettingsPage() { const { user, updateProfile } = useAuth(); const { toast } = useToast(); const { t, i18n } = useTranslation(); const { theme, toggleTheme } = useTheme(); const [loading, setLoading] = useState(false); const [profile, setProfile] = useState({ username: user?.username || "", email: user?.email || "", fullName: user?.fullName || "", }); const [notifications, setNotifications] = useState({ emailNotifications: true, pushNotifications: true, taskReminders: true, financialAlerts: true, }); const handleProfileUpdate = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); try { await updateProfile(profile); toast({ title: "Profile updated", description: "Your profile has been successfully updated.", }); } catch (error) { toast({ title: "Error", description: "Failed to update profile. Please try again.", variant: "destructive", }); } finally { setLoading(false); } }; return (
Profile Notifications Security Appearance Profile Information Update your personal information and account details.
setProfile({ ...profile, username: e.target.value })} />
setProfile({ ...profile, email: e.target.value })} />
setProfile({ ...profile, fullName: e.target.value })} />
Notification Preferences Choose what notifications you want to receive.

Receive notifications via email

setNotifications({ ...notifications, emailNotifications: checked }) } />

Receive push notifications in your browser

setNotifications({ ...notifications, pushNotifications: checked }) } />

Get reminded about upcoming tasks and deadlines

setNotifications({ ...notifications, taskReminders: checked }) } />

Receive alerts about financial goals and budgets

setNotifications({ ...notifications, financialAlerts: checked }) } />
Security Settings Manage your account security and privacy settings.
Appearance Settings Customize the look and feel of your application.

Switch between light and dark themes

Choose your preferred language

); }