'use client' import { useAuth } from '@thedaviddias/auth' import { Button } from '@thedaviddias/design-system/button' import { ArrowLeft, Bell, Github, Shield, User } from 'lucide-react' import Link from 'next/link' import { usePathname, useRouter } from 'next/navigation' import { useEffect } from 'react' import { Card } from '@/components/ui/card' import { analytics } from '@/lib/analytics' const settingsNavigation = [ { name: 'Account', href: '/settings/account', icon: User, description: 'Personal info and security' }, { name: 'Integrations', href: '/settings/integrations', icon: Github, description: 'Connected services' }, { name: 'Privacy', href: '/settings/privacy', icon: Shield, description: 'Data and privacy controls' }, { name: 'Notifications', href: '/settings/notifications', icon: Bell, description: 'Email and alert preferences' } ] interface SettingsLayoutProps { children: React.ReactNode } export default function SettingsLayout({ children }: SettingsLayoutProps) { const { user, isLoaded } = useAuth() const router = useRouter() const pathname = usePathname() // Redirect if not authenticated (but only after auth has loaded) useEffect(() => { if (isLoaded && !user) { router.push('/login?message=Please sign in to access settings') } }, [isLoaded, user, router]) // Show loading state while auth is loading or user is not yet available if (!isLoaded || !user) { return (
Manage your account settings and preferences