// --- Settings Page Component ---
const SettingsPage = ({ onNavigate }) => {
const [profilePhoto, setProfilePhoto] = useState(null);
const [isSaving, setIsSaving] = useState(false);
const [saveSuccess, setSaveSuccess] = useState(false);
const [isEditing, setIsEditing] = useState(false);
const handlePhotoChange = (e) => {
const file = e.target.files[0];
if (file && (file.type === "image/jpeg" || file.type === "image/png" || file.type === "image/webp")) {
setProfilePhoto(file);
} else {
alert("Please upload a JPG, PNG, or WEBP file.");
}
};
const handleSaveSettings = () => {
setIsSaving(true);
setSaveSuccess(false);
setTimeout(() => {
setIsSaving(false);
setSaveSuccess(true);
setIsEditing(false);
setTimeout(() => setSaveSuccess(false), 3000);
}, 1500);
};
const companySettings = (
Company Settings
{!isEditing && (
setIsEditing(true)} whileHover={{ scale: 1.03 }} whileTap={{ scale: 0.98 }} style={{ backgroundColor: 'rgba(255,255,255,0.1)', color: 'white', padding: '0.5rem 1rem', borderRadius: '0.5rem', border: '1px solid rgba(255,255,255,0.2)', cursor: 'pointer' }}>
Edit Profile
)}
{isEditing ? (
) : (
GroupMoo
)}
{isEditing ? (
) : (
Roman Reigns
)}
{isEditing && (
<>
{isSaving && } {isSaving ? 'Saving...' : 'Save Settings'}
{saveSuccess && Settings Saved!}
>
)}
);
const profilePhotoSection = (
Profile Photo
{profilePhoto ? (
})
) : (

)}
);
return (
Settings
onNavigate('login')} whileHover={{ scale: 1.03 }} whileTap={{ scale: 0.98 }} style={{ backgroundColor: '#EF4444', color: 'white', display: 'flex', alignItems: 'center', padding: '0.75rem 1.5rem', borderRadius: '0.5rem', fontWeight: 'bold', cursor: 'pointer', border: 'none' }}>
Logout
{profilePhoto ? (
<>
{profilePhotoSection}
{companySettings}
>
) : (
<>
{companySettings}
{profilePhotoSection}
>
)}
);
};