lbry-desktop/ui/component/claimSupportButton/index.js
2022-03-29 23:00:55 -04:00

27 lines
844 B
JavaScript

import { connect } from 'react-redux';
import { doOpenModal } from 'redux/actions/app';
import { makeSelectTagInClaimOrChannelForUri, selectClaimForUri } from 'redux/selectors/claims';
import ClaimSupportButton from './view';
import { selectClientSetting } from 'redux/selectors/settings';
import * as SETTINGS from 'constants/settings';
const DISABLE_SUPPORT_TAG = 'disable-support';
const select = (state, props) => {
const { uri } = props;
const claim = selectClaimForUri(state, uri);
const isRepost = claim && claim.repost_url;
return {
disableSupport: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
isRepost,
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
};
};
const perform = {
doOpenModal,
};
export default connect(select, perform)(ClaimSupportButton);