// Package imports // import PropTypes from 'prop-types'; import { PureComponent } from 'react'; import { FormattedMessage } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; import EditIcon from '@material-symbols/svg-600/outlined/edit.svg?react'; import HomeIcon from '@material-symbols/svg-600/outlined/home-fill.svg?react'; import InsertChartIcon from '@material-symbols/svg-600/outlined/insert_chart.svg?react'; import PushPinIcon from '@material-symbols/svg-600/outlined/push_pin.svg?react'; import RepeatIcon from '@material-symbols/svg-600/outlined/repeat.svg?react'; import StarIcon from '@material-symbols/svg-600/outlined/star-fill.svg?react'; import { Icon } from 'flavours/glitch/components/icon'; import { me } from 'flavours/glitch/initial_state'; export default class StatusPrepend extends PureComponent { static propTypes = { type: PropTypes.string.isRequired, account: ImmutablePropTypes.map.isRequired, parseClick: PropTypes.func.isRequired, notificationId: PropTypes.number, }; handleClick = (e) => { const { account, parseClick } = this.props; parseClick(e, `/@${account.get('acct')}`); }; Message = () => { const { type, account } = this.props; let link = ( ); switch (type) { case 'featured': return ( ); case 'reblogged_by': return ( ); case 'favourite': return ( ); case 'reblog': return ( ); case 'status': return ( ); case 'poll': if (me === account.get('id')) { return ( ); } else { return ( ); } case 'update': return ( ); } return null; }; render () { const { Message } = this; const { type } = this.props; let iconId, iconComponent; switch(type) { case 'favourite': iconId = 'star'; iconComponent = StarIcon; break; case 'featured': iconId = 'thumb-tack'; iconComponent = PushPinIcon; break; case 'poll': iconId = 'tasks'; iconComponent = InsertChartIcon; break; case 'reblog': case 'reblogged_by': iconId = 'retweet'; iconComponent = RepeatIcon; break; case 'status': iconId = 'bell'; iconComponent = HomeIcon; break; case 'update': iconId = 'pencil'; iconComponent = EditIcon; break; } return !type ? null : ( ); } }