Fix: Addressed issue with status color not showing on Movie > Details (only purple was working)

pull/5000/head
nitsua 4 years ago committed by Qstick
parent 69071768de
commit 4fafdcabb7

@ -8,7 +8,7 @@
border-left: 4px solid $successColor; border-left: 4px solid $successColor;
} }
.unreleased { .notAvailable {
padding-left: 2px; padding-left: 2px;
border-left: 4px solid $primaryColor; border-left: 4px solid $primaryColor;
} }

@ -1,6 +1,7 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import getQueueStatusText from 'Utilities/Movie/getQueueStatusText'; import getQueueStatusText from 'Utilities/Movie/getQueueStatusText';
import firstCharToUpper from 'Utilities/String/firstCharToUpper';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import styles from './MovieStatusLabel.css'; import styles from './MovieStatusLabel.css';
@ -10,22 +11,25 @@ function getMovieStatus(hasFile, isMonitored, isAvailable, queueDetails = false)
const queueStatus = queueDetails.items[0].status; const queueStatus = queueDetails.items[0].status;
const queueState = queueDetails.items[0].trackedDownloadStatus; const queueState = queueDetails.items[0].trackedDownloadStatus;
const queueStatusText = getQueueStatusText(queueStatus, queueState); const queueStatusText = getQueueStatusText(queueStatus, queueState);
return queueStatusText.longText;
if (queueStatusText) {
return queueStatusText;
}
} }
if (hasFile) { if (hasFile) {
return translate('Downloaded'); return 'downloaded';
} }
if (!isMonitored) { if (!isMonitored) {
return translate('Unmonitored'); return 'unmonitored';
} }
if (isAvailable && !hasFile) { if (isAvailable && !hasFile) {
return translate('Missing'); return 'missing';
} }
return translate('NotAvailable'); return 'notAvailable';
} }
function MovieStatusLabel(props) { function MovieStatusLabel(props) {
@ -38,6 +42,7 @@ function MovieStatusLabel(props) {
const status = getMovieStatus(hasMovieFiles, monitored, isAvailable, queueDetails); const status = getMovieStatus(hasMovieFiles, monitored, isAvailable, queueDetails);
let statusClass = status; let statusClass = status;
if (queueDetails.items.length) { if (queueDetails.items.length) {
statusClass = 'queue'; statusClass = 'queue';
} }
@ -46,7 +51,7 @@ function MovieStatusLabel(props) {
<span <span
className={styles[statusClass]} className={styles[statusClass]}
> >
{status} {translate(firstCharToUpper(status))}
</span> </span>
); );
} }

@ -46,7 +46,7 @@ function MovieIndexProgressBar(props) {
size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL} size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL}
showText={detailedProgressBar} showText={detailedProgressBar}
width={posterWidth} width={posterWidth}
text={(queueStatusText) ? queueStatusText.shortText : translate(movieStatus)} text={(queueStatusText) ? queueStatusText : translate(movieStatus)}
/> />
); );
} }

@ -25,10 +25,10 @@ function MovieFileStatus(props) {
return ( return (
<div className={styles.center}> <div className={styles.center}>
<Label <Label
title={queueStatusText.longText} title={queueStatusText}
kind={kinds.QUEUE} kind={kinds.QUEUE}
> >
{queueStatusText.shortText} {queueStatusText}
</Label> </Label>
</div> </div>
); );

@ -6,8 +6,7 @@ export default function getQueueStatusText(queueStatus, queueState) {
return; return;
} }
let statusLong = translate('Downloading'); let status = translate('Downloading');
let statusShort = translate('Downloading');
switch (true) { switch (true) {
case queueStatus !== 'completed': case queueStatus !== 'completed':
@ -15,21 +14,15 @@ export default function getQueueStatusText(queueStatus, queueState) {
case 'queue': case 'queue':
case 'paused': case 'paused':
case 'failed': case 'failed':
statusLong = `${translate('Downloading')}: ${translate(titleCase(queueStatus))}`; case 'downloading':
statusShort = titleCase(queueStatus); status = titleCase(queueStatus);
break; break;
case 'delay': case 'delay':
statusLong = `${translate('Downloading')}: ${translate('Pending')}`; status = translate('Pending');
statusShort = translate('Pending');
break; break;
case 'DownloadClientUnavailable': case 'DownloadClientUnavailable':
case 'warning': case 'warning':
statusLong = `${translate('Downloading')}: ${translate('Error')}`; status = translate('Error');
statusShort = translate('Error');
break;
case 'downloading':
statusLong = titleCase(queueStatus);
statusShort = titleCase(queueStatus);
break; break;
default: default:
} }
@ -38,16 +31,13 @@ export default function getQueueStatusText(queueStatus, queueState) {
case queueStatus === 'completed': case queueStatus === 'completed':
switch (queueState) { switch (queueState) {
case 'importPending': case 'importPending':
statusLong = `${translate('Downloaded')}: ${translate('Pending')}`; status = translate('Pending');
statusShort = translate('Downloaded');
break; break;
case 'importing': case 'importing':
statusLong = `${translate('Downloaded')}: ${translate('Importing')}`; status = translate('Importing');
statusShort = translate('Downloaded');
break; break;
case 'failedPending': case 'failedPending':
statusLong = `${translate('Downloaded')}: ${translate('Waiting')}`; status = translate('Waiting');
statusShort = translate('Downloaded');
break; break;
default: default:
} }
@ -56,6 +46,5 @@ export default function getQueueStatusText(queueStatus, queueState) {
default: default:
} }
const result = { longText: statusLong, shortText: statusShort }; return status;
return result;
} }

@ -0,0 +1,9 @@
function firstCharToUpper(input) {
if (!input) {
return '';
}
return [].map.call(input, (char, i) => (i ? char : char.toUpperCase())).join('');
}
export default firstCharToUpper;
Loading…
Cancel
Save