From b41eeec78e78c6d9bbceb7507e40cba6bf132916 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 10 Aug 2021 22:06:13 +0200 Subject: [PATCH] requested changes --- ui/component/livestreamComments/view.jsx | 24 ++++++++++++------------ ui/component/walletSendTip/view.jsx | 4 ++-- ui/page/settingsStripeAccount/index.js | 1 - ui/page/settingsStripeCard/view.jsx | 9 +++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ui/component/livestreamComments/view.jsx b/ui/component/livestreamComments/view.jsx index b606c7f85..931af568a 100644 --- a/ui/component/livestreamComments/view.jsx +++ b/ui/component/livestreamComments/view.jsx @@ -37,12 +37,12 @@ export default function LivestreamComments(props: Props) { embed, doCommentSocketConnect, doCommentSocketDisconnect, - comments, // comments in chronological order (oldest first) + comments: commentsByChronologicalOrder, doCommentList, fetchingComments, doSuperChatList, myChannels, - superChats, // superchats organized by tip amount + superChats: superChatsByTipAmount, } = props; let superChatsFiatAmount, superChatsTotalAmount; @@ -52,8 +52,8 @@ export default function LivestreamComments(props: Props) { 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 commentsLength = commentsByChronologicalOrder && commentsByChronologicalOrder.length; + const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? commentsByChronologicalOrder : superChatsByTipAmount; const discussionElement = document.querySelector('.livestream__comments'); const commentElement = document.querySelector('.livestream-comment'); @@ -104,10 +104,10 @@ export default function LivestreamComments(props: Props) { }, [commentsLength, discussionElement, handleScroll, performedInitialScroll, setPerformedInitialScroll]); // sum total amounts for fiat tips and lbc tips - if (superChats) { + if (superChatsByTipAmount) { let fiatAmount = 0; let LBCAmount = 0; - for (const superChat of superChats) { + for (const superChat of superChatsByTipAmount) { if (superChat.is_fiat) { fiatAmount = fiatAmount + superChat.support_amount; } else { @@ -121,8 +121,8 @@ export default function LivestreamComments(props: Props) { let superChatsReversed; // array of superchats organized by fiat or not first, then support amount - if (superChats) { - const clonedSuperchats = JSON.parse(JSON.stringify(superChats)); + if (superChatsByTipAmount) { + const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount)); // sort by fiat first then by support amount superChatsReversed = clonedSuperchats.sort(function(a, b) { @@ -202,16 +202,16 @@ export default function LivestreamComments(props: Props) { )} <> - {fetchingComments && !comments && ( + {fetchingComments && !commentsByChronologicalOrder && (
)}
- {viewMode === VIEW_MODE_CHAT && superChatsTotalAmount > 0 && superChats && ( + {viewMode === VIEW_MODE_CHAT && superChatsTotalAmount > 0 && superChatsByTipAmount && (
- {superChats.map((superChat: Comment) => ( + {superChatsByTipAmount.map((superChat: Comment) => (
@@ -235,7 +235,7 @@ export default function LivestreamComments(props: Props) { )} {/* top to bottom comment display */} - {!fetchingComments && comments.length > 0 ? ( + {!fetchingComments && commentsByChronologicalOrder.length > 0 ? (
{viewMode === VIEW_MODE_CHAT && commentsToDisplay.map((comment) => ( // if it's LBC and there is no balance, you can prompt to purchase LBC - : <> + : }}>Supporting content requires %lbc%} subtitle={ @@ -642,7 +642,7 @@ function WalletSendTip(props: Props) {
} - /> + /> ) } /> diff --git a/ui/page/settingsStripeAccount/index.js b/ui/page/settingsStripeAccount/index.js index 87eb38809..fd03b4f49 100644 --- a/ui/page/settingsStripeAccount/index.js +++ b/ui/page/settingsStripeAccount/index.js @@ -4,7 +4,6 @@ import StripeAccountConnection from './view'; import { selectUser } from 'redux/selectors/user'; import { doToast } from 'redux/actions/notifications'; -// function that receives state parameter and returns object of functions that accept state const select = (state) => ({ user: selectUser(state), }); diff --git a/ui/page/settingsStripeCard/view.jsx b/ui/page/settingsStripeCard/view.jsx index 06768fb28..89dcb2d93 100644 --- a/ui/page/settingsStripeCard/view.jsx +++ b/ui/page/settingsStripeCard/view.jsx @@ -19,6 +19,9 @@ if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) { 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 type Props = { disabled: boolean, @@ -188,12 +191,10 @@ class SettingsStripeCard extends React.Component { }); // 500 error from the backend being down } else if (error === 'internal_apis_down') { - const displayString = 'There was an error from the server, please let support know'; - doToast({ message: displayString, isError: true }); + doToast({ message: APIS_DOWN_ERROR_RESPONSE, isError: true }); } else { // probably an error from stripe - const displayString = 'There was an error getting your card setup, please let support know'; - doToast({ message: displayString, isError: true }); + doToast({ message: CARD_SETUP_ERROR_RESPONSE, isError: true }); } }); }, 250);