diff --git a/ui/component/claimSupportButton/index.js b/ui/component/claimSupportButton/index.js index 918faf199..6327c125a 100644 --- a/ui/component/claimSupportButton/index.js +++ b/ui/component/claimSupportButton/index.js @@ -1,14 +1,24 @@ import { connect } from 'react-redux'; import { doOpenModal } from 'redux/actions/app'; -import { makeSelectTagInClaimOrChannelForUri, makeSelectClaimForUri } from 'redux/selectors/claims'; +import { makeSelectTagInClaimOrChannelForUri, selectClaimForUri } from 'redux/selectors/claims'; import ClaimSupportButton from './view'; const DISABLE_SUPPORT_TAG = 'disable-support'; -const select = (state, props) => ({ - disableSupport: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state), - claim: makeSelectClaimForUri(props.uri)(state), -}); -export default connect(select, { +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, + }; +}; + +const perform = { doOpenModal, -})(ClaimSupportButton); +}; + +export default connect(select, perform)(ClaimSupportButton); diff --git a/ui/component/claimSupportButton/view.jsx b/ui/component/claimSupportButton/view.jsx index b867b4b07..7e53f30e9 100644 --- a/ui/component/claimSupportButton/view.jsx +++ b/ui/component/claimSupportButton/view.jsx @@ -4,33 +4,31 @@ import * as ICONS from 'constants/icons'; import React from 'react'; import classnames from 'classnames'; import Button from 'component/button'; +import Tooltip from 'component/common/tooltip'; type Props = { uri: string, - doOpenModal: (string, {}) => void, fileAction?: boolean, + // redux disableSupport: boolean, - claim: GenericClaim, + isRepost?: boolean, + doOpenModal: (id: string, {}) => void, }; export default function ClaimSupportButton(props: Props) { - const { doOpenModal, uri, fileAction, disableSupport, claim } = props; - const isRepost = claim && claim.repost_url; + const { uri, fileAction, isRepost, disableSupport, doOpenModal } = props; - if (disableSupport) { - return null; - } - - return ( -