Hide watched progress if claim is being played. (#7606)
This commit is contained in:
parent
5609b43fc7
commit
fab69450c0
1 changed files with 11 additions and 2 deletions
|
@ -1,16 +1,25 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doResolveUri } from 'redux/actions/claims';
|
import { doResolveUri } from 'redux/actions/claims';
|
||||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
import { selectPrimaryUri, makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||||
import CardMedia from './view';
|
import CardMedia from './view';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import * as SETTINGS from 'constants/settings';
|
import * as SETTINGS from 'constants/settings';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
|
const claimUriBeingPlayed = selectPrimaryUri(state);
|
||||||
|
let isBeingPlayed = false;
|
||||||
|
|
||||||
|
if (claimUriBeingPlayed) {
|
||||||
|
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||||
|
const claimBeingPlayed = makeSelectClaimForUri(claimUriBeingPlayed)(state);
|
||||||
|
isBeingPlayed = claim.claim_id === claimBeingPlayed.claim_id;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
watchedPercentage: makeSelectContentWatchedPercentageForUri(props.uri)(state),
|
watchedPercentage: makeSelectContentWatchedPercentageForUri(props.uri)(state),
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
showPercentage: makeSelectClientSetting(SETTINGS.PERSIST_WATCH_TIME)(state),
|
showPercentage: !isBeingPlayed && makeSelectClientSetting(SETTINGS.PERSIST_WATCH_TIME)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue