64cbd4ae8d
* Dont show countdown on Lists * Add Repeat icon * Add Shuffle icon * Add Replay Icon * Add Replay Option to autoplayCountdown * Add Loop Control for Lists * Add Shuffle control for Lists * Improve View List Link and Fetch action * Add Play Button to List page * Add Shuffle Play Option on List Page and Menus * Fix Modal Remove Collection I18n * CSS: Fix Large list titles * Fix List playback on Floating Player * Add Theater Mode to its own class and fix bar text display * Add Play Next VJS component * Add Play Next Button * Add Play Previous VJS Component * Add Play Previous Button * Add Autoplay Next Button * Add separate control for autoplay next in list * Bump redux * Update CHANGELOG.md
59 lines
2.3 KiB
JavaScript
59 lines
2.3 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import {
|
|
makeSelectClaimIsMine,
|
|
makeSelectClaimForUri,
|
|
selectMyChannelClaims,
|
|
makeSelectClaimIsPending,
|
|
makeSelectCollectionIsMine,
|
|
makeSelectEditedCollectionForId,
|
|
} from 'lbry-redux';
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
|
import { doToast } from 'redux/actions/notifications';
|
|
import { doOpenModal } from 'redux/actions/app';
|
|
import { selectListShuffle } from 'redux/selectors/content';
|
|
import { doPlayUri, doSetPlayingUri, doToggleShuffleList, doToggleLoopList } from 'redux/actions/content';
|
|
import CollectionActions from './view';
|
|
|
|
const select = (state, props) => {
|
|
let firstItem;
|
|
const collectionUrls = props.collectionUrls;
|
|
if (collectionUrls) {
|
|
// this will help play the first valid claim in a list
|
|
// in case the first urls have been deleted
|
|
collectionUrls.map((url) => {
|
|
const claim = makeSelectClaimForUri(url)(state);
|
|
if (firstItem === undefined && claim) {
|
|
firstItem = claim.permanent_url;
|
|
}
|
|
});
|
|
}
|
|
const collectionId = props.collectionId;
|
|
const shuffleList = selectListShuffle(state);
|
|
const shuffle = shuffleList && shuffleList.collectionId === collectionId && shuffleList.newUrls;
|
|
const playNextUri = shuffle && shuffle[0];
|
|
const playNextClaim = makeSelectClaimForUri(playNextUri)(state);
|
|
|
|
return {
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
myChannels: selectMyChannelClaims(state),
|
|
claimIsPending: makeSelectClaimIsPending(props.uri)(state),
|
|
isMyCollection: makeSelectCollectionIsMine(collectionId)(state),
|
|
collectionHasEdits: Boolean(makeSelectEditedCollectionForId(collectionId)(state)),
|
|
firstItem,
|
|
playNextUri,
|
|
playNextClaim,
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
|
doToast: (options) => dispatch(doToast(options)),
|
|
doPlayUri: (uri) => dispatch(doPlayUri(uri)),
|
|
doSetPlayingUri: (uri) => dispatch(doSetPlayingUri({ uri })),
|
|
doToggleShuffleList: (collectionId, shuffle) => dispatch(doToggleShuffleList(undefined, collectionId, shuffle, true)),
|
|
doToggleLoopList: (collectionId, loop) => dispatch(doToggleLoopList(collectionId, loop)),
|
|
});
|
|
|
|
export default connect(select, perform)(CollectionActions);
|