lbry-desktop/ui/component/fileReactions/index.js
Rafael 21a5e27cd2 Refactor fileReactions component
- makeSelectReactionsForUri and selectThemePath were not being used
- isLivestreamClaim from redux
- Reduce repetition, make single reaction component
2022-02-08 12:35:40 -05:00

37 lines
1.2 KiB
JavaScript

import { connect } from 'react-redux';
import {
makeSelectMyReactionForUri,
makeSelectLikeCountForUri,
makeSelectDislikeCountForUri,
} from 'redux/selectors/reactions';
import { doFetchReactions, doReactionLike, doReactionDislike } from 'redux/actions/reactions';
import FileViewCount from './view';
import { selectClaimForUri, selectIsStreamPlaceholderForUri } from 'redux/selectors/claims';
const select = (state, props) => {
const { uri } = props;
const claim = selectClaimForUri(state, uri);
const { claim_id: claimId, signing_channel, value_type } = claim || {};
const channelName = signing_channel && signing_channel.name;
const isCollection = value_type && value_type === 'collection'; // hack because nudge gets cut off by card on cols.
return {
myReaction: makeSelectMyReactionForUri(uri)(state),
likeCount: makeSelectLikeCountForUri(uri)(state),
dislikeCount: makeSelectDislikeCountForUri(uri)(state),
isLivestreamClaim: selectIsStreamPlaceholderForUri(state, uri),
claimId,
channelName,
isCollection,
};
};
const perform = {
doFetchReactions,
doReactionLike,
doReactionDislike,
};
export default connect(select, perform)(FileViewCount);