lbry-desktop/ui/component/claimPreviewSubtitle/index.js
infinite-persistence 5c91d55cbc Fix sub/view count not in compact form for some components
## Ticket
968 Truncate views/subs in other areas

## Changes
- Corrected logic for `minThresholdToApply`, which was ignoring the case of "no threshold", causing it to not be truncated in Channel Page. We want to always truncate there due to the smaller cards.

- Missed out handling `ClaimPreviewSubtitle`.
2022-02-26 10:27:25 -05:00

33 lines
1.2 KiB
JavaScript

import * as PAGES from 'constants/pages';
import { connect } from 'react-redux';
import { selectClaimForUri, makeSelectClaimIsPending } from 'redux/selectors/claims';
import { selectLanguage } from 'redux/selectors/settings';
import { doClearPublish, doPrepareEdit } from 'redux/actions/publish';
import { push } from 'connected-react-router';
import ClaimPreviewSubtitle from './view';
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
import { isStreamPlaceholderClaim } from 'util/claim';
const select = (state, props) => {
const claim = selectClaimForUri(state, props.uri);
const isChannel = claim && claim.value_type === 'channel';
const isLivestream = isStreamPlaceholderClaim(claim);
return {
claim,
pending: makeSelectClaimIsPending(props.uri)(state),
isLivestream,
subCount: isChannel ? selectSubCountForUri(state, claim.repost_url ? claim.canonical_url : props.uri) : 0,
lang: selectLanguage(state),
};
};
const perform = (dispatch) => ({
beginPublish: (name) => {
dispatch(doClearPublish());
dispatch(doPrepareEdit({ name }));
dispatch(push(`/$/${PAGES.UPLOAD}`));
},
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
});
export default connect(select, perform)(ClaimPreviewSubtitle);