diff --git a/frontend/src/components/profile/ProfileHeader.jsx b/frontend/src/components/profile/ProfileHeader.jsx
index 2db7198..cab2d21 100644
--- a/frontend/src/components/profile/ProfileHeader.jsx
+++ b/frontend/src/components/profile/ProfileHeader.jsx
@@ -1,6 +1,5 @@
/* eslint-disable react/prop-types */
/* eslint-disable no-unused-vars */
-// frontend/src/components/profile/ProfileHeader.jsx
import React, { useState } from 'react';
import { Box, Avatar, IconButton } from '@mui/material';
import EditIcon from '@mui/icons-material/Edit';
@@ -8,14 +7,13 @@ import EditIcon from '@mui/icons-material/Edit';
const ProfileHeader = ({
coverLink,
photoLink,
- professorName, // Assuming name is passed for initials fallback
+ professorName,
onEditCover,
onViewCover,
onEditPhoto,
onViewPhoto,
}) => {
const [coverHover, setCoverHover] = useState(false);
- const [photoHover, setPhotoHover] = useState(false);
const getInitials = () => {
if (!professorName) return '?';
@@ -25,126 +23,141 @@ const ProfileHeader = ({
const initials = getInitials();
- const handleCoverMouseEnter = () => setCoverHover(true);
- const handleCoverMouseLeave = () => setCoverHover(false);
- const handlePhotoMouseEnter = () => setPhotoHover(true);
- const handlePhotoMouseLeave = () => setPhotoHover(false);
-
const handleCoverClick = () => {
- if (coverLink) { onViewCover(); }
- else { onEditCover(); }
+ if (coverLink && onViewCover) {
+ onViewCover();
+ } else if (onEditCover) {
+ onEditCover();
+ }
};
- // --- Modify handlePhotoClick ---
- const handlePhotoClick = (e) => { // Accept event 'e'
- e.stopPropagation(); // <<< ADD THIS LINE to stop bubbling
- if (photoLink) {
+ const handlePhotoClick = (e) => {
+ e.stopPropagation();
+ if (photoLink && onViewPhoto) {
onViewPhoto();
- } else {
+ } else if (onEditPhoto) {
onEditPhoto();
}
};
- // --- End modification ---
- const handleCoverEditButtonClick = (e) => { e.stopPropagation(); onEditCover(); };
- const handlePhotoEditButtonClick = (e) => { e.stopPropagation(); onEditPhoto(); };
+ const handleCoverEditButtonClick = (e) => {
+ e.stopPropagation();
+ if (onEditCover) {
+ onEditCover();
+ }
+ };
+
+ const handlePhotoEditButtonClick = (e) => {
+ e.stopPropagation();
+ if (onEditPhoto) {
+ onEditPhoto();
+ }
+ };
return (
setCoverHover(true)}
+ onMouseLeave={() => setCoverHover(false)}
>
- {/* Edit Cover Button (style should still work on dark bg) */}
-
-
-
+ {/* Edit Cover Button */}
+ {onEditCover && (
+
+
+
+ )}
- {/* Avatar */}
+ {/* Avatar with Edit Button */}
{!photoLink && initials}
- {/* Edit Photo Button (style should still work) */}
-
-
-
+
+ {/* Edit Icon on Avatar */}
+ {onEditPhoto && (
+
+
+
+ )}
);
};
-export default ProfileHeader;
\ No newline at end of file
+export default ProfileHeader;
diff --git a/frontend/src/pages/UserProfilePage.jsx b/frontend/src/pages/UserProfilePage.jsx
index 3159df0..277036f 100644
--- a/frontend/src/pages/UserProfilePage.jsx
+++ b/frontend/src/pages/UserProfilePage.jsx
@@ -220,9 +220,8 @@ const groupedDetailedExperiences = groupExperiencesByType(detailedExperiences);
coverLink={profileData.coverLink || null}
photoLink={profileData.photoLink || null}
professorName={profileData.name}
- onEditCover={() => {}} onViewCover={() => {}}
- onEditPhoto={() => {}} onViewPhoto={() => {}}
/>
+
{/* --- Tabs for Profile Sections --- */}