fix flow errors

This commit is contained in:
Anthony 2022-03-28 23:56:40 +02:00 committed by Thomas Zarebczan
parent fe9b33e42b
commit e9b1a11e44
3 changed files with 50 additions and 18 deletions

View file

@ -13,7 +13,7 @@ type Props = {
disableSupport: boolean,
isRepost?: boolean,
doOpenModal: (id: string, {}) => void,
preferredCurrency: ?string,
preferredCurrency: string,
};
export default function ClaimSupportButton(props: Props) {

View file

@ -63,10 +63,18 @@ type Props = {
doFetchCreatorSettings: (channelId: string) => Promise<any>,
doToast: ({ message: string }) => void,
doCommentById: (commentId: string, toastIfNotFound: boolean) => Promise<any>,
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) {
<TipActionButton {...tipButtonProps} name={__('Credits')} icon={ICONS.LBC} tab={TAB_LBC} />
{stripeEnvironment && (
<TipActionButton {...tipButtonProps} name={__('Cash')} icon={ICONS.FINANCE} tab={TAB_FIAT} />
<TipActionButton {...tipButtonProps} name={__('Cash')} icon={fiatIconToUse} tab={TAB_FIAT} />
)}
</>
)}

View file

@ -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 (?)