Do not double confirm on supports, per code review

This commit is contained in:
Jeffrey Fisher 2020-04-23 09:44:18 -07:00 committed by Sean Yesmunt
parent 85a8234115
commit cb470ad970
3 changed files with 17 additions and 13 deletions

View file

@ -1,5 +1,11 @@
import { connect } from 'react-redux';
import { makeSelectTitleForUri, makeSelectClaimForUri, selectIsSendingSupport, selectBalance } from 'lbry-redux';
import {
doSendTip,
makeSelectTitleForUri,
makeSelectClaimForUri,
selectIsSendingSupport,
selectBalance,
} from 'lbry-redux';
import WalletSendTip from './view';
import { doOpenModal } from 'redux/actions/app';
import { withRouter } from 'react-router';
@ -13,6 +19,7 @@ const select = (state, props) => ({
const perform = dispatch => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
sendSupport: (amount, claimId, isSupport) => dispatch(doSendTip(amount, claimId, isSupport)),
});
export default withRouter(connect(select, perform)(WalletSendTip));

View file

@ -30,10 +30,15 @@ function WalletSendTip(props: Props) {
const isMobile = useIsMobile();
function handleSubmit() {
const { openModal } = props;
const { openModal, sendSupport } = props;
if (tipAmount && claimId) {
const modalProps = { tipAmount, claimId, title, isSupport };
openModal(MODALS.CONFIRM_SEND_TIP, modalProps);
if (isSupport) {
sendSupport(tipAmount, claimId, isSupport);
} else {
const modalProps = { tipAmount, claimId, title, isSupport };
openModal(MODALS.CONFIRM_SEND_TIP, modalProps);
}
}
}

View file

@ -33,15 +33,7 @@ class ModalSendTip extends React.PureComponent<Props> {
</I18nMessage>
)
}
actions={
<SendTip
uri={uri}
claimIsMine={claimIsMine}
isSupport={isSupport}
onCancel={closeModal}
sendTipCallback={closeModal}
/>
}
actions={<SendTip uri={uri} claimIsMine={claimIsMine} isSupport={isSupport} onCancel={closeModal} />}
/>
</Modal>
);