import { useState } from 'react'; import { useForm } from 'react-hook-form'; import { useAuthStore, useUIStore } from '@/stores'; import toast from 'react-hot-toast'; import { Loader2, User, Building, Moon, Sun, Monitor } from 'lucide-react'; interface ProfileFormData { first_name: string; last_name: string; email: string; } export function GeneralSettings() { const { user } = useAuthStore(); const { theme, setTheme } = useUIStore(); const [isLoading, setIsLoading] = useState(false); const { register, handleSubmit, formState: { errors }, } = useForm({ defaultValues: { first_name: user?.first_name || '', last_name: user?.last_name || '', email: user?.email || '', }, }); const onSubmit = async (data: ProfileFormData) => { try { setIsLoading(true); // API call would go here await new Promise((resolve) => setTimeout(resolve, 1000)); toast.success('Profile updated successfully!'); } catch { toast.error('Failed to update profile'); } finally { setIsLoading(false); } }; const themes = [ { value: 'light', label: 'Light', icon: Sun }, { value: 'dark', label: 'Dark', icon: Moon }, { value: 'system', label: 'System', icon: Monitor }, ] as const; return (
{/* Profile Settings */}

Profile Information

{errors.first_name && (

{errors.first_name.message}

)}
{errors.last_name && (

{errors.last_name.message}

)}

Contact support to change your email address

{/* Organization Settings */}

Organization

Tenant ID

{user?.tenant_id || 'N/A'}

{/* Appearance Settings */}

Appearance

{themes.map((t) => ( ))}
); }