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