Skip to content

Commit

Permalink
Change: #186 概要画面のkmyblue capabilities表示改善 (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode authored Nov 8, 2023
1 parent 408da2c commit cfa9b18
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
30 changes: 27 additions & 3 deletions app/javascript/mastodon/features/about/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';

import { ReactComponent as ChevronRightIcon } from '@material-symbols/svg-600/outlined/chevron_right.svg';
import { ReactComponent as DisabledIcon } from '@material-symbols/svg-600/outlined/close-fill.svg';
import { ReactComponent as EnabledIcon } from '@material-symbols/svg-600/outlined/done-fill.svg';
import { ReactComponent as ExpandMoreIcon } from '@material-symbols/svg-600/outlined/expand_more.svg';

import { fetchServer, fetchExtendedDescription, fetchDomainBlocks } from 'mastodon/actions/server';
Expand Down Expand Up @@ -101,6 +103,28 @@ class Section extends PureComponent {

}

class CapabilityIcon extends PureComponent {

static propTypes = {
intl: PropTypes.object.isRequired,
state: PropTypes.bool,
};

render () {
const { intl, state } = this.props;

if (state) {
return (
<span className='capability-icon enabled'><Icon id='check' icon={EnabledIcon} title={intl.formatMessage(messages.enabled)} />{intl.formatMessage(messages.enabled)}</span>
);
} else {
return (
<span className='capability-icon disabled'><Icon id='times' icon={DisabledIcon} title={intl.formatMessage(messages.disabled)} />{intl.formatMessage(messages.disabled)}</span>
);
}
}
}

class About extends PureComponent {

static propTypes = {
Expand Down Expand Up @@ -201,13 +225,13 @@ class About extends PureComponent {
{!isLoading && (
<ol className='rules-list'>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.emojiReaction)}: {intl.formatMessage(isEmojiReaction ? messages.enabled : messages.disabled)}</span>
<span className='rules-list__text'>{intl.formatMessage(messages.emojiReaction)}: <CapabilityIcon state={isEmojiReaction} intl={intl} /></span>
</li>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.publicUnlistedVisibility)}: {intl.formatMessage(isPublicUnlistedVisibility ? messages.enabled : messages.disabled)}</span>
<span className='rules-list__text'>{intl.formatMessage(messages.publicUnlistedVisibility)}: <CapabilityIcon state={isPublicUnlistedVisibility} intl={intl} /></span>
</li>
<li>
<span className='rules-list__text'>{intl.formatMessage(messages.localTimeline)}: {intl.formatMessage(isLocalTimeline ? messages.enabled : messages.disabled)}</span>
<span className='rules-list__text'>{intl.formatMessage(messages.localTimeline)}: <CapabilityIcon state={isLocalTimeline} intl={intl} /></span>
</li>
</ol>
)}
Expand Down
14 changes: 14 additions & 0 deletions app/javascript/styles/mastodon/about.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,18 @@ $fluid-breakpoint: $maximum-width + 20px;
border-bottom: 0;
}
}

.capability-icon {
svg {
transform: translateY(4px);
}

&.enabled {
color: green;
}

&.disabled {
color: red;
}
}
}

0 comments on commit cfa9b18

Please # to comment.