so much answers feature wow

This commit is contained in:
Baptiste Lemoine 2020-11-01 12:29:58 +01:00
parent 6497665819
commit 9e1acd23aa
3 changed files with 57 additions and 50 deletions

View File

@ -72,10 +72,11 @@ class StatusActionBar extends ImmutablePureComponent {
onUnblockDomain : PropTypes.func, onUnblockDomain : PropTypes.func,
onReport : PropTypes.func, onReport : PropTypes.func,
onEmbed : PropTypes.func, onEmbed : PropTypes.func,
onMuteConversation: PropTypes.func, onMuteConversation : PropTypes.func,
onPin : PropTypes.func, onPin : PropTypes.func,
onBookmark : PropTypes.func, onBookmark : PropTypes.func,
withDismiss : PropTypes.bool, withDismiss : PropTypes.bool,
enableSoMuchAnswersWow: PropTypes.bool,
scrollKey : PropTypes.string, scrollKey : PropTypes.string,
intl : PropTypes.object.isRequired, intl : PropTypes.object.isRequired,
}; };
@ -230,7 +231,7 @@ class StatusActionBar extends ImmutablePureComponent {
let menu = []; let menu = [];
menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen , iconName: 'arrow-right' }); menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen, iconName: 'arrow-right' });
if (publicStatus) { if (publicStatus) {
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy, iconName: 'copy' }); menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy, iconName: 'copy' });
@ -239,7 +240,7 @@ class StatusActionBar extends ImmutablePureComponent {
menu.push({ menu.push({
text : intl.formatMessage(status.get('bookmarked') ? messages.removeBookmark : messages.bookmark), text : intl.formatMessage(status.get('bookmarked') ? messages.removeBookmark : messages.bookmark),
action: this.handleBookmarkClick, action : this.handleBookmarkClick,
iconName: 'bookmark', iconName: 'bookmark',
}); });
menu.push(null); menu.push(null);
@ -256,7 +257,7 @@ class StatusActionBar extends ImmutablePureComponent {
if (publicStatus) { if (publicStatus) {
menu.push({ menu.push({
text : intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), text : intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin),
action: this.handlePinClick, action : this.handlePinClick,
iconName: 'gears', iconName: 'gears',
}); });
} }
@ -266,12 +267,12 @@ class StatusActionBar extends ImmutablePureComponent {
} else { } else {
menu.push({ menu.push({
text : intl.formatMessage(messages.mention, { name: account.get('username') }), text : intl.formatMessage(messages.mention, { name: account.get('username') }),
action: this.handleMentionClick, action : this.handleMentionClick,
iconName: 'plane', iconName: 'plane',
}); });
menu.push({ menu.push({
text : intl.formatMessage(messages.direct, { name: account.get('username') }), text : intl.formatMessage(messages.direct, { name: account.get('username') }),
action: this.handleDirectClick, action : this.handleDirectClick,
iconName: 'enveloppe-o', iconName: 'enveloppe-o',
}); });
menu.push(null); menu.push(null);
@ -279,13 +280,13 @@ class StatusActionBar extends ImmutablePureComponent {
if (relationship && relationship.get('muting')) { if (relationship && relationship.get('muting')) {
menu.push({ menu.push({
text : intl.formatMessage(messages.unmute, { name: account.get('username') }), text : intl.formatMessage(messages.unmute, { name: account.get('username') }),
action: this.handleMuteClick, action : this.handleMuteClick,
iconName: 'times', iconName: 'times',
}); });
} else { } else {
menu.push({ menu.push({
text : intl.formatMessage(messages.mute, { name: account.get('username') }), text : intl.formatMessage(messages.mute, { name: account.get('username') }),
action: this.handleMuteClick, action : this.handleMuteClick,
iconName: 'times', iconName: 'times',
}); });
} }
@ -293,20 +294,20 @@ class StatusActionBar extends ImmutablePureComponent {
if (relationship && relationship.get('blocking')) { if (relationship && relationship.get('blocking')) {
menu.push({ menu.push({
text : intl.formatMessage(messages.unblock, { name: account.get('username') }), text : intl.formatMessage(messages.unblock, { name: account.get('username') }),
action: this.handleBlockClick, action : this.handleBlockClick,
iconName: 'plus', iconName: 'plus',
}); });
} else { } else {
menu.push({ menu.push({
text : intl.formatMessage(messages.block, { name: account.get('username') }), text : intl.formatMessage(messages.block, { name: account.get('username') }),
action: this.handleBlockClick, action : this.handleBlockClick,
iconName: 'times', iconName: 'times',
}); });
} }
menu.push({ menu.push({
text : intl.formatMessage(messages.report, { name: account.get('username') }), text : intl.formatMessage(messages.report, { name: account.get('username') }),
action: this.handleReport, action : this.handleReport,
iconName: 'flag', iconName: 'flag',
}); });
@ -325,15 +326,15 @@ class StatusActionBar extends ImmutablePureComponent {
if (isStaff) { if (isStaff) {
menu.push(null); menu.push(null);
menu.push({ menu.push({
text: intl.formatMessage(messages.admin_account, text : intl.formatMessage(messages.admin_account,
{ name: account.get('username') }), { name: account.get('username') }),
href: `/admin/accounts/${status.getIn(['account', 'id'])}`, href : `/admin/accounts/${status.getIn(['account', 'id'])}`,
iconName: 'gears', iconName: 'gears',
}); });
menu.push({ menu.push({
text: intl.formatMessage(messages.admin_status), text : intl.formatMessage(messages.admin_status),
href: `/admin/accounts/${status.getIn(['account', 'id'])}/statuses/${status.get('id')}`, href : `/admin/accounts/${status.getIn(['account', 'id'])}/statuses/${status.get('id')}`,
iconName: 'menu', iconName: 'menu',
}); });
} }
@ -370,6 +371,12 @@ class StatusActionBar extends ImmutablePureComponent {
onClick={this.handleShareClick} onClick={this.handleShareClick}
/> />
); );
let countAnswers = status.get('replies_count') * 1;
const enableSoMuchAnswersWOW = true;
if (enableSoMuchAnswersWOW) {
countAnswers += Math.floor(Math.random() * Math.floor(500000));
}
return ( return (
<div className='status__action-bar'> <div className='status__action-bar'>
@ -378,8 +385,8 @@ class StatusActionBar extends ImmutablePureComponent {
title={replyTitle} title={replyTitle}
icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon}
onClick={this.handleReplyClick} onClick={this.handleReplyClick}
counter={status.get('replies_count')} counter={countAnswers}
obfuscateCount obfuscateCount={false}
/> />
<IconButton <IconButton
className={classNames('status__action-bar-button', { reblogPrivate })} className={classNames('status__action-bar-button', { reblogPrivate })}

View File

@ -52,7 +52,7 @@ class ReplyIndicator extends ImmutablePureComponent {
return ( return (
<div className='reply-indicator'> <div className='reply-indicator'>
<div className='reply-indicator__header'> <div className='reply-indicator__header'>
<div className='reply-indicator__cancel'><IconButton title={intl.formatMessage(messages.cancel)} icon='times' onClick={this.handleClick} inverted /></div> <div className='reply-indicator__cancel'><IconButton title={intl.formatMessage(messages.cancel)} icon='times' onClick={this.handleClick} inverted obfuscate='false' /></div>
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='reply-indicator__display-name'> <a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='reply-indicator__display-name'>
<div className='reply-indicator__display-avatar'><Avatar account={status.get('account')} size={24} /></div> <div className='reply-indicator__display-avatar'><Avatar account={status.get('account')} size={24} /></div>

View File

@ -273,8 +273,8 @@ class ActionBar extends React.PureComponent {
return ( return (
<div className='detailed-status__action-bar'> <div className='detailed-status__action-bar'>
<div className='detailed-status__button'><IconButton title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /></div> <div className='detailed-status__button button_reply'><IconButton title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /></div>
<div className='detailed-status__button' ><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div> <div className='detailed-status__button button_reblog' ><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div>
<div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div> <div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div>
{shareButton} {shareButton}
<div className='detailed-status__button'><IconButton className='bookmark-icon' active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div> <div className='detailed-status__button'><IconButton className='bookmark-icon' active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>