"use client"; import { useState, useEffect } from 'react'; 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 { useSession } from 'next-auth/react'; import { toast } from 'sonner'; import { Settings, User, Bell, Shield, Trash2 } from 'lucide-react'; import { useParams, useRouter } from 'next/navigation'; import { WorkspaceKeysPanel } from '@/components/workspace/WorkspaceKeysPanel'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; interface WorkspaceSettings { name: string; description: string; createdAt: any; } export default function SettingsPage() { const params = useParams(); const router = useRouter(); const workspace = params.workspace as string; const { data: session, status } = useSession(); const [settings, setSettings] = useState(null); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); const [displayName, setDisplayName] = useState(''); const [email, setEmail] = useState(''); useEffect(() => { if (status === 'loading') return; setDisplayName(session?.user?.name ?? ''); setEmail(session?.user?.email ?? ''); setLoading(false); }, [session, status]); const handleSaveProfile = async () => { setSaving(true); try { if (!session?.user) { toast.error('Please sign in'); return; } toast.success('Profile updated successfully'); } catch (error) { console.error('Error saving profile:', error); toast.error('Failed to update profile'); } finally { setSaving(false); } }; return (
{/* Header */}

Settings

Manage your workspace and account preferences

{/* Profile Settings */}
Profile
Update your personal information
setDisplayName(e.target.value)} placeholder="Your display name" />

Email cannot be changed directly. Contact support if needed.

{/* Workspace Settings */}
Workspace
Configure workspace settings

Workspace identifier cannot be changed after creation

{settings?.createdAt && (

{new Date(settings.createdAt._seconds * 1000).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}

)}
{/* Workspace tenancy + AI access keys */} {/* Notifications */}
Notifications
Manage your notification preferences

Email Notifications

Receive updates via email

Session Summaries

Daily AI session summaries

{/* Security */}
Security
Manage your account security

Change Password

Update your account password

Two-Factor Authentication

Add an extra layer of security

{/* Danger Zone */}
Danger Zone
Irreversible and destructive actions
Are you absolutely sure? This action cannot be undone. This will permanently delete your workspace and all associated data. Cancel Delete Workspace
); }