lbry-desktop/ui/component/hiddenNsfwClaims/index.js

31 lines
824 B
JavaScript
Raw Permalink Normal View History

import { connect } from 'react-redux';
2019-11-25 21:13:19 +01:00
import { makeSelectNsfwCountFromUris, makeSelectOmittedCountForChannel, parseURI } from 'lbry-redux';
2019-08-02 08:28:14 +02:00
import { selectShowMatureContent } from 'redux/selectors/settings';
import HiddenNsfwClaims from './view';
const select = (state, props) => {
const { uri, uris } = props;
2019-11-25 21:13:19 +01:00
let numberOfHiddenClaims;
if (uri) {
const { isChannel } = parseURI(uri);
2019-11-25 21:13:19 +01:00
numberOfHiddenClaims = isChannel
? makeSelectOmittedCountForChannel(uri)(state)
: makeSelectNsfwCountFromUris([uri])(state);
} else if (uris) {
2019-11-25 21:13:19 +01:00
numberOfHiddenClaims = makeSelectNsfwCountFromUris(uris)(state);
}
return {
2019-11-25 21:13:19 +01:00
numberOfHiddenClaims,
2019-08-02 08:28:14 +02:00
obscureNsfw: !selectShowMatureContent(state),
};
};
const perform = () => ({});
export default connect(
select,
perform
)(HiddenNsfwClaims);