From 81ef21a0c802f1d905f37a2a818544a8b400793c Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Sat, 25 Feb 2023 14:34:32 +0100 Subject: [Glitch] Rename JSX files with proper `.jsx` extension Port 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/components/status_prepend.jsx | 144 +++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 app/javascript/flavours/glitch/components/status_prepend.jsx (limited to 'app/javascript/flavours/glitch/components/status_prepend.jsx') diff --git a/app/javascript/flavours/glitch/components/status_prepend.jsx b/app/javascript/flavours/glitch/components/status_prepend.jsx new file mode 100644 index 000000000..8c4343b04 --- /dev/null +++ b/app/javascript/flavours/glitch/components/status_prepend.jsx @@ -0,0 +1,144 @@ +// Package imports // +import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { FormattedMessage } from 'react-intl'; +import Icon from 'flavours/glitch/components/icon'; +import { me } from 'flavours/glitch/initial_state'; + +export default class StatusPrepend extends React.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; + + switch(type) { + case 'favourite': + iconId = 'star'; + break; + case 'featured': + iconId = 'thumb-tack'; + break; + case 'poll': + iconId = 'tasks'; + break; + case 'reblog': + case 'reblogged_by': + iconId = 'retweet'; + break; + case 'status': + iconId = 'bell'; + break; + case 'update': + iconId = 'pencil'; + break; + } + + return !type ? null : ( + + ); + } + +} -- cgit