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, disableSupport: boolean,
isRepost?: boolean, isRepost?: boolean,
doOpenModal: (id: string, {}) => void, doOpenModal: (id: string, {}) => void,
preferredCurrency: ?string, preferredCurrency: string,
}; };
export default function ClaimSupportButton(props: Props) { export default function ClaimSupportButton(props: Props) {

View file

@ -63,10 +63,18 @@ type Props = {
doFetchCreatorSettings: (channelId: string) => Promise<any>, doFetchCreatorSettings: (channelId: string) => Promise<any>,
doToast: ({ message: string }) => void, doToast: ({ message: string }) => void,
doCommentById: (commentId: string, toastIfNotFound: boolean) => Promise<any>, 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, doSendTip: (params: {}, isSupport: boolean, successCb: (any) => void, errorCb: (any) => void, boolean) => void,
doOpenModal: (id: string, any) => void, doOpenModal: (id: string, any) => void,
preferredCurrency?: boolean, preferredCurrency: string,
}; };
export function CommentCreate(props: Props) { export function CommentCreate(props: Props) {
@ -308,7 +316,14 @@ export function CommentCreate(props: Props) {
const tipParams: TipParams = { tipAmount: Math.round(tipAmount * 100) / 100, tipChannelName, channelClaimId }; const tipParams: TipParams = { tipAmount: Math.round(tipAmount * 100) / 100, tipChannelName, channelClaimId };
const userParams: UserParams = { activeChannelName, activeChannelId: activeChannelClaimId }; const userParams: UserParams = { activeChannelName, activeChannelId: activeChannelClaimId };
doSendCashTip(tipParams, false, userParams, claimId, stripeEnvironment, preferredCurrency, (customerTipResponse) => { doSendCashTip(
tipParams,
false,
userParams,
claimId,
stripeEnvironment,
preferredCurrency,
(customerTipResponse) => {
const { payment_intent_id } = customerTipResponse; const { payment_intent_id } = customerTipResponse;
handleCreateComment(null, payment_intent_id, stripeEnvironment); handleCreateComment(null, payment_intent_id, stripeEnvironment);
@ -318,7 +333,8 @@ export function CommentCreate(props: Props) {
setTipSelector(false); setTipSelector(false);
setCommentFailure(false); setCommentFailure(false);
setSubmitting(false); setSubmitting(false);
}); }
);
} }
} }
@ -687,7 +703,7 @@ export function CommentCreate(props: Props) {
<TipActionButton {...tipButtonProps} name={__('Credits')} icon={ICONS.LBC} tab={TAB_LBC} /> <TipActionButton {...tipButtonProps} name={__('Credits')} icon={ICONS.LBC} tab={TAB_LBC} />
{stripeEnvironment && ( {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, hasSelectedTab?: string,
customText?: string, customText?: string,
doHideModal: () => void, 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 doSendTip: (SupportParams, boolean) => void, // function that comes from lbry-redux
setAmount?: (number) => void, setAmount?: (number) => void,
preferredCurrency?: boolean, preferredCurrency: string,
}; };
export default function WalletSendTip(props: Props) { export default function WalletSendTip(props: Props) {
@ -120,8 +128,9 @@ export default function WalletSendTip(props: Props) {
confirmLabel = __('Boosting'); confirmLabel = __('Boosting');
break; break;
case TAB_FIAT: case TAB_FIAT:
explainerText = __('Show this channel your appreciation by sending a donation in %currencyToUse%. ', explainerText = __('Show this channel your appreciation by sending a donation in %currencyToUse%. ', {
{ currencyToUse: preferredCurrency}); currencyToUse: preferredCurrency,
});
confirmLabel = __('Tipping %currencyToUse%', { currencyToUse: preferredCurrency }); confirmLabel = __('Tipping %currencyToUse%', { currencyToUse: preferredCurrency });
break; break;
case TAB_LBC: case TAB_LBC:
@ -195,7 +204,14 @@ export default function WalletSendTip(props: Props) {
const userParams: UserParams = { activeChannelName, activeChannelId }; const userParams: UserParams = { activeChannelName, activeChannelId };
// hit backend to send tip // hit backend to send tip
doSendCashTip(tipParams, !activeChannelId || incognito, userParams, claimId, stripeEnvironment, preferredCurrency); doSendCashTip(
tipParams,
!activeChannelId || incognito,
userParams,
claimId,
stripeEnvironment,
preferredCurrency
);
doHideModal(); doHideModal();
} }
// if it's a boost (?) // if it's a boost (?)