import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useTheme } from '../contexts/ThemeContext'; import { useAuth } from '../contexts/AuthContext'; import Sidebar from '../components/figma/Sidebar'; import { Button } from '../components/UiKit'; import { Theme } from '../types'; interface UserProfile { fullName: string; email: string; profilePicture?: string; } type ThemeMode = 'system' | 'light' | 'dark'; const SettingsNew: React.FC = () => { const { theme, setTheme } = useTheme(); const { user } = useAuth(); const navigate = useNavigate(); const [activeTab, setActiveTab] = useState<'general' | 'billing'>('general'); const [userProfile, setUserProfile] = useState({ fullName: 'John Doe', email: 'Johndoe1234@gmail.com' }); const [selectedTheme, setSelectedTheme] = useState('light'); const handleProfileUpdate = (field: keyof UserProfile, value: string) => { setUserProfile(prev => ({ ...prev, [field]: value })); }; const handlePhotoUpload = () => { // In a real app, this would open a file picker alert('Photo upload functionality would be implemented here'); }; const handleSaveChanges = () => { // In a real app, this would save to backend alert('Settings saved successfully!'); }; const handleReset = () => { setUserProfile({ fullName: 'John Doe', email: 'Johndoe1234@gmail.com' }); setSelectedTheme('light'); }; if (!user) { navigate('/login'); return null; } return (
{/* Tab Navigation */}
setActiveTab('general')} className={`w-32 inline-flex flex-col justify-start items-start gap-3 cursor-pointer ${activeTab === 'general' ? '' : 'opacity-60' }`} >
General Settings
{activeTab === 'general' && (
)}
setActiveTab('billing')} className={`inline-flex flex-col justify-start items-start gap-3 cursor-pointer ${activeTab === 'billing' ? '' : 'opacity-60' }`} >
Plan & Billings
{activeTab === 'billing' && (
)}
{/* General Settings Content */} {activeTab === 'general' && ( <> {/* Profile Information Section */}
Profile Information
Update your personal details, and keep your profile up to date.
{/* Profile Picture Section */}
Profile Picture
PNG, JPEG, GIF Under 10MB
Upload Photo
{/* Name and Email Fields */}
Full Name
handleProfileUpdate('fullName', e.target.value)} className="flex-1 bg-transparent text-[--Neutrals-NeutralSlate950] text-sm font-normal font-['Inter'] leading-tight outline-none" />
Email Address
handleProfileUpdate('email', e.target.value)} className="flex-1 bg-transparent text-[--Neutrals-NeutralSlate950] text-sm font-normal font-['Inter'] leading-tight outline-none" />
{/* Divider */}
{/* Theme Customization Section */}
Theme Customization
Personalize your interface with light or dark mode and enhance your visual experience.
{/* System Preference */}
setSelectedTheme('system')} className={`max-w-60 inline-flex flex-col justify-start items-start gap-3 cursor-pointer ${selectedTheme === 'system' ? 'opacity-100' : 'opacity-70' }`} >
System preference
{/* Light Mode */}
setSelectedTheme('light')} className={`w-48 max-w-60 inline-flex flex-col justify-start items-start gap-3 cursor-pointer ${selectedTheme === 'light' ? 'opacity-100' : 'opacity-70' }`} >
Light Mode
{/* Dark Mode */}
setSelectedTheme('dark')} className={`max-w-60 inline-flex flex-col justify-start items-start gap-3 cursor-pointer ${selectedTheme === 'dark' ? 'opacity-100' : 'opacity-70' }`} >
Dark Mode
{/* Another Divider */}
{/* Action Buttons */}
Reset
Save Changes
)} {/* Billing Content */} {activeTab === 'billing' && (

Plan & Billing

Billing management features would be implemented here.

)}
); }; export default SettingsNew;