2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2020-09-17 13:11:19 -04:00
|
|
|
import {
|
2021-11-11 12:48:10 +08:00
|
|
|
selectClaimIsMine,
|
|
|
|
selectClaimForUri,
|
2021-11-08 14:27:14 +08:00
|
|
|
selectHasChannels,
|
2022-01-25 13:48:53 -05:00
|
|
|
makeSelectTagInClaimOrChannelForUri,
|
2021-10-17 16:36:14 +08:00
|
|
|
} from 'redux/selectors/claims';
|
2022-02-01 17:11:35 -03:00
|
|
|
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
|
|
|
import { doEditForChannel } from 'redux/actions/publish';
|
2021-11-19 10:40:01 +08:00
|
|
|
import { selectCostInfoForUri } from 'lbryinc';
|
2022-02-01 17:11:35 -03:00
|
|
|
import { doClearPlayingUri, doDownloadUri } from 'redux/actions/content';
|
2020-09-17 13:11:19 -04:00
|
|
|
import { doToast } from 'redux/actions/notifications';
|
2022-02-01 17:11:35 -03:00
|
|
|
import { doOpenModal } from 'redux/actions/app';
|
2020-04-01 14:43:50 -04:00
|
|
|
import FileActions from './view';
|
|
|
|
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
|
2022-01-25 13:48:53 -05:00
|
|
|
import { DISABLE_DOWNLOAD_BUTTON_TAG } from 'constants/tags';
|
2022-02-02 09:45:16 -03:00
|
|
|
import { isStreamPlaceholderClaim } from 'util/claim';
|
2017-04-29 16:50:29 +07:00
|
|
|
|
2021-11-11 12:48:10 +08:00
|
|
|
const select = (state, props) => {
|
2022-02-01 17:11:35 -03:00
|
|
|
const { uri } = props;
|
|
|
|
|
|
|
|
const claim = selectClaimForUri(state, uri);
|
2021-11-11 12:48:10 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
claim,
|
|
|
|
claimIsMine: selectClaimIsMine(state, claim),
|
2022-02-01 17:11:35 -03:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
|
|
|
costInfo: selectCostInfoForUri(state, uri),
|
2021-11-11 12:48:10 +08:00
|
|
|
hasChannels: selectHasChannels(state),
|
2022-02-02 09:45:16 -03:00
|
|
|
isLivestreamClaim: isStreamPlaceholderClaim(claim),
|
2022-02-01 17:11:35 -03:00
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
2022-01-25 13:48:53 -05:00
|
|
|
disableDownloadButton: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_DOWNLOAD_BUTTON_TAG)(state),
|
2021-11-11 12:48:10 +08:00
|
|
|
};
|
|
|
|
};
|
2017-04-29 16:50:29 +07:00
|
|
|
|
2022-02-01 17:11:35 -03:00
|
|
|
const perform = {
|
|
|
|
doOpenModal,
|
|
|
|
doEditForChannel,
|
|
|
|
doClearPlayingUri,
|
|
|
|
doToast,
|
|
|
|
doDownloadUri,
|
|
|
|
};
|
2017-04-30 00:02:25 +07:00
|
|
|
|
2020-04-01 14:43:50 -04:00
|
|
|
export default connect(select, perform)(FileActions);
|