From e9b1a11e440783689d0cc9cd07ac7e0ce917ca50 Mon Sep 17 00:00:00 2001 From: Anthony Date: Mon, 28 Mar 2022 23:56:40 +0200 Subject: [PATCH] fix flow errors --- ui/component/claimSupportButton/view.jsx | 2 +- ui/component/commentCreate/view.jsx | 40 +++++++++++++++++------- ui/component/walletSendTip/view.jsx | 26 ++++++++++++--- 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/ui/component/claimSupportButton/view.jsx b/ui/component/claimSupportButton/view.jsx index fef4cd0ab..dfca31852 100644 --- a/ui/component/claimSupportButton/view.jsx +++ b/ui/component/claimSupportButton/view.jsx @@ -13,7 +13,7 @@ type Props = { disableSupport: boolean, isRepost?: boolean, doOpenModal: (id: string, {}) => void, - preferredCurrency: ?string, + preferredCurrency: string, }; export default function ClaimSupportButton(props: Props) { diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index d9994d90e..07318df52 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -63,10 +63,18 @@ type Props = { doFetchCreatorSettings: (channelId: string) => Promise, doToast: ({ message: string }) => void, doCommentById: (commentId: string, toastIfNotFound: boolean) => Promise, - doSendCashTip: (TipParams, anonymous: boolean, UserParams, claimId: string, stripe: ?string, (any) => void) => string, + doSendCashTip: ( + TipParams, + anonymous: boolean, + UserParams, + claimId: string, + stripe: ?string, + preferredCurrency: string, + (any) => void + ) => string, doSendTip: (params: {}, isSupport: boolean, successCb: (any) => void, errorCb: (any) => void, boolean) => void, doOpenModal: (id: string, any) => void, - preferredCurrency?: boolean, + preferredCurrency: string, }; export function CommentCreate(props: Props) { @@ -308,17 +316,25 @@ export function CommentCreate(props: Props) { const tipParams: TipParams = { tipAmount: Math.round(tipAmount * 100) / 100, tipChannelName, channelClaimId }; const userParams: UserParams = { activeChannelName, activeChannelId: activeChannelClaimId }; - doSendCashTip(tipParams, false, userParams, claimId, stripeEnvironment, preferredCurrency, (customerTipResponse) => { - const { payment_intent_id } = customerTipResponse; + doSendCashTip( + tipParams, + false, + userParams, + claimId, + stripeEnvironment, + preferredCurrency, + (customerTipResponse) => { + const { payment_intent_id } = customerTipResponse; - handleCreateComment(null, payment_intent_id, stripeEnvironment); + handleCreateComment(null, payment_intent_id, stripeEnvironment); - setCommentValue(''); - setReviewingSupportComment(false); - setTipSelector(false); - setCommentFailure(false); - setSubmitting(false); - }); + setCommentValue(''); + setReviewingSupportComment(false); + setTipSelector(false); + setCommentFailure(false); + setSubmitting(false); + } + ); } } @@ -687,7 +703,7 @@ export function CommentCreate(props: Props) { {stripeEnvironment && ( - + )} )} diff --git a/ui/component/walletSendTip/view.jsx b/ui/component/walletSendTip/view.jsx index 92653e49d..c87081296 100644 --- a/ui/component/walletSendTip/view.jsx +++ b/ui/component/walletSendTip/view.jsx @@ -46,10 +46,18 @@ type Props = { hasSelectedTab?: string, customText?: string, doHideModal: () => void, - doSendCashTip: (TipParams, boolean, UserParams, string, ?string) => string, + doSendCashTip: ( + TipParams, + anonymous: boolean, + UserParams, + claimId: string, + stripe: ?string, + preferredCurrency: string, + ?(any) => void + ) => string, doSendTip: (SupportParams, boolean) => void, // function that comes from lbry-redux setAmount?: (number) => void, - preferredCurrency?: boolean, + preferredCurrency: string, }; export default function WalletSendTip(props: Props) { @@ -120,8 +128,9 @@ export default function WalletSendTip(props: Props) { confirmLabel = __('Boosting'); break; case TAB_FIAT: - explainerText = __('Show this channel your appreciation by sending a donation in %currencyToUse%. ', - { currencyToUse: preferredCurrency}); + explainerText = __('Show this channel your appreciation by sending a donation in %currencyToUse%. ', { + currencyToUse: preferredCurrency, + }); confirmLabel = __('Tipping %currencyToUse%', { currencyToUse: preferredCurrency }); break; case TAB_LBC: @@ -195,7 +204,14 @@ export default function WalletSendTip(props: Props) { const userParams: UserParams = { activeChannelName, activeChannelId }; // hit backend to send tip - doSendCashTip(tipParams, !activeChannelId || incognito, userParams, claimId, stripeEnvironment, preferredCurrency); + doSendCashTip( + tipParams, + !activeChannelId || incognito, + userParams, + claimId, + stripeEnvironment, + preferredCurrency + ); doHideModal(); } // if it's a boost (?)