fix(ui): add user profile links to RequestBlock and change 'ETA' string in DownloadBlock (#1551)

pull/1564/head
TheCatLady 4 years ago committed by GitHub
parent 2fc9835a6a
commit e4d0029f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,8 +1,12 @@
import React from 'react'; import React from 'react';
import { FormattedRelativeTime } from 'react-intl'; import { defineMessages, FormattedRelativeTime, useIntl } from 'react-intl';
import { DownloadingItem } from '../../../server/lib/downloadtracker'; import { DownloadingItem } from '../../../server/lib/downloadtracker';
import Badge from '../Common/Badge'; import Badge from '../Common/Badge';
const messages = defineMessages({
estimatedtime: 'Estimated {time}',
});
interface DownloadBlockProps { interface DownloadBlockProps {
downloadItem: DownloadingItem; downloadItem: DownloadingItem;
is4k?: boolean; is4k?: boolean;
@ -12,6 +16,8 @@ const DownloadBlock: React.FC<DownloadBlockProps> = ({
downloadItem, downloadItem,
is4k = false, is4k = false,
}) => { }) => {
const intl = useIntl();
return ( return (
<div className="p-4"> <div className="p-4">
<div className="w-56 mb-2 text-sm truncate sm:w-80 md:w-full"> <div className="w-56 mb-2 text-sm truncate sm:w-80 md:w-full">
@ -48,27 +54,30 @@ const DownloadBlock: React.FC<DownloadBlockProps> = ({
<div className="flex items-center justify-between text-xs"> <div className="flex items-center justify-between text-xs">
<span> <span>
{is4k && ( {is4k && (
<Badge badgeType="warning" className="mr-1"> <Badge badgeType="warning" className="mr-2">
4K 4K
</Badge> </Badge>
)} )}
<Badge className="capitalize">{downloadItem.status}</Badge> <Badge className="capitalize">{downloadItem.status}</Badge>
</span> </span>
<span> <span>
ETA{' '} {downloadItem.estimatedCompletionTime
{downloadItem.estimatedCompletionTime ? ( ? intl.formatMessage(messages.estimatedtime, {
time: (
<FormattedRelativeTime <FormattedRelativeTime
value={Math.floor( value={Math.floor(
(new Date(downloadItem.estimatedCompletionTime).getTime() - (new Date(
downloadItem.estimatedCompletionTime
).getTime() -
Date.now()) / Date.now()) /
1000 1000
)} )}
updateIntervalInSeconds={1} updateIntervalInSeconds={1}
numeric="auto" numeric="auto"
/> />
) : ( ),
'N/A' })
)} : ''}
</span> </span>
</div> </div>
</div> </div>

@ -8,6 +8,7 @@ import {
XIcon, XIcon,
} from '@heroicons/react/solid'; } from '@heroicons/react/solid';
import axios from 'axios'; import axios from 'axios';
import Link from 'next/link';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import { MediaRequestStatus } from '../../../server/constants/media'; import { MediaRequestStatus } from '../../../server/constants/media';
@ -80,14 +81,22 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
<div className="flex mb-1 flex-nowrap white"> <div className="flex mb-1 flex-nowrap white">
<UserIcon className="min-w-0 flex-shrink-0 mr-1.5 h-5 w-5" /> <UserIcon className="min-w-0 flex-shrink-0 mr-1.5 h-5 w-5" />
<span className="w-40 truncate md:w-auto"> <span className="w-40 truncate md:w-auto">
<Link href={`/users/${request.requestedBy.id}`}>
<a className="text-gray-100 transition duration-300 hover:text-white hover:underline">
{request.requestedBy.displayName} {request.requestedBy.displayName}
</a>
</Link>
</span> </span>
</div> </div>
{request.modifiedBy && ( {request.modifiedBy && (
<div className="flex flex-nowrap"> <div className="flex flex-nowrap">
<EyeIcon className="flex-shrink-0 mr-1.5 h-5 w-5" /> <EyeIcon className="flex-shrink-0 mr-1.5 h-5 w-5" />
<span className="w-40 truncate md:w-auto"> <span className="w-40 truncate md:w-auto">
{request.modifiedBy?.displayName} <Link href={`/users/${request.modifiedBy.id}`}>
<a className="text-gray-100 transition duration-300 hover:text-white hover:underline">
{request.modifiedBy.displayName}
</a>
</Link>
</span> </span>
</div> </div>
)} )}
@ -186,7 +195,7 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
</div> </div>
</div> </div>
)} )}
{(server || profile || rootFolder) && ( {(server || profile !== null || rootFolder) && (
<> <>
<div className="mt-4 mb-1 text-sm"> <div className="mt-4 mb-1 text-sm">
{intl.formatMessage(messages.requestoverrides)} {intl.formatMessage(messages.requestoverrides)}

@ -31,6 +31,7 @@
"components.Discover.upcoming": "Upcoming Movies", "components.Discover.upcoming": "Upcoming Movies",
"components.Discover.upcomingmovies": "Upcoming Movies", "components.Discover.upcomingmovies": "Upcoming Movies",
"components.Discover.upcomingtv": "Upcoming Series", "components.Discover.upcomingtv": "Upcoming Series",
"components.DownloadBlock.estimatedtime": "Estimated {time}",
"components.LanguageSelector.languageServerDefault": "Default ({language})", "components.LanguageSelector.languageServerDefault": "Default ({language})",
"components.LanguageSelector.originalLanguageDefault": "All Languages", "components.LanguageSelector.originalLanguageDefault": "All Languages",
"components.Layout.LanguagePicker.changelanguage": "Change Language", "components.Layout.LanguagePicker.changelanguage": "Change Language",

Loading…
Cancel
Save