Lint, autoformat -- no functional change.
Doing this now so that an upcoming PR that uses this file won't include these bunch of annoying auto-formatter changes in the diff.
This commit is contained in:
parent
ff9ca662f2
commit
e5512b016f
1 changed files with 41 additions and 37 deletions
|
@ -133,15 +133,17 @@ export default function LivestreamComments(props: Props) {
|
||||||
const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount));
|
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
|
||||||
// if both are fiat, organize by support
|
.sort((a, b) => {
|
||||||
if (a.is_fiat === b.is_fiat) {
|
// if both are fiat, organize by support
|
||||||
return b.support_amount - a.support_amount;
|
if (a.is_fiat === b.is_fiat) {
|
||||||
// otherwise, if they are not both fiat, put the fiat transaction first
|
return b.support_amount - a.support_amount;
|
||||||
} else {
|
// otherwise, if they are not both fiat, put the fiat transaction first
|
||||||
return (a.is_fiat === b.is_fiat) ? 0 : a.is_fiat ? -1 : 1;
|
} else {
|
||||||
}
|
return a.is_fiat === b.is_fiat ? 0 : a.is_fiat ? -1 : 1;
|
||||||
}).reverse();
|
}
|
||||||
|
})
|
||||||
|
.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -173,14 +175,13 @@ export default function LivestreamComments(props: Props) {
|
||||||
<div className="livestream-discussion__title">{__('Live discussion')}</div>
|
<div className="livestream-discussion__title">{__('Live discussion')}</div>
|
||||||
{(superChatsTotalAmount || 0) > 0 && (
|
{(superChatsTotalAmount || 0) > 0 && (
|
||||||
<div className="recommended-content__toggles">
|
<div className="recommended-content__toggles">
|
||||||
|
|
||||||
{/* the superchats in chronological order button */}
|
{/* the superchats in chronological order button */}
|
||||||
<Button
|
<Button
|
||||||
className={classnames('button-toggle', {
|
className={classnames('button-toggle', {
|
||||||
'button-toggle--active': viewMode === VIEW_MODE_CHAT,
|
'button-toggle--active': viewMode === VIEW_MODE_CHAT,
|
||||||
})}
|
})}
|
||||||
label={__('Chat')}
|
label={__('Chat')}
|
||||||
onClick={function() {
|
onClick={() => {
|
||||||
setViewMode(VIEW_MODE_CHAT);
|
setViewMode(VIEW_MODE_CHAT);
|
||||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||||
const divHeight = livestreamCommentsDiv.scrollHeight;
|
const divHeight = livestreamCommentsDiv.scrollHeight;
|
||||||
|
@ -196,10 +197,10 @@ export default function LivestreamComments(props: Props) {
|
||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
<CreditAmount amount={superChatsTotalAmount || 0} size={8} /> /
|
<CreditAmount amount={superChatsTotalAmount || 0} size={8} /> /
|
||||||
<CreditAmount amount={superChatsFiatAmount || 0} size={8} isFiat /> {' '}{__('Tipped')}
|
<CreditAmount amount={superChatsFiatAmount || 0} size={8} isFiat /> {__('Tipped')}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
onClick={function() {
|
onClick={() => {
|
||||||
setViewMode(VIEW_MODE_SUPER_CHAT);
|
setViewMode(VIEW_MODE_SUPER_CHAT);
|
||||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||||
const divHeight = livestreamCommentsDiv.scrollHeight;
|
const divHeight = livestreamCommentsDiv.scrollHeight;
|
||||||
|
@ -261,31 +262,34 @@ export default function LivestreamComments(props: Props) {
|
||||||
{/* top to bottom comment display */}
|
{/* top to bottom comment display */}
|
||||||
{!fetchingComments && commentsByChronologicalOrder.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 &&
|
||||||
<LivestreamComment
|
commentsToDisplay.map((comment) => (
|
||||||
key={comment.comment_id}
|
<LivestreamComment
|
||||||
uri={uri}
|
key={comment.comment_id}
|
||||||
authorUri={comment.channel_url}
|
uri={uri}
|
||||||
commentId={comment.comment_id}
|
authorUri={comment.channel_url}
|
||||||
message={comment.comment}
|
commentId={comment.comment_id}
|
||||||
supportAmount={comment.support_amount}
|
message={comment.comment}
|
||||||
isFiat={comment.is_fiat}
|
supportAmount={comment.support_amount}
|
||||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
isFiat={comment.is_fiat}
|
||||||
/>
|
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||||
))}
|
/>
|
||||||
|
))}
|
||||||
|
|
||||||
{viewMode === VIEW_MODE_SUPER_CHAT && superChatsReversed && superChatsReversed.map((comment) => (
|
{viewMode === VIEW_MODE_SUPER_CHAT &&
|
||||||
<LivestreamComment
|
superChatsReversed &&
|
||||||
key={comment.comment_id}
|
superChatsReversed.map((comment) => (
|
||||||
uri={uri}
|
<LivestreamComment
|
||||||
authorUri={comment.channel_url}
|
key={comment.comment_id}
|
||||||
commentId={comment.comment_id}
|
uri={uri}
|
||||||
message={comment.comment}
|
authorUri={comment.channel_url}
|
||||||
supportAmount={comment.support_amount}
|
commentId={comment.comment_id}
|
||||||
isFiat={comment.is_fiat}
|
message={comment.comment}
|
||||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
supportAmount={comment.support_amount}
|
||||||
/>
|
isFiat={comment.is_fiat}
|
||||||
))}
|
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="main--empty" style={{ flex: 1 }} />
|
<div className="main--empty" style={{ flex: 1 }} />
|
||||||
|
|
Loading…
Reference in a new issue