Revert tips by amount on hyper chat banner (#877)

This commit is contained in:
saltrafael 2022-02-15 16:28:06 -03:00 committed by GitHub
parent 60d9acfa55
commit 381200800e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,8 +83,12 @@ export default function LivestreamChatLayout(props: Props) {
const [superchatsAmount, setSuperchatsAmount] = React.useState(false); const [superchatsAmount, setSuperchatsAmount] = React.useState(false);
const [chatElement, setChatElement] = React.useState(); const [chatElement, setChatElement] = React.useState();
const superChatsByChronologicalOrder = let superChatsByChronologicalOrder = [];
superChatsByAmount && superChatsByAmount.sort((a, b) => b.timestamp - a.timestamp); if (superChatsByAmount) superChatsByAmount.forEach((chat) => superChatsByChronologicalOrder.push(chat));
if (superChatsByChronologicalOrder.length > 0) {
superChatsByChronologicalOrder.sort((a, b) => b.timestamp - a.timestamp);
}
const commentsToDisplay = const commentsToDisplay =
viewMode === VIEW_MODES.CHAT ? commentsByChronologicalOrder : superChatsByChronologicalOrder; viewMode === VIEW_MODES.CHAT ? commentsByChronologicalOrder : superChatsByChronologicalOrder;
const commentsLength = commentsToDisplay && commentsToDisplay.length; const commentsLength = commentsToDisplay && commentsToDisplay.length;
@ -291,13 +295,13 @@ export default function LivestreamChatLayout(props: Props) {
'livestream-comments__top-actions--mobile': isMobile, 'livestream-comments__top-actions--mobile': isMobile,
})} })}
> >
{isMobile && ((pinnedComment && showPinned) || (superChatsByChronologicalOrder && !superchatsHidden)) && ( {isMobile && ((pinnedComment && showPinned) || (superChatsByAmount && !superchatsHidden)) && (
<MobileDrawerTopGradient theme={theme} /> <MobileDrawerTopGradient theme={theme} />
)} )}
{viewMode === VIEW_MODES.CHAT && superChatsByChronologicalOrder && ( {viewMode === VIEW_MODES.CHAT && superChatsByAmount && (
<LivestreamSuperchats <LivestreamSuperchats
superChats={superChatsByChronologicalOrder} superChats={superChatsByAmount}
toggleSuperChat={toggleSuperChat} toggleSuperChat={toggleSuperChat}
superchatsHidden={superchatsHidden} superchatsHidden={superchatsHidden}
isMobile={isMobile} isMobile={isMobile}