Skip to content

Commit 5af69d1

Browse files
committed
Fix admin feedback width and profile pic hover
1 parent a061c5d commit 5af69d1

File tree

3 files changed

+45
-22
lines changed

3 files changed

+45
-22
lines changed

frontend/src/components/common/navbar/UserButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import ResetPassword from "../../auth/ResetPassword";
55
import Logout from "../../auth/Logout";
66
import MyAccountButton from "../../auth/MyAccountButton";
77
import ProfilePicture from "../../profile/ProfilePicture";
8+
import { useUser } from "../../../hooks/useUser";
89

910
const UserButton = () => {
1011
const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(
1112
null,
1213
);
1314
const theme = useTheme();
15+
const { profilePicture } = useUser();
1416

1517
const open = Boolean(anchorEl);
1618
const id = open ? "simple-popover" : undefined;
@@ -31,7 +33,7 @@ const UserButton = () => {
3133
onClick={handleClick}
3234
sx={{ color: theme.palette.Neutral[400] }}
3335
>
34-
<ProfilePicture size={24} />
36+
<ProfilePicture size={24} sourceUrl={profilePicture} />
3537
</IconButton>
3638
<Popover
3739
id={id}

frontend/src/components/feedback/feedback-admin-view/FeedbackAdminView.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,19 @@ const FeedbackAdminView = () => {
212212
<Stack
213213
direction="column"
214214
gap="32px"
215+
width="100%"
215216
padding="48px"
216217
alignItems="flex-start"
217218
flex="1 0 0"
218219
alignSelf="stretch"
219220
sx={{ overflow: "auto", minHeight: 0 }}
220221
>
221-
<Stack direction="column" alignItems="flex-start" gap="16px">
222+
<Stack
223+
direction="column"
224+
alignItems="flex-start"
225+
gap="16px"
226+
width="100%"
227+
>
222228
<Stack direction="row" justifyContent="space-between" width="100%">
223229
<Stack
224230
direction="column"

frontend/src/components/profile/ProfilePicture.tsx

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@ const ProfilePicture = ({
2121
return (
2222
<Box
2323
sx={{
24+
position: "relative",
2425
display: "flex",
2526
width: `${size}px`,
2627
height: `${size}px`,
2728
justifyContent: "center",
2829
alignItems: "center",
2930
borderRadius: "5000px",
31+
cursor: setUploadModalOpen ? "pointer" : "default",
32+
...(!!setUploadModalOpen && {
33+
"&:hover .avatar-overlay": {
34+
opacity: 1,
35+
},
36+
"&:hover .avatar-text": {
37+
display: "none",
38+
},
39+
}),
3040
}}
3141
onClick={() => {
3242
if (setUploadModalOpen) {
@@ -39,23 +49,11 @@ const ProfilePicture = ({
3949
width: "100%",
4050
height: "100%",
4151
bgcolor: theme.palette[user.role].Light.Hover,
42-
...(!!setUploadModalOpen && {
43-
"&:hover": {
44-
backgroundColor: "rgba(0, 0, 0, 0.6)",
45-
46-
"& .avatar-text": {
47-
display: "none",
48-
},
49-
50-
"& .camera-icon": {
51-
display: "block",
52-
},
53-
},
54-
}),
5552
}}
5653
src={sourceUrl}
5754
>
5855
<Typography
56+
className="avatar-text"
5957
sx={{
6058
color: theme.palette[user.role].Dark.Default,
6159
fontSize: 0.375 * size,
@@ -65,16 +63,33 @@ const ProfilePicture = ({
6563
>
6664
{`${user.firstName.charAt(0) || ""}${user.lastName.charAt(0) || ""}`}
6765
</Typography>
68-
<CameraAlt
69-
className="camera-icon"
66+
</Avatar>
67+
{!!setUploadModalOpen && (
68+
<Box
69+
className="avatar-overlay"
7070
sx={{
7171
position: "absolute",
72-
display: "none",
73-
color: "white",
74-
fontSize: 0.4 * size,
72+
top: 0,
73+
left: 0,
74+
width: "100%",
75+
height: "100%",
76+
borderRadius: "50%",
77+
backgroundColor: "rgba(0, 0, 0, 0.6)",
78+
display: "flex",
79+
justifyContent: "center",
80+
alignItems: "center",
81+
opacity: 0,
82+
transition: "opacity 0.2s",
7583
}}
76-
/>
77-
</Avatar>
84+
>
85+
<CameraAlt
86+
sx={{
87+
color: "white",
88+
fontSize: 0.4 * size,
89+
}}
90+
/>
91+
</Box>
92+
)}
7893
</Box>
7994
);
8095
};

0 commit comments

Comments
 (0)