Issue/7152 #7214
4 changed files with 18 additions and 13 deletions
|
@ -2,13 +2,25 @@ import { connect } from 'react-redux';
|
||||||
import DownloadProgress from './view';
|
import DownloadProgress from './view';
|
||||||
import { doSetPlayingUri, doStopDownload, doUpdateDownloadingStatus } from 'redux/actions/content';
|
import { doSetPlayingUri, doStopDownload, doUpdateDownloadingStatus } from 'redux/actions/content';
|
||||||
import { selectFileInfosByOutpoint } from 'lbry-redux';
|
import { selectFileInfosByOutpoint } from 'lbry-redux';
|
||||||
|
import { selectPrimaryUri, selectPlayingUri } from 'redux/selectors/content';
|
||||||
const select = (state) => {
|
const select = (state) => {
|
||||||
const byOutpoint = selectFileInfosByOutpoint(state);
|
const byOutpoint = selectFileInfosByOutpoint(state);
|
||||||
const runningByOutpoint = [];
|
const runningByOutpoint = [];
|
||||||
|
|||||||
|
const primaryUri = selectPrimaryUri(state);
|
||||||
|
const playingUri = selectPlayingUri(state);
|
||||||
|
const uri = playingUri ? playingUri.uri : null;
|
||||||
|
|
||||||
for (const key in byOutpoint) {
|
for (const key in byOutpoint) {
|
||||||
if (byOutpoint[key] && byOutpoint[key].status === 'running') runningByOutpoint.push(byOutpoint[key]);
|
const item = byOutpoint[key];
|
||||||
|
|
||||||
|
if (item && item.status === 'running') {
|
||||||
|
if (
|
||||||
|
(!primaryUri || !primaryUri.includes(`/${item.claim_name}`)) &&
|
||||||
|
(!uri || !uri.includes(`/${item.claim_name}`))
|
||||||
|
) {
|
||||||
|
runningByOutpoint.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -73,17 +73,9 @@ function FileDownloadLink(props: Props) {
|
||||||
|
|
||||||
if (fileInfo && fileInfo.written_bytes > 0) {
|
if (fileInfo && fileInfo.written_bytes > 0) {
|
||||||
const progress = (fileInfo.written_bytes / fileInfo.total_bytes) * 100;
|
const progress = (fileInfo.written_bytes / fileInfo.total_bytes) * 100;
|
||||||
return (
|
return <span className="download-text">{__('%percent%% downloaded', { percent: progress.toFixed(0) })}</span>;
|
||||||
<span className="download-text" style={{ backgroundColor: '#FFF' }}>
|
|
||||||
{__('%percent%% downloaded', { percent: progress.toFixed(0) })}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return (
|
return <span className="download-text">{__('Connecting...')}</span>;
|
||||||
<span className="download-text" style={{ backgroundColor: '#FFF' }}>
|
|
||||||
{__('Connecting...')}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @endif
|
// @endif
|
||||||
|
|
|
@ -720,6 +720,7 @@
|
||||||
margin: 0 0;
|
margin: 0 0;
|
||||||
padding: var(--spacing-xxs) var(--spacing-xxs);
|
padding: var(--spacing-xxs) var(--spacing-xxs);
|
||||||
height: unset;
|
height: unset;
|
||||||
|
background-color: var(--color-header-background);
|
||||||
|
|
||||||
// label (with 'Add' text) hidden by default
|
// label (with 'Add' text) hidden by default
|
||||||
.button__label {
|
.button__label {
|
||||||
|
|
Loading…
Add table
Reference in a new issue
I think I'd prefer to use the selector for consistency
4c72a563da/ui/redux/selectors/file_info.js (L6)
return { downloadList: selectFileInfosByOutpoint(state) }