lbry-desktop/ui/component/hiddenNsfwClaims/index.js
zeppi ee9f63a161 integrate all the things
bugfix

wip

flow

fix

cleaning

clean
2021-10-15 23:49:41 -04:00

28 lines
861 B
JavaScript

import { connect } from 'react-redux';
import { makeSelectNsfwCountFromUris, makeSelectOmittedCountForChannel } from 'redux/selectors/claims';
import { parseURI } from 'util/lbryURI';
import { selectShowMatureContent } from 'redux/selectors/settings';
import HiddenNsfwClaims from './view';
const select = (state, props) => {
const { uri, uris } = props;
let numberOfHiddenClaims;
if (uri) {
const { isChannel } = parseURI(uri);
numberOfHiddenClaims = isChannel
? makeSelectOmittedCountForChannel(uri)(state)
: makeSelectNsfwCountFromUris([uri])(state);
} else if (uris) {
numberOfHiddenClaims = makeSelectNsfwCountFromUris(uris)(state);
}
return {
numberOfHiddenClaims,
obscureNsfw: !selectShowMatureContent(state),
};
};
const perform = () => ({});
export default connect(select, perform)(HiddenNsfwClaims);