add refresh icon to <FileCard> when playback position exists

This commit is contained in:
Travis Eden 2018-07-31 09:56:54 -04:00 committed by Sean Yesmunt
parent 82252e6985
commit 287f1ac656
3 changed files with 11 additions and 1 deletions

View file

@ -8,7 +8,10 @@ import {
makeSelectClaimIsMine, makeSelectClaimIsMine,
} from 'lbry-redux'; } from 'lbry-redux';
import { doNavigate } from 'redux/actions/navigation'; import { doNavigate } from 'redux/actions/navigation';
import { selectRewardContentClaimIds } from 'redux/selectors/content'; import {
selectRewardContentClaimIds,
makeSelectContentPositionForUri,
} from 'redux/selectors/content';
import { selectShowNsfw } from 'redux/selectors/settings'; import { selectShowNsfw } from 'redux/selectors/settings';
import { selectPendingPublish } from 'redux/selectors/publish'; import { selectPendingPublish } from 'redux/selectors/publish';
import FileCard from './view'; import FileCard from './view';
@ -32,6 +35,7 @@ const select = (state, props) => {
rewardedContentClaimIds: selectRewardContentClaimIds(state, props), rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
...fileCardInfo, ...fileCardInfo,
pending: !!pendingPublish, pending: !!pendingPublish,
position: makeSelectContentPositionForUri(props.uri)(state),
}; };
}; };

View file

@ -23,6 +23,7 @@ type Props = {
claimIsMine: boolean, claimIsMine: boolean,
showPrice: boolean, showPrice: boolean,
pending?: boolean, pending?: boolean,
position: ?number,
/* eslint-disable react/no-unused-prop-types */ /* eslint-disable react/no-unused-prop-types */
resolveUri: string => void, resolveUri: string => void,
isResolvingUri: boolean, isResolvingUri: boolean,
@ -61,6 +62,7 @@ class FileCard extends React.PureComponent<Props> {
claimIsMine, claimIsMine,
showPrice, showPrice,
pending, pending,
position,
} = this.props; } = this.props;
const shouldHide = !claimIsMine && !pending && obscureNsfw && metadata && metadata.nsfw; const shouldHide = !claimIsMine && !pending && obscureNsfw && metadata && metadata.nsfw;
@ -103,6 +105,7 @@ class FileCard extends React.PureComponent<Props> {
{showPrice && <FilePrice hideFree uri={uri} />} {showPrice && <FilePrice hideFree uri={uri} />}
{isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />} {isRewardContent && <Icon iconColor="red" icon={icons.FEATURED} />}
{fileInfo && <Icon icon={icons.LOCAL} />} {fileInfo && <Icon icon={icons.LOCAL} />}
{position && <Icon icon={icons.REFRESH} />}
</div> </div>
</div> </div>
</section> </section>

View file

@ -33,6 +33,9 @@ export const selectRewardContentClaimIds = createSelector(
export const makeSelectContentPositionForUri = uri => export const makeSelectContentPositionForUri = uri =>
createSelector(selectState, makeSelectClaimForUri(uri), (state, claim) => { createSelector(selectState, makeSelectClaimForUri(uri), (state, claim) => {
if (!claim) {
return null;
}
const outpoint = `${claim.txid}:${claim.nout}`; const outpoint = `${claim.txid}:${claim.nout}`;
const id = claim.claim_id; const id = claim.claim_id;
return state.positions[id] ? state.positions[id][outpoint] : null; return state.positions[id] ? state.positions[id][outpoint] : null;