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 { 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 [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 (
Manage your account settings and preferences
Receive notifications via email
Receive push notifications in your browser
Get reminded about upcoming tasks and deadlines
Receive alerts about financial goals and budgets
Switch between light and dark themes