Skip to content

Commit

Permalink
EPMRPP-98421 || Code review fixes - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
iso9000t committed Jan 14, 2025
1 parent 2793e15 commit 98a74e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/src/layouts/common/appSidebar/userControl/userControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import classNames from 'classnames/bind';
import { FormattedMessage } from 'react-intl';
import { Image } from 'components/main/image';
import DefaultUserImage from 'common/img/default-user-avatar.png';
import { userInfoSelector } from 'controllers/user';
import { userInfoSelector, photoTimeStampSelector } from 'controllers/user';
import { URLS } from 'common/urls';
import { ADMINISTRATOR } from 'common/constants/accountRoles';
import { withPopover } from 'componentLibrary/popover';
Expand All @@ -33,13 +33,16 @@ const cx = classNames.bind(styles);

const UserControl = ({ onClick }) => {
const { userRole, fullName, email, id } = useSelector(userInfoSelector);
const photoTimeStamp = useSelector(photoTimeStampSelector);

const avatarUrl = `${URLS.userAvatar(id, true)}${photoTimeStamp ? `&ts=${photoTimeStamp}` : ''}`;

return (
<div className={cx('user-block-wrapper')} onClick={onClick}>
<button className={cx('avatar-block')}>
<Image
className={cx('avatar-img')}
src={URLS.userAvatar(id, true)}
src={avatarUrl}
alt="avatar"
fallback={DefaultUserImage}
/>
Expand All @@ -49,7 +52,6 @@ const UserControl = ({ onClick }) => {
<div className={cx('username-wrapper')}>
<div className={cx('username')}>{fullName}</div>
<div className={cx('arrow-icon')}>
{/* TODO: Need to manage this permission via common permission engine */}
{userRole === ADMINISTRATOR && (
<div className={cx('admin-badge')}>
<FormattedMessage id={'UserBlock.adminBadge'} defaultMessage={'admin'} />
Expand Down

0 comments on commit 98a74e9

Please sign in to comment.