requested changes

This commit is contained in:
Anthony 2021-08-10 22:06:13 +02:00
parent 5e37b3ebba
commit b41eeec78e
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
4 changed files with 19 additions and 19 deletions

View file

@ -37,12 +37,12 @@ export default function LivestreamComments(props: Props) {
embed, embed,
doCommentSocketConnect, doCommentSocketConnect,
doCommentSocketDisconnect, doCommentSocketDisconnect,
comments, // comments in chronological order (oldest first) comments: commentsByChronologicalOrder,
doCommentList, doCommentList,
fetchingComments, fetchingComments,
doSuperChatList, doSuperChatList,
myChannels, myChannels,
superChats, // superchats organized by tip amount superChats: superChatsByTipAmount,
} = props; } = props;
let superChatsFiatAmount, superChatsTotalAmount; let superChatsFiatAmount, superChatsTotalAmount;
@ -52,8 +52,8 @@ export default function LivestreamComments(props: Props) {
const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT); const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT);
const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false); const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false);
const claimId = claim && claim.claim_id; const claimId = claim && claim.claim_id;
const commentsLength = comments && comments.length; const commentsLength = commentsByChronologicalOrder && commentsByChronologicalOrder.length;
const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? comments : superChats; const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? commentsByChronologicalOrder : superChatsByTipAmount;
const discussionElement = document.querySelector('.livestream__comments'); const discussionElement = document.querySelector('.livestream__comments');
const commentElement = document.querySelector('.livestream-comment'); const commentElement = document.querySelector('.livestream-comment');
@ -104,10 +104,10 @@ export default function LivestreamComments(props: Props) {
}, [commentsLength, discussionElement, handleScroll, performedInitialScroll, setPerformedInitialScroll]); }, [commentsLength, discussionElement, handleScroll, performedInitialScroll, setPerformedInitialScroll]);
// sum total amounts for fiat tips and lbc tips // sum total amounts for fiat tips and lbc tips
if (superChats) { if (superChatsByTipAmount) {
let fiatAmount = 0; let fiatAmount = 0;
let LBCAmount = 0; let LBCAmount = 0;
for (const superChat of superChats) { for (const superChat of superChatsByTipAmount) {
if (superChat.is_fiat) { if (superChat.is_fiat) {
fiatAmount = fiatAmount + superChat.support_amount; fiatAmount = fiatAmount + superChat.support_amount;
} else { } else {
@ -121,8 +121,8 @@ export default function LivestreamComments(props: Props) {
let superChatsReversed; let superChatsReversed;
// array of superchats organized by fiat or not first, then support amount // array of superchats organized by fiat or not first, then support amount
if (superChats) { if (superChatsByTipAmount) {
const clonedSuperchats = JSON.parse(JSON.stringify(superChats)); const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount));
// sort by fiat first then by support amount // sort by fiat first then by support amount
superChatsReversed = clonedSuperchats.sort(function(a, b) { superChatsReversed = clonedSuperchats.sort(function(a, b) {
@ -202,16 +202,16 @@ export default function LivestreamComments(props: Props) {
)} )}
</div> </div>
<> <>
{fetchingComments && !comments && ( {fetchingComments && !commentsByChronologicalOrder && (
<div className="main--empty"> <div className="main--empty">
<Spinner /> <Spinner />
</div> </div>
)} )}
<div ref={commentsRef} className="livestream__comments-wrapper"> <div ref={commentsRef} className="livestream__comments-wrapper">
{viewMode === VIEW_MODE_CHAT && superChatsTotalAmount > 0 && superChats && ( {viewMode === VIEW_MODE_CHAT && superChatsTotalAmount > 0 && superChatsByTipAmount && (
<div className="livestream-superchats__wrapper"> <div className="livestream-superchats__wrapper">
<div className="livestream-superchats__inner"> <div className="livestream-superchats__inner">
{superChats.map((superChat: Comment) => ( {superChatsByTipAmount.map((superChat: Comment) => (
<Tooltip key={superChat.comment_id} label={superChat.comment}> <Tooltip key={superChat.comment_id} label={superChat.comment}>
<div className="livestream-superchat"> <div className="livestream-superchat">
<div className="livestream-superchat__thumbnail"> <div className="livestream-superchat__thumbnail">
@ -235,7 +235,7 @@ export default function LivestreamComments(props: Props) {
)} )}
{/* top to bottom comment display */} {/* top to bottom comment display */}
{!fetchingComments && comments.length > 0 ? ( {!fetchingComments && commentsByChronologicalOrder.length > 0 ? (
<div className="livestream__comments"> <div className="livestream__comments">
{viewMode === VIEW_MODE_CHAT && commentsToDisplay.map((comment) => ( {viewMode === VIEW_MODE_CHAT && commentsToDisplay.map((comment) => (
<LivestreamComment <LivestreamComment

View file

@ -621,7 +621,7 @@ function WalletSendTip(props: Props) {
)} )}
</> </>
// if it's LBC and there is no balance, you can prompt to purchase LBC // if it's LBC and there is no balance, you can prompt to purchase LBC
: <> :
<Card <Card
title={<I18nMessage tokens={{ lbc: <LbcSymbol size={22} /> }}>Supporting content requires %lbc%</I18nMessage>} title={<I18nMessage tokens={{ lbc: <LbcSymbol size={22} /> }}>Supporting content requires %lbc%</I18nMessage>}
subtitle={ subtitle={
@ -642,7 +642,7 @@ function WalletSendTip(props: Props) {
<Button button="link" label={__('Nevermind')} onClick={closeModal} /> <Button button="link" label={__('Nevermind')} onClick={closeModal} />
</div> </div>
} }
/></> />
) )
} }
/> />

View file

@ -4,7 +4,6 @@ import StripeAccountConnection from './view';
import { selectUser } from 'redux/selectors/user'; import { selectUser } from 'redux/selectors/user';
import { doToast } from 'redux/actions/notifications'; import { doToast } from 'redux/actions/notifications';
// function that receives state parameter and returns object of functions that accept state
const select = (state) => ({ const select = (state) => ({
user: selectUser(state), user: selectUser(state),
}); });

View file

@ -19,6 +19,9 @@ if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) {
stripeEnvironment = 'live'; stripeEnvironment = 'live';
} }
const APIS_DOWN_ERROR_RESPONSE = 'There was an error from the server, please let support know';
const CARD_SETUP_ERROR_RESPONSE = 'There was an error getting your card setup, please let support know';
// eslint-disable-next-line flowtype/no-types-missing-file-annotation // eslint-disable-next-line flowtype/no-types-missing-file-annotation
type Props = { type Props = {
disabled: boolean, disabled: boolean,
@ -188,12 +191,10 @@ class SettingsStripeCard extends React.Component<Props, State> {
}); });
// 500 error from the backend being down // 500 error from the backend being down
} else if (error === 'internal_apis_down') { } else if (error === 'internal_apis_down') {
const displayString = 'There was an error from the server, please let support know'; doToast({ message: APIS_DOWN_ERROR_RESPONSE, isError: true });
doToast({ message: displayString, isError: true });
} else { } else {
// probably an error from stripe // probably an error from stripe
const displayString = 'There was an error getting your card setup, please let support know'; doToast({ message: CARD_SETUP_ERROR_RESPONSE, isError: true });
doToast({ message: displayString, isError: true });
} }
}); });
}, 250); }, 250);