Skip to content

Commit af7ceaf

Browse files
authored
feat(requests): add user's avatar next to Requested/Last Modified by icon (#1750)
* feat(requests): add user's avatar in front of Requested/Last Modified by * refactor(requests): wrap both the avatar and the username in Link * fix(requests): remove unnecessary margin between avatar and username
1 parent b4adfd2 commit af7ceaf

1 file changed

Lines changed: 33 additions & 10 deletions

File tree

src/components/RequestBlock/index.tsx

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Badge from '@app/components/Common/Badge';
22
import Button from '@app/components/Common/Button';
3+
import CachedImage from '@app/components/Common/CachedImage';
34
import Tooltip from '@app/components/Common/Tooltip';
45
import RequestModal from '@app/components/RequestModal';
56
import useRequestOverride from '@app/hooks/useRequestOverride';
@@ -95,36 +96,58 @@ const RequestBlock = ({ request, onUpdate }: RequestBlockProps) => {
9596
<div className="flex items-center justify-between">
9697
<div className="mr-6 min-w-0 flex-1 flex-col items-center text-sm leading-5">
9798
<div className="white mb-1 flex flex-nowrap">
98-
<Tooltip content={intl.formatMessage(messages.requestedby)}>
99-
<UserIcon className="mr-1.5 h-5 w-5 min-w-0 flex-shrink-0" />
100-
</Tooltip>
101-
<span className="w-40 truncate md:w-auto">
99+
<span className="flex w-40 items-center truncate md:w-auto">
100+
<Tooltip content={intl.formatMessage(messages.requestedby)}>
101+
<UserIcon className="mr-1.5 h-5 w-5 min-w-0 flex-shrink-0" />
102+
</Tooltip>
102103
<Link
103104
href={
104105
request.requestedBy.id === user?.id
105106
? '/profile'
106107
: `/users/${request.requestedBy.id}`
107108
}
108-
className="font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline"
109+
className="flex items-center font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline"
109110
>
111+
<span className="avatar-sm">
112+
<CachedImage
113+
type="avatar"
114+
src={request.requestedBy.avatar}
115+
alt=""
116+
className="avatar-sm object-cover"
117+
width={20}
118+
height={20}
119+
/>
120+
</span>
110121
{request.requestedBy.displayName}
111122
</Link>
112123
</span>
113124
</div>
114125
{request.modifiedBy && (
115126
<div className="flex flex-nowrap">
116-
<Tooltip content={intl.formatMessage(messages.lastmodifiedby)}>
117-
<EyeIcon className="mr-1.5 h-5 w-5 flex-shrink-0" />
118-
</Tooltip>
119-
<span className="w-40 truncate md:w-auto">
127+
<span className="flex w-40 items-center truncate md:w-auto">
128+
<Tooltip
129+
content={intl.formatMessage(messages.lastmodifiedby)}
130+
>
131+
<EyeIcon className="mr-1.5 h-5 w-5 flex-shrink-0" />
132+
</Tooltip>
120133
<Link
121134
href={
122135
request.modifiedBy.id === user?.id
123136
? '/profile'
124137
: `/users/${request.modifiedBy.id}`
125138
}
126-
className="font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline"
139+
className="flex items-center font-semibold text-gray-100 transition duration-300 hover:text-white hover:underline"
127140
>
141+
<span className="avatar-sm">
142+
<CachedImage
143+
type="avatar"
144+
src={request.modifiedBy.avatar}
145+
alt=""
146+
className="avatar-sm object-cover"
147+
width={20}
148+
height={20}
149+
/>
150+
</span>
128151
{request.modifiedBy.displayName}
129152
</Link>
130153
</span>

0 commit comments

Comments
 (0)