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

29 lines
861 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
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';
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);