Skip to content

Commit e0be0af

Browse files
authored
Merge pull request #26 from DevOps-Cloud-Team5/SCRUM-39-import-profile-page
fix profile page branch and fix profile page
2 parents d8f142e + e76ddea commit e0be0af

File tree

2 files changed

+85
-35
lines changed

2 files changed

+85
-35
lines changed

src/pages/profile/index.tsx

+33-12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { backend_get, deleteAuthCookies } from "../../utils";
99
import { useNavigate, useParams } from "react-router-dom";
1010
import { JwtPayload, jwtDecode } from "jwt-decode";
1111
import { CookieJWT } from "../../types/common";
12+
import { Button, capitalize } from "@mui/material";
1213

1314
const Profile = () => {
1415
const navigate = useNavigate();
@@ -20,7 +21,7 @@ const Profile = () => {
2021
role: "",
2122
first_name: "",
2223
last_name: "",
23-
avatarUrl: "https://randomuser.me/api/portraits/men/5.jpg"
24+
avatarUrl: ""
2425
});
2526

2627
const getProfileData = async () => {
@@ -37,6 +38,17 @@ const Profile = () => {
3738
const resp = await backend_get("user/get/" + username, true);
3839
return resp.json();
3940
};
41+
42+
const updateProfilePicture = async () => {
43+
console.log('Update Profile Picture function triggered');
44+
};
45+
46+
// const [loggedInUsername, setLoggedInUsername] = useState("");
47+
//store image inside a storage solution (S3 bucket)!
48+
// After, we collect the url from the s3
49+
// store url in database
50+
// it will be retrieved in getprofile data via url
51+
// 1 image per profile, therefore, override the previous one
4052

4153
useEffect(() => {
4254
const fetchUserProfile = async () => {
@@ -48,8 +60,7 @@ const Profile = () => {
4860
navigate(0);
4961
return;
5062
}
51-
// profile[0]["avaterUrl"] =
52-
// "https://randomuser.me/api/portraits/men/5.jpg";
63+
profile["avatarUrl"] = "https://randomuser.me/api/portraits/men/5.jpg";
5364
setProfileData(profile);
5465
} catch (error) {
5566
console.error("Error fetching profile:", error);
@@ -69,20 +80,30 @@ const Profile = () => {
6980
src={profileData.avatarUrl}
7081
alt="User Avatar"
7182
/>
83+
84+
7285
<div className="profile-info">
7386
<Typography component="h1" variant="h5">
7487
{profileData.first_name} {profileData.last_name}
7588
</Typography>
76-
<Typography component="p" variant="body1">
77-
Username: {profileData.username}
78-
</Typography>
79-
<Typography component="p" variant="body1">
80-
Email: {profileData.email}
81-
</Typography>
82-
<Typography component="p" variant="body1">
83-
Role: {profileData.role}
84-
</Typography>
89+
<p><span className="label">Username:</span>{profileData.username}</p>
90+
<p><span className="label">Email:</span>{profileData.email}</p>
91+
<p><span className="label">Role:</span>{capitalize(profileData.role)}</p>
92+
</div>
93+
94+
<div style={{ marginTop:"3%" }} >
95+
<Button variant="contained" sx={{ textTransform:"none" }}>
96+
Change Picture
97+
</Button>
98+
<Button variant="contained" sx={{ textTransform:"none" }}>
99+
Change Password
100+
</Button>
85101
</div>
102+
103+
<Button variant="contained" sx={{ marginTop:"3%", textTransform:"none" }}>
104+
Log Out
105+
</Button>
106+
86107
</div>
87108
</Container>
88109
</RootPage>

src/pages/profile/profile.css

+52-23
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,73 @@
1+
/* profile.css */
2+
13
.profile {
2-
background: rgba(
3-
255,
4-
255,
5-
255,
6-
0.1
7-
); /* Semi-transparent white for profile background */
8-
backdrop-filter: blur(5px); /* Blur effect for the background */
4+
margin: 0px 1em 1em -100px; /* Top, Right, Bottom, Left */
5+
min-width: 550px;
6+
min-height: 550px;
7+
background-color: transparent;
98
border-radius: 15px;
9+
padding: 2em;
1010
display: flex;
11+
flex-direction: column;
1112
align-items: center;
12-
padding: 2em;
13-
margin: 1em;
14-
gap: 1em;
13+
/* Set a min-width and min-height if necessary */
14+
15+
1516
}
1617

1718
.avatar {
18-
width: 100px;
19-
height: 100px;
19+
20+
width: 200px;
21+
height: 200px;
2022
border-radius: 50%;
21-
border: 3px solid #fff; /* White border for the avatar */
22-
box-shadow: 0 0 15px rgba(255, 255, 255, 0.3); /* subtle glow to the avatar */
23+
border: 5px solid #fff; /* White border for the avatar */
24+
box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); /* Enhanced glow effect for the avatar */
25+
/* margin-right: 2em; */
26+
/*Spacing between avatar and profile info*/
27+
margin-bottom: 20px;
2328
}
2429

2530
.profile-info {
26-
color: #fff; /* Light text for readability */
27-
}
28-
29-
.profile-info h1,
30-
.profile-info p {
31-
margin: 0.3em 0; /* Add some vertical spacing between text elements */
31+
min-width: 300px;
32+
background-color: #222; /* Dark background for profile info */
33+
border-radius: 10px;
34+
padding: 1.5em;
35+
color: #fff; /* White text for profile info */
36+
text-align: left;
3237
}
3338

3439
.profile-info h1 {
3540
color: #29b6f6; /* A brighter color for the user's name */
36-
font-size: 1.5em;
41+
font-size: 2.5em; /* Larger font size for the user's name */
42+
margin-bottom: 0.5em; /* Add some space below the name */
43+
font-weight: bold; /* Bold font for the name */
3744
}
3845

3946
.profile-info p {
47+
font-size: 1.3em; /* Slightly larger font size for other info */
48+
margin: 0.5em 0; /* Add spacing between elements */
49+
}
50+
51+
.label {
52+
font-weight: bold; /* Make the label text bold */
53+
color: #29b6f6; /* Set color for labels */
54+
margin-right: 0.5em; /* Add spacing between label and data */
55+
}
56+
57+
.update-btn {
58+
background-color: #29b6f6; /* Example primary color */
59+
color: white;
60+
border: none;
61+
border-radius: 4px;
62+
padding: 10px 20px;
4063
font-size: 1em;
41-
color: #bbb; /* Slightly dimmed color for less important text */
64+
cursor: pointer;
65+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
66+
transition: background-color 0.3s;
67+
outline: none;
68+
margin-bottom: 1em; /* Spacing between button and profile info */
4269
}
4370

44-
/* You can add more styles or customize the colors as you see fit */
71+
.update-btn:hover {
72+
background-color: #1c85c7; /* Darker shade for hover effect */
73+
}

0 commit comments

Comments
 (0)