More stripe integration #6649
1 changed files with 30 additions and 49 deletions
|
@ -50,9 +50,19 @@ export default function LivestreamComments(props: Props) {
|
||||||
|
|
||||||
let { superChatsReversed, superChatsFiatAmount, superChatsTotalAmount } = props;
|
let { superChatsReversed, superChatsFiatAmount, superChatsTotalAmount } = props;
|
||||||
|
|
||||||
|
const commentsRef = React.createRef();
|
||||||
|
const [scrollBottom, setScrollBottom] = React.useState(true);
|
||||||
|
const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT);
|
||||||
|
const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false);
|
||||||
|
const claimId = claim && claim.claim_id;
|
||||||
|
const commentsLength = comments && comments.length;
|
||||||
|
const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? comments : superChats;
|
||||||
|
|
||||||
|
const discussionElement = document.querySelector('.livestream__comments');
|
||||||
|
|||||||
|
const commentElement = document.querySelector('.livestream-comment');
|
||||||
|
|
||||||
// sum total amounts for fiat tips and lbc tips
|
// sum total amounts for fiat tips and lbc tips
|
||||||
if (superChats) {
|
if (superChats) {
|
||||||
|
|
||||||
let fiatAmount = 0;
|
let fiatAmount = 0;
|
||||||
let LBCAmount = 0;
|
let LBCAmount = 0;
|
||||||
for (const superChat of superChats) {
|
for (const superChat of superChats) {
|
||||||
|
@ -67,25 +77,7 @@ export default function LivestreamComments(props: Props) {
|
||||||
superChatsTotalAmount = LBCAmount;
|
superChatsTotalAmount = LBCAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: why doesn't this work?
|
// array of superchats organized by fiat or not first, then support amount
|
||||||
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) {
|
if (superChats) {
|
||||||
const clonedSuperchats = JSON.parse(JSON.stringify(superChats));
|
const clonedSuperchats = JSON.parse(JSON.stringify(superChats));
|
||||||
|
|
||||||
|
@ -99,17 +91,6 @@ export default function LivestreamComments(props: Props) {
|
||||||
}).reverse();
|
}).reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
const commentsRef = React.createRef();
|
|
||||||
const [scrollBottom, setScrollBottom] = React.useState(true);
|
|
||||||
const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT);
|
|
||||||
const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false);
|
|
||||||
const claimId = claim && claim.claim_id;
|
|
||||||
const commentsLength = comments && comments.length;
|
|
||||||
const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? comments : superChats;
|
|
||||||
|
|
||||||
const discussionElement = document.querySelector('.livestream__comments');
|
|
||||||
const commentElement = document.querySelector('.livestream-comment');
|
|
||||||
|
|
||||||
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
|
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
|
||||||
function isMyComment(channelId: string) {
|
function isMyComment(channelId: string) {
|
||||||
if (myChannels != null && channelId != null) {
|
if (myChannels != null && channelId != null) {
|
||||||
|
|
Loading…
Reference in a new issue
One thing you can do is get
{ superChats: superchatsSortedByAmount, comments: superchatsSortedByDate } = props; to use a new name after destructuring.
Perhaps whatever is connect()ed in in the index.js could just have a better name.