2025-06-04 14:14:15 +05:30
// // // reactstrap components
// // import {
// // Button,
// // Card,
// // CardHeader,
// // CardBody,
// // FormGroup,
// // Form,
// // Input,
// // Container,
// // Row,
// // Col,
// // } from "reactstrap";
// // // core components
// // import UserHeader from "components/Headers/UserHeader.js";
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// // const Profile = () => {
// // return (
// // <>
// // <UserHeader />
// // {/* Page content */}
// // {/* <Container className="mt--7" fluid>
// // <Row>
// // <Col xl="12">
// // <Card className="bg-secondary shadow">
// // <CardHeader className="bg-white border-0">
// // <Row className="align-items-center">
// // <Col xs="8">
// // <h3 className="mb-0">My Profile Settings</h3>
// // </Col>
// // </Row>
// // </CardHeader>
// // <CardBody>
// // <Form>
// // <Row>
// // <Col md="6">
// // <FormGroup>
// // <label>Your Full Name</label>
// // <Input placeholder="Enter full name" type="text" />
// // </FormGroup>
// // </Col>
// // <Col md="6">
// // <FormGroup>
// // <label>Pronouns</label>
// // <Input placeholder="Enter pronouns" type="text" />
// // </FormGroup>
// // </Col>
// // </Row>
// // <Row>
// // <Col md="6">
// // <FormGroup>
// // <label>Role</label>
// // <Input placeholder="Enter role" type="text" />
// // </FormGroup>
// // </Col>
// // <Col md="6">
// // <FormGroup>
// // <label>Department or Team</label>
// // <Input placeholder="Enter department" type="text" />
// // </FormGroup>
// // </Col>
// // </Row>
// // <Row>
// // <Col md="12">
// // <FormGroup>
// // <label>Email</label>
// // <Input placeholder="Enter email" type="email" />
// // </FormGroup>
// // </Col>
// // </Row>
// // <FormGroup>
// // <label>About Me</label>
// // <Input
// // type="textarea"
// // rows="4"
// // placeholder="Enter description"
// // />
// // </FormGroup>
// // <Button color="primary" type="submit">
// // Update
// // </Button>
// // </Form>
// // </CardBody>
// // </Card>
// // </Col>
// // </Row>
// // </Container>*/}
// // </>
// // );
// // };
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// // export default Profile;
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// import React from 'react';
// import { Link, useNavigate } from 'react-router-dom';
// import 'bootstrap/dist/css/bootstrap.min.css';
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// const Profile = () => {
// const navigate = useNavigate();
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// const handleLogout = () => {
// // Clear user session/token and redirect to login or homepage
// localStorage.removeItem("authToken");
// navigate('/auth/login');
// };
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// return (
// <div className="container mt-5">
// <h3 className="mb-4">My Profile Settings</h3>
2025-04-01 20:28:04 +05:30
2025-06-04 14:14:15 +05:30
// <div className="mb-3">
// <label>Your Full Name</label>
// <input type="text" className="form-control" value="sysadmin" readOnly />
// </div>
// <div className="mb-3">
// <label>Pronouns</label>
// <input type="text" className="form-control" placeholder="Enter Pronouns" />
// </div>
// <div className="mb-3">
// <label>Role</label>
// <input type="text" className="form-control" placeholder="Enter Role" />
// </div>
// <div className="mb-3">
// <label>Department or Team</label>
// <input type="text" className="form-control" placeholder="Enter Department" />
// </div>
// <div className="mb-3">
// <label>Email</label>
// <input type="email" className="form-control" value="sysadmin" readOnly />
// </div>
// <div className="mb-3">
// <label>About Me</label>
// <textarea className="form-control" placeholder="Enter Description"></textarea>
// </div>
// <button
// className="btn btn-primary mb-4"
// onClick={() => navigate('/error404')}
// >
// Update
// </button>
// <hr />
// <p><strong>Password:</strong> Change Password for your account <Link to="/auth/resetpassword">Change password</Link></p>
// <hr />
// <p><strong>Security:</strong> Logout of all sessions except this current browser <span style={{ color: 'blue', cursor: 'pointer' }} onClick={handleLogout}>Logout other sessions</span></p>
// <hr />
// <p><strong>Deactivation:</strong> Remove access to all organizations and workspace in CloudnSure <span style={{ color: 'blue', cursor: 'pointer' }} onClick={handleLogout}>Deactivate account</span></p>
// </div>
// );
// };
// export default Profile;
import React , { useState , useRef } from 'react' ;
import { Link , useNavigate } from 'react-router-dom' ;
import 'bootstrap/dist/css/bootstrap.min.css' ;
2025-04-01 20:28:04 +05:30
const Profile = ( ) => {
2025-06-04 14:14:15 +05:30
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' ) ;
} ;
2025-04-01 20:28:04 +05:30
return (
2025-06-04 14:14:15 +05:30
< div className = "container mt-5" >
< h3 className = "mb-4" > My Profile Settings < / h 3 >
{ /* Simple Image Upload Section */ }
< div className = "mb-4" >
< h5 > PROFILE PHOTO < / h 5 >
< div className = "d-flex align-items-center mb-3" >
< div className = "me-3" >
{ preview ? (
< img
src = { preview }
alt = "Profile Preview"
style = { { width : '100px' , height : '100px' , borderRadius : '50%' , objectFit : 'cover' } }
/ >
) : (
< div style = { { width : '100px' , height : '100px' , borderRadius : '50%' , backgroundColor : '#f0f0f0' } } > < / d i v >
) }
< / d i v >
< div >
< input
type = "file"
ref = { fileInputRef }
onChange = { handleFileChange }
accept = "image/*"
style = { { display : 'none' } }
/ >
< button className = "btn btn-outline-primary" onClick = { triggerFileInput } >
Choose File
< / b u t t o n >
< / d i v >
< / d i v >
{ /* Action buttons - shown only when an image is selected */ }
{ preview && (
< div className = "d-flex justify-content-end gap-2 mt-3" >
< button className = "btn btn-outline-secondary" onClick = { handleCancel } >
Cancel
< / b u t t o n >
< button className = "btn btn-primary" onClick = { handleUpload } >
Upload
< / b u t t o n >
< / d i v >
) }
< / d i v >
{ /* Rest of the profile form */ }
< div className = "mb-3" >
< label > Your Full Name < / l a b e l >
< input type = "text" className = "form-control" value = "sysadmin" readOnly / >
< / d i v >
< div className = "mb-3" >
< label > Pronouns < / l a b e l >
< input type = "text" className = "form-control" placeholder = "Enter Pronouns" / >
< / d i v >
< div className = "mb-3" >
< label > Role < / l a b e l >
< input type = "text" className = "form-control" placeholder = "Enter Role" / >
< / d i v >
< div className = "mb-3" >
< label > Department or Team < / l a b e l >
< input type = "text" className = "form-control" placeholder = "Enter Department" / >
< / d i v >
< div className = "mb-3" >
< label > Email < / l a b e l >
< input type = "email" className = "form-control" value = "sysadmin" readOnly / >
< / d i v >
< div className = "mb-3" >
< label > About Me < / l a b e l >
< textarea className = "form-control" placeholder = "Enter Description" > < / t e x t a r e a >
< / d i v >
< button
className = "btn btn-primary mb-4"
onClick = { ( ) => navigate ( '/error404' ) }
>
Update Profile
< / b u t t o n >
< hr / >
< p > < strong > Password : < / s t r o n g > C h a n g e P a s s w o r d f o r y o u r a c c o u n t < L i n k t o = " / a d m i n / r e s e t p a s s w o r d " > C h a n g e p a s s w o r d < / L i n k > < / p >
< hr / >
< p > < strong > Security : < / s t r o n g > L o g o u t o f a l l s e s s i o n s e x c e p t t h i s c u r r e n t b r o w s e r < s p a n s t y l e = { { c o l o r : ' b l u e ' , c u r s o r : ' p o i n t e r ' } } o n C l i c k = { h a n d l e L o g o u t } > L o g o u t o t h e r s e s s i o n s < / s p a n > < / p >
< hr / >
< p > < strong > Deactivation : < / s t r o n g > R e m o v e a c c e s s t o a l l o r g a n i z a t i o n s a n d w o r k s p a c e i n C l o u d n S u r e < s p a n s t y l e = { { c o l o r : ' b l u e ' , c u r s o r : ' p o i n t e r ' } } o n C l i c k = { h a n d l e L o g o u t } > D e a c t i v a t e a c c o u n t < / s p a n > < / p >
< / d i v >
2025-04-01 20:28:04 +05:30
) ;
} ;
2025-06-04 14:14:15 +05:30
export default Profile ;