Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ const MyHall = () => {
}
}, [profile]);

// Refactored to follow the Single Responsibility Principle
const generateRDProfileLink = (email) => {
if (!email) return DEFAULT_PROFILE_URL;
const [firstName, lastName] = rdInfo.RD_Email.split('@')[0].split('.');
return DEFAULT_PROFILE_URL + `${firstName}.${lastName}`;
};

useEffect(() => {
if (rdInfo?.RD_Email) {
const [firstName, lastName] = rdInfo.RD_Email.split('@')[0].split('.');
setRdProfileLink(DEFAULT_PROFILE_URL + `${firstName}.${lastName}`);
}
setRdProfileLink(generateRDProfileLink(rdInfo?.RD_Email));
}, [rdInfo]);

// Show loading state if profile is not yet loaded
Expand Down Expand Up @@ -144,7 +148,13 @@ const MyHall = () => {
</Typography>

<Typography variant="body1">
<strong>My Assigned Rooms:</strong> {isRA ? <AssignedRooms /> : <></>}
{isRA ? (
<strong>
My Assigned Rooms: <AssignedRooms />{' '}
</strong>
) : (
<></>
)}
</Typography>
</Grid>

Expand Down
Loading