refactor(ui): Display user avatars in request list (#848)

pull/849/head
TheCatLady 4 years ago committed by GitHub
parent 3f9bfeb01a
commit eedadb8884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,7 +27,6 @@ import { useToasts } from 'react-toast-notifications';
import RequestModal from '../../RequestModal'; import RequestModal from '../../RequestModal';
const messages = defineMessages({ const messages = defineMessages({
requestedby: 'Requested by {username}',
seasons: 'Seasons', seasons: 'Seasons',
notavailable: 'N/A', notavailable: 'N/A',
failedretry: 'Something went wrong while retrying the request.', failedretry: 'Something went wrong while retrying the request.',
@ -163,10 +162,15 @@ const RequestItem: React.FC<RequestItemProps> = ({
{isMovie(title) ? title.title : title.name} {isMovie(title) ? title.title : title.name}
</a> </a>
</Link> </Link>
<div className="text-sm"> <div className="flex items-center">
{intl.formatMessage(messages.requestedby, { <img
username: requestData.requestedBy.displayName, src={requestData.requestedBy.avatar}
})} alt=""
className="w-5 mr-2 rounded-full"
/>
<span className="text-sm">
{requestData.requestedBy.displayName}
</span>
</div> </div>
{requestData.seasons.length > 0 && ( {requestData.seasons.length > 0 && (
<div className="items-center hidden mt-2 text-sm sm:flex"> <div className="items-center hidden mt-2 text-sm sm:flex">
@ -216,18 +220,24 @@ const RequestItem: React.FC<RequestItemProps> = ({
<div className="flex flex-col"> <div className="flex flex-col">
{requestData.modifiedBy ? ( {requestData.modifiedBy ? (
<span className="text-sm text-gray-300"> <span className="text-sm text-gray-300">
<span className="mr-1">{requestData.modifiedBy.displayName}</span> <div className="flex items-center">
<span> <img
( src={requestData.modifiedBy.avatar}
<FormattedRelativeTime alt=""
value={Math.floor( className="w-5 mr-2 rounded-full"
(new Date(requestData.updatedAt).getTime() - Date.now()) /
1000
)}
updateIntervalInSeconds={1}
/> />
) <span className="text-sm">
</span> {requestData.modifiedBy.displayName} (
<FormattedRelativeTime
value={Math.floor(
(new Date(requestData.updatedAt).getTime() - Date.now()) /
1000
)}
updateIntervalInSeconds={1}
/>
)
</span>
</div>
</span> </span>
) : ( ) : (
<span className="text-sm text-gray-300">N/A</span> <span className="text-sm text-gray-300">N/A</span>

@ -148,7 +148,6 @@
"components.RequestCard.seasons": "Seasons", "components.RequestCard.seasons": "Seasons",
"components.RequestList.RequestItem.failedretry": "Something went wrong while retrying the request.", "components.RequestList.RequestItem.failedretry": "Something went wrong while retrying the request.",
"components.RequestList.RequestItem.notavailable": "N/A", "components.RequestList.RequestItem.notavailable": "N/A",
"components.RequestList.RequestItem.requestedby": "Requested by {username}",
"components.RequestList.RequestItem.seasons": "Seasons", "components.RequestList.RequestItem.seasons": "Seasons",
"components.RequestList.filterAll": "All", "components.RequestList.filterAll": "All",
"components.RequestList.filterApproved": "Approved", "components.RequestList.filterApproved": "Approved",

Loading…
Cancel
Save