// // // reactstrap components
// // import {
// // Button,
// // Card,
// // CardHeader,
// // CardBody,
// // FormGroup,
// // Form,
// // Input,
// // Container,
// // Row,
// // Col,
// // } from "reactstrap";
// // // core components
// // import UserHeader from "components/Headers/UserHeader.js";
// // const Profile = () => {
// // return (
// // <>
// //
// // {/* Page content */}
// // {/*
// //
// //
// //
// //
// //
// //
// // My Profile Settings
// //
// //
// //
// //
// //
// //
// //
// //
// //
// // */}
// // >
// // );
// // };
// // export default Profile;
// import React from 'react';
// import { Link, useNavigate } from 'react-router-dom';
// import 'bootstrap/dist/css/bootstrap.min.css';
// const Profile = () => {
// const navigate = useNavigate();
// const handleLogout = () => {
// // Clear user session/token and redirect to login or homepage
// localStorage.removeItem("authToken");
// navigate('/auth/login');
// };
// return (
//
//
My Profile Settings
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
Password: Change Password for your account Change password
//
//
Security: Logout of all sessions except this current browser Logout other sessions
//
//
Deactivation: Remove access to all organizations and workspace in CloudnSure Deactivate account
//
// );
// };
// export default Profile;
import React, { useState, useRef } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.min.css';
const Profile = () => {
const navigate = useNavigate();
const [preview, setPreview] = useState(null);
const [selectedFile, setSelectedFile] = useState(null);
const fileInputRef = useRef(null);
const handleLogout = () => {
localStorage.removeItem("authToken");
navigate('/auth/login');
};
const handleFileChange = (e) => {
const file = e.target.files[0];
if (file) {
setSelectedFile(file);
const reader = new FileReader();
reader.onloadend = () => {
setPreview(reader.result);
};
reader.readAsDataURL(file);
}
};
const triggerFileInput = () => {
fileInputRef.current.click();
};
const handleCancel = () => {
setPreview(null);
setSelectedFile(null);
fileInputRef.current.value = '';
};
const handleUpload = () => {
if (!selectedFile) return;
// Here you would typically upload the file to your server
// For example:
// const formData = new FormData();
// formData.append('profileImage', selectedFile);
// fetch('/api/upload-profile-image', {
// method: 'POST',
// body: formData
// })
// .then(response => response.json())
// .then(data => {
// console.log('Upload successful', data);
// })
// .catch(error => {
// console.error('Upload error', error);
// });
alert('Upload functionality would go here');
};
return (
My Profile Settings
{/* Simple Image Upload Section */}
PROFILE PHOTO
{preview ? (

) : (
)}
{/* Action buttons - shown only when an image is selected */}
{preview && (
)}
{/* Rest of the profile form */}
Password: Change Password for your account Change password
Security: Logout of all sessions except this current browser Logout other sessions
Deactivation: Remove access to all organizations and workspace in CloudnSure Deactivate account
);
};
export default Profile;