diff --git a/client/src/features/trainee-profile/TraineePage.tsx b/client/src/features/trainee-profile/TraineePage.tsx index ebb89ebc..bdf77f2d 100644 --- a/client/src/features/trainee-profile/TraineePage.tsx +++ b/client/src/features/trainee-profile/TraineePage.tsx @@ -1,7 +1,7 @@ import { ErrorBox, Loader } from '../../components'; import { Box } from '@mui/material'; -import TraineeProfile from './profile/components/TraineeProfile'; +import { TraineeProfile } from './profile/components/TraineeProfile'; import { TraineeProfileProvider } from './context/useTraineeProfileProvider'; import { useParams } from 'react-router-dom'; import { useTraineeInfoData } from './personal-info/data/useTraineeInfoData'; diff --git a/client/src/features/trainee-profile/profile/ProfileSidebar.tsx b/client/src/features/trainee-profile/profile/ProfileSidebar.tsx index 1fb181db..ff7219be 100644 --- a/client/src/features/trainee-profile/profile/ProfileSidebar.tsx +++ b/client/src/features/trainee-profile/profile/ProfileSidebar.tsx @@ -1,12 +1,12 @@ -import { Avatar, Box, IconButton, Link, Stack, Typography } from '@mui/material'; - -import { LearningStatus } from '../../../data/types/Trainee'; -import LinkedInLogo from '../../../assets/LinkedIn_logo.png'; +import { Box, IconButton, Link, Stack, Typography } from '@mui/material'; import { SidebarJobPath } from '../../../components/SidebarJobPath'; import { SidebarLearningStatus } from '../../../components/SidebarLearningStatus'; +import { LearningStatus } from '../../../data/types/Trainee'; +import LinkedInLogo from '../../../assets/LinkedIn_logo.png'; import githubLogo from '../../../assets/github.png'; import slackLogo from '../../../assets/slack.png'; import { useTraineeInfoData } from '../personal-info/data/useTraineeInfoData'; +import { ProfilePictureModal } from './components/ProfilePictureModal'; interface ProfileSidebarProps { traineeId: string; @@ -18,7 +18,7 @@ interface ProfileSidebarProps { * @param {string} traineeId trainee id. * @returns {ReactNode} A React element that renders profile page sidebar information and profile image. */ -const ProfileSidebar = ({ traineeId }: ProfileSidebarProps) => { +export const ProfileSidebar = ({ traineeId }: ProfileSidebarProps) => { const { data } = useTraineeInfoData(traineeId); const slackId = data?.contactInfo?.slackId; @@ -26,68 +26,70 @@ const ProfileSidebar = ({ traineeId }: ProfileSidebarProps) => { const linkedIn = data?.contactInfo?.linkedin; return ( - - {/* Profile image */} - - - + <> + + null} + onConfirmationDialogOpen={() => null} + /> - - {/* Name */} - - {data?.displayName} - - {/* Pronouns */} - - {data?.personalInfo?.pronouns} - - {/* Learning Status */} - {data?.educationInfo?.learningStatus === LearningStatus.Graduated ? ( - - ) : ( - - )} - {/* Cohort */} - - Cohort {data?.educationInfo?.currentCohort || 'not assigned'} - - - - {/* social media contact info */} - - {slackId && ( - - - - - - )} - {githubHandle && ( - - - - - - )} - {linkedIn && ( - - - - - - )} - - + + {/* Name */} + + {data?.displayName} + + {/* Pronouns */} + + {data?.personalInfo?.pronouns} + + {/* Learning Status */} + {data?.educationInfo?.learningStatus === LearningStatus.Graduated ? ( + + ) : ( + + )} + {/* Cohort */} + + Cohort {data?.educationInfo?.currentCohort || 'not assigned'} + + + {/* social media contact info */} + + {slackId && ( + + + + + + )} + {githubHandle && ( + + + + + + )} + {linkedIn && ( + + + + + + )} + + + > ); }; -export default ProfileSidebar; diff --git a/client/src/features/trainee-profile/profile/components/ProfilePictureModal.tsx b/client/src/features/trainee-profile/profile/components/ProfilePictureModal.tsx new file mode 100644 index 00000000..4cc58d5f --- /dev/null +++ b/client/src/features/trainee-profile/profile/components/ProfilePictureModal.tsx @@ -0,0 +1,88 @@ +import { Avatar, Box, Fade, IconButton } from '@mui/material'; +import React from 'react'; +import EditIcon from '@mui/icons-material/Edit'; +import DeleteIcon from '@mui/icons-material/Delete'; + +interface ProfilePictureModalProps { + imageUrl?: string | undefined; + displayName?: string | undefined; + onUploadModalOpen: () => void; + onConfirmationDialogOpen: () => void; +} + +export const ProfilePictureModal = ({ + imageUrl, + displayName, + onUploadModalOpen, + onConfirmationDialogOpen, +}: ProfilePictureModalProps) => { + const [isHovering, setIsHovering] = React.useState(false); + + return ( + { + setIsHovering(true); + }} + onMouseLeave={() => { + setIsHovering(false); + }} + height={180} + width={180} + display="flex" + justifyContent="center" + position="relative" + > + + + {isHovering && ( + + + + + + + + + + + + + )} + + ); +}; diff --git a/client/src/features/trainee-profile/profile/components/TraineeProfile.tsx b/client/src/features/trainee-profile/profile/components/TraineeProfile.tsx index d85bd930..85f212c4 100644 --- a/client/src/features/trainee-profile/profile/components/TraineeProfile.tsx +++ b/client/src/features/trainee-profile/profile/components/TraineeProfile.tsx @@ -14,7 +14,7 @@ import InteractionsInfo from '../../interactions/InteractionsInfo'; import MuiAlert from '@mui/material/Alert'; import PersonalInfo from '../../personal-info/PersonalInfo'; import ProfileNav from './ProfileNav'; -import ProfileSidebar from '../ProfileSidebar'; +import { ProfileSidebar } from '../ProfileSidebar'; import { Trainee } from '../../../../data/types/Trainee'; import { useQueryClient } from '@tanstack/react-query'; import { useTraineeProfileContext } from '../../context/useTraineeProfileContext'; @@ -29,7 +29,7 @@ interface TraineeProfileProps { * @param {string} id trainee id. * @returns {ReactNode} A React element that renders profile page tabs and sidebar. */ -const TraineeProfile = ({ id }: TraineeProfileProps) => { +export const TraineeProfile = ({ id }: TraineeProfileProps) => { // Default active tab const [activeTab, setActiveTab] = useState('personal'); const { data: traineeData } = useTraineeInfoData(id); @@ -141,5 +141,3 @@ const TraineeProfile = ({ id }: TraineeProfileProps) => { ); }; - -export default TraineeProfile;