More stripe integration #6649

Closed
mayeaux wants to merge 17 commits from more-stripe-integration into master
Showing only changes of commit df62e9c0db - Show all commits

View file

@ -24,6 +24,7 @@ type Props = {
superChats: Array<Comment>,
superChatsReversed: Array,
jessopb commented 2021-07-29 23:16:09 +02:00 (Migrated from github.com)
Review

This does'nt seem to be passed in. Does it belong in props types?

This does'nt seem to be passed in. Does it belong in props types?
superChatsTotalAmount: number,
superChatsFiatAmount: number,
myChannels: ?Array<ChannelClaim>,
};
@ -48,7 +49,42 @@ export default function LivestreamComments(props: Props) {
superChats, // superchats organized by tip amount
} = props;
let { superChatsReversed } = props;
let { superChatsReversed, superChatsFiatAmount } = props;
superChatsFiatAmount = 0;
if(superChats){
console.log(superChats);
let fiatAmount = 0;
for(const superChat of superChats){
if(superChat.is_fiat){
jessopb commented 2021-07-29 23:17:20 +02:00 (Migrated from github.com)
Review

One thing you can do is get
{ superChats: superchatsSortedByAmount, comments: superchatsSortedByDate } = props; to use a new name after destructuring.

One thing you can do is get { superChats: superchatsSortedByAmount, comments: superchatsSortedByDate } = props; to use a new name after destructuring.
jessopb commented 2021-07-29 23:19:59 +02:00 (Migrated from github.com)
Review

Perhaps whatever is connect()ed in in the index.js could just have a better name.

Perhaps whatever is connect()ed in in the index.js could just have a better name.
fiatAmount = fiatAmount + superChat.support_amount;
}
}
superChatsFiatAmount = fiatAmount;
}
// TODO: why doesn't this work?
React.useEffect(() => {
if(superChats){
console.log(superChats);
// let fiatAmount = 0;
// for(const superChat of superChats){
// if(superChat.is_fiat){
// fiatAmount = fiatAmount + superChat.support_amount;
// }
// }
//
// console.log(fiatAmount);
//
// superChatsFiatAmount = fiatAmount.toString();
}
}, [superChats]);
if (superChats) {
const clonedSuperchats = JSON.parse(JSON.stringify(superChats));
@ -172,7 +208,7 @@ export default function LivestreamComments(props: Props) {
label={
<>
<CreditAmount amount={superChatsTotalAmount} size={8} /> /
<CreditAmount amount={superChatsTotalAmount} size={8} isFiat={true} /> {' '}{__('Tipped')}
<CreditAmount amount={superChatsFiatAmount} size={8} isFiat={true} /> {' '}{__('Tipped')}
</>
}
onClick={function() {