import React, { useState } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { User, Bell, Shield, Palette, ChevronRight, ArrowLeft, Check, Moon, Sun, Laptop, Mail, Lock, Smartphone, Globe, Save, } from "lucide-react"; export type SettingsTab = "account" | "notifications" | "security" | "appearance"; export interface SettingsTabConfig { id: SettingsTab; label: string; description: string; icon: React.ReactNode; } const tabs: SettingsTabConfig[] = [ { id: "account", label: "Account", description: "Manage your personal profile and email preferences", icon: , }, { id: "notifications", label: "Notifications", description: "Customize alert channels and message frequency", icon: , }, { id: "security", label: "Security", description: "Configure two-factor authentication and passwords", icon: , }, { id: "appearance", label: "Appearance", description: "Adjust interface theme, density, and contrast", icon: , }, ]; const springPhysics = { type: "spring", stiffness: 380, damping: 26, }; export default function SettingsPage() { const [activeTab, setActiveTab] = useState("account"); // Controls mobile hub-and-spoke drill down vs menu view const [mobileDetailOpen, setMobileDetailOpen] = useState(false); const [savedSuccess, setSavedSuccess] = useState(false); // Form State const [name, setName] = useState("Jane Doe"); const [email, setEmail] = useState("jane.doe@example.com"); const [emailAlerts, setEmailAlerts] = useState(true); const [pushAlerts, setPushAlerts] = useState(true); const [twoFactor, setTwoFactor] = useState(false); const [theme, setTheme] = useState<"system" | "light" | "dark">("system"); const handleTabSelect = (tabId: SettingsTab) => { setActiveTab(tabId); setMobileDetailOpen(true); }; const handleSave = (e: React.FormEvent) => { e.preventDefault(); setSavedSuccess(true); setTimeout(() => setSavedSuccess(false), 2500); }; const activeTabConfig = tabs.find((t) => t.id === activeTab)!; return (
{/* Page Header */}

Settings & Preferences

Manage your account settings, security options, and UI preferences.

{/* Saved Toast Notification */} {savedSuccess && (
Changes saved successfully!
)}
{/* Layout Container: Desktop Grid vs Mobile Hub-and-Spoke */}
{/* Navigation Sidebar (Visible on desktop, or mobile when no detail open) */} {/* Content Spoke View (Desktop always shows active tab, Mobile shows when detailed open) */}
{/* Mobile Back Header */}
setMobileDetailOpen(false)} className="p-2 rounded-lg bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500" aria-label="Back to settings menu" >

{activeTabConfig.label}

{activeTabConfig.description}

{/* Tab Content Section */}
{/* Account Tab */} {activeTab === "account" && (

Account Profile

Update your personal information and account defaults.

setName(e.target.value)} className="w-full px-3.5 py-2.5 rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors" />
setEmail(e.target.value)} className="w-full pl-9 pr-3.5 py-2.5 rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors" />
)} {/* Notifications Tab */} {activeTab === "notifications" && (

Notification Preferences

Choose how and when you want to receive updates.

Email Digest Receive weekly summaries and account alerts via email.
Push Notifications Receive real-time mobile push notifications.
)} {/* Security Tab */} {activeTab === "security" && (

Security Settings

Keep your account secure with two-factor authentication.

Two-Factor Authentication (2FA) Require an authentication app code when signing in.
)} {/* Appearance Tab */} {activeTab === "appearance" && (

Appearance

Customize how StyleSeed UI renders on your device.

{[ { id: "light", label: "Light", icon: }, { id: "dark", label: "Dark", icon: }, { id: "system", label: "System", icon: }, ].map((mode) => ( ))}
)}
{/* Form Action Buttons */}
Save Changes
); }