fix flow errors
This commit is contained in:
parent
81bac22fe0
commit
26594015ce
1 changed files with 9 additions and 11 deletions
|
@ -34,7 +34,7 @@ type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
onTipErrorChange: (string) => void,
|
onTipErrorChange: (string) => void,
|
||||||
activeTab: string,
|
activeTab: string,
|
||||||
shouldDisableReviewButton: (string) => void
|
shouldDisableReviewButton: (boolean) => void
|
||||||
};
|
};
|
||||||
|
|
||||||
function WalletTipAmountSelector(props: Props) {
|
function WalletTipAmountSelector(props: Props) {
|
||||||
|
@ -45,24 +45,22 @@ function WalletTipAmountSelector(props: Props) {
|
||||||
const [canReceiveFiatTip, setCanReceiveFiatTip] = React.useState(); // dont persist because it needs to be calc'd per creator
|
const [canReceiveFiatTip, setCanReceiveFiatTip] = React.useState(); // dont persist because it needs to be calc'd per creator
|
||||||
const [hasCardSaved, setHasSavedCard] = usePersistedState('comment-support:hasCardSaved', false);
|
const [hasCardSaved, setHasSavedCard] = usePersistedState('comment-support:hasCardSaved', false);
|
||||||
|
|
||||||
|
// if it's fiat but there's no card saved OR the creator can't receive fiat tips
|
||||||
|
const shouldDisableFiatSelectors = (activeTab === TAB_FIAT && (!hasCardSaved || !canReceiveFiatTip));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* whether tip amount selection/review functionality should be disabled
|
* whether tip amount selection/review functionality should be disabled
|
||||||
* @param [amount] LBC amount (optional)
|
* @param [amount] LBC amount (optional)
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function shouldDisableAmountSelector(amount) {
|
function shouldDisableAmountSelector(amount) {
|
||||||
|
// if it's LBC but the balance isn't enough, or fiat conditions met
|
||||||
const shouldDisable =
|
// $FlowFixMe
|
||||||
// if it's LBC but the balance isn't enough
|
return (amount > balance && activeTab !== TAB_FIAT) || shouldDisableFiatSelectors;
|
||||||
(amount > balance && activeTab !== TAB_FIAT) ||
|
|
||||||
// if it's fiat but there's no card saved OR the creator can't receive fiat tips
|
|
||||||
(activeTab === TAB_FIAT && (!hasCardSaved || !canReceiveFiatTip));
|
|
||||||
|
|
||||||
shouldDisableReviewButton(shouldDisable);
|
|
||||||
|
|
||||||
return shouldDisable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldDisableReviewButton(shouldDisableFiatSelectors);
|
||||||
|
|
||||||
// setup variables for tip API
|
// setup variables for tip API
|
||||||
let channelClaimId, tipChannelName;
|
let channelClaimId, tipChannelName;
|
||||||
// if there is a signing channel it's on a file
|
// if there is a signing channel it's on a file
|
||||||
|
|
Loading…
Add table
Reference in a new issue