Skip to content

Commit

Permalink
??
Browse files Browse the repository at this point in the history
  • Loading branch information
Ember-ruby committed Jan 22, 2024
1 parent 998911d commit 6472d4c
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions app/javascript/flavours/glitch/components/status_action_bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import { withRouter } from 'react-router-dom';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';

import BookmarkIcon from '@/material-icons/400-24px/bookmark-fill.svg?react';

Check failure on line 11 in app/javascript/flavours/glitch/components/status_action_bar.jsx

View workflow job for this annotation

GitHub Actions / lint

'BookmarkIcon' is defined but never used
import BookmarkBorderIcon from '@/material-icons/400-24px/bookmark.svg?react';

Check failure on line 12 in app/javascript/flavours/glitch/components/status_action_bar.jsx

View workflow job for this annotation

GitHub Actions / lint

'BookmarkBorderIcon' is defined but never used
import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react';
import RepeatIcon from '@/material-icons/400-24px/repeat.svg?react';
import ReplyIcon from '@/material-icons/400-24px/reply.svg?react';
import ReplyAllIcon from '@/material-icons/400-24px/reply_all.svg?react';
import StarIcon from '@/material-icons/400-24px/star-fill.svg?react';

Check failure on line 17 in app/javascript/flavours/glitch/components/status_action_bar.jsx

View workflow job for this annotation

GitHub Actions / lint

'StarIcon' is defined but never used
import StarBorderIcon from '@/material-icons/400-24px/star.svg?react';

Check failure on line 18 in app/javascript/flavours/glitch/components/status_action_bar.jsx

View workflow job for this annotation

GitHub Actions / lint

'StarBorderIcon' is defined but never used
import VisibilityIcon from '@/material-icons/400-24px/visibility.svg?react';
import RepeatDisabledIcon from '@/svg-icons/repeat_disabled.svg';
import RepeatPrivateIcon from '@/svg-icons/repeat_private.svg';
import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'flavours/glitch/permissions';
import { accountAdminLink, statusAdminLink } from 'flavours/glitch/utils/backend_links';
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
Expand Down Expand Up @@ -217,6 +228,7 @@ class StatusActionBar extends ImmutablePureComponent {
let menu = [];
let reblogIcon = 'retweet';
let replyIcon;
let replyIconComponent;
let replyTitle;

menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen });
Expand Down Expand Up @@ -286,27 +298,34 @@ class StatusActionBar extends ImmutablePureComponent {

if (status.get('in_reply_to_id', null) === null) {
replyIcon = 'reply';
replyIconComponent = ReplyIcon;
replyTitle = intl.formatMessage(messages.reply);
} else {
replyIcon = 'reply-all';
replyIconComponent = ReplyAllIcon;
replyTitle = intl.formatMessage(messages.replyAll);
}

const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';

let reblogTitle = '';
let reblogTitle, reblogIconComponent;

if (status.get('reblogged')) {
reblogTitle = intl.formatMessage(messages.cancel_reblog_private);
reblogIconComponent = publicStatus ? RepeatIcon : RepeatPrivateIcon;
} else if (publicStatus) {
reblogTitle = intl.formatMessage(messages.reblog);
reblogIconComponent = RepeatIcon;
} else if (reblogPrivate) {
reblogTitle = intl.formatMessage(messages.reblog_private);
reblogIconComponent = RepeatPrivateIcon;
} else {
reblogTitle = intl.formatMessage(messages.cannot_reblog);
reblogIconComponent = RepeatDisabledIcon;

Check failure on line 324 in app/javascript/flavours/glitch/components/status_action_bar.jsx

View workflow job for this annotation

GitHub Actions / lint

'reblogIconComponent' is assigned a value but never used
}

const filterButton = this.props.onFilter && (
<IconButton className='status__action-bar-button' title={intl.formatMessage(messages.hide)} icon='eye' onClick={this.handleHideClick} />
<IconButton className='status__action-bar-button' title={intl.formatMessage(messages.hide)} icon='eye' iconComponent={VisibilityIcon} onClick={this.handleHideClick} />
);

const canReact = permissions && status.get('reactions').filter(r => r.get('count') > 0 && r.get('me')).size < maxReactions;
Expand All @@ -326,32 +345,27 @@ class StatusActionBar extends ImmutablePureComponent {
className='status__action-bar-button'
title={replyTitle}
icon={replyIcon}
iconComponent={replyIconComponent}
onClick={this.handleReplyClick}
counter={showReplyCount ? status.get('replies_count') : undefined}
obfuscateCount
/>
<IconButton className={classNames('status__action-bar-button', { reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} title={reblogTitle} icon={reblogIcon} onClick={this.handleReblogClick} counter={withCounters ? status.get('reblogs_count') : undefined} />
<IconButton className='status__action-bar-button star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} counter={withCounters ? status.get('favourites_count') : undefined} />
{
permissions
? <EmojiPickerDropdown className='status__action-bar-button' onPickEmoji={this.handleEmojiPick} button={reactButton} disabled={!canReact} />
: reactButton
}
<IconButton className='status__action-bar-button bookmark-icon' disabled={!signedIn} active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />

{filterButton}

<div className='status__action-bar-dropdown'>
<DropdownMenuContainer
scrollKey={scrollKey}
status={status}
items={menu}
icon='ellipsis-h'
size={18}
direction='right'
ariaLabel={intl.formatMessage(messages.more)}
/>
</div>
<DropdownMenuContainer
scrollKey={scrollKey}
status={status}
items={menu}
icon='ellipsis-h'
size={18}
iconComponent={MoreHorizIcon}
direction='right'
ariaLabel={intl.formatMessage(messages.more)}
/>

<div className='status__action-bar-spacer' />
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'>
Expand Down

0 comments on commit 6472d4c

Please sign in to comment.