Add bot icon to bot avatars and migrate to newer version of Font Awesome (#8484)
* Migrate to newer version of Font Awesome * Add bot icon to bot avatars
This commit is contained in:
parent
8864009e8d
commit
4b794e134d
9 changed files with 66 additions and 10 deletions
|
@ -13,7 +13,11 @@ exports[`<Avatar /> Autoplay renders a animated avatar 1`] = `
|
|||
"width": "100px",
|
||||
}
|
||||
}
|
||||
/>
|
||||
>
|
||||
<i
|
||||
className="fa fa-fw fa-robot bot-icon"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<Avatar /> Still renders a still avatar 1`] = `
|
||||
|
@ -29,5 +33,9 @@ exports[`<Avatar /> Still renders a still avatar 1`] = `
|
|||
"width": "100px",
|
||||
}
|
||||
}
|
||||
/>
|
||||
>
|
||||
<i
|
||||
className="fa fa-fw fa-robot bot-icon"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -10,6 +10,7 @@ describe('<Avatar />', () => {
|
|||
display_name: 'Alice',
|
||||
avatar: '/animated/alice.gif',
|
||||
avatar_static: '/static/alice.jpg',
|
||||
bot: true,
|
||||
});
|
||||
|
||||
const size = 100;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import BotIcon from './bot_icon';
|
||||
import { autoPlayGif } from '../initial_state';
|
||||
|
||||
export default class Avatar extends React.PureComponent {
|
||||
|
@ -65,7 +66,9 @@ export default class Avatar extends React.PureComponent {
|
|||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave}
|
||||
style={style}
|
||||
/>
|
||||
>
|
||||
<BotIcon account={account} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
23
app/javascript/mastodon/components/bot_icon.js
Normal file
23
app/javascript/mastodon/components/bot_icon.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import React from 'react';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
export default class BotIcon extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
account: ImmutablePropTypes.map.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
const { account } = this.props;
|
||||
|
||||
if (account.get('bot')) {
|
||||
return (
|
||||
<i className='fa fa-fw fa-robot bot-icon' />
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue