diff options
author | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
commit | 4fe1689de43f4404eb9530fcfbcbfb26d6c1c13a (patch) | |
tree | 6811b845bb7f4966b10dcefa3dea404246f161c7 /app/javascript/flavours/glitch/features/list_adder/components/list.js | |
parent | 65c1e53a32cabcdbb7bca57002bb0f6acdebe07e (diff) | |
parent | bed63f6dae0879ac840066b031229e0d139089cd (diff) |
Diffstat (limited to 'app/javascript/flavours/glitch/features/list_adder/components/list.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/list_adder/components/list.js | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/app/javascript/flavours/glitch/features/list_adder/components/list.js b/app/javascript/flavours/glitch/features/list_adder/components/list.js deleted file mode 100644 index 4666ca47b..000000000 --- a/app/javascript/flavours/glitch/features/list_adder/components/list.js +++ /dev/null @@ -1,69 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import IconButton from '../../../components/icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; -import { removeFromListAdder, addToListAdder } from '../../../actions/lists'; -import Icon from 'flavours/glitch/components/icon'; - -const messages = defineMessages({ - remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' }, - add: { id: 'lists.account.add', defaultMessage: 'Add to list' }, -}); - -const MapStateToProps = (state, { listId, added }) => ({ - list: state.get('lists').get(listId), - added: typeof added === 'undefined' ? state.getIn(['listAdder', 'lists', 'items']).includes(listId) : added, -}); - -const mapDispatchToProps = (dispatch, { listId }) => ({ - onRemove: () => dispatch(removeFromListAdder(listId)), - onAdd: () => dispatch(addToListAdder(listId)), -}); - -export default @connect(MapStateToProps, mapDispatchToProps) -@injectIntl -class List extends ImmutablePureComponent { - - static propTypes = { - list: ImmutablePropTypes.map.isRequired, - intl: PropTypes.object.isRequired, - onRemove: PropTypes.func.isRequired, - onAdd: PropTypes.func.isRequired, - added: PropTypes.bool, - }; - - static defaultProps = { - added: false, - }; - - render () { - const { list, intl, onRemove, onAdd, added } = this.props; - - let button; - - if (added) { - button = <IconButton icon='times' title={intl.formatMessage(messages.remove)} onClick={onRemove} />; - } else { - button = <IconButton icon='plus' title={intl.formatMessage(messages.add)} onClick={onAdd} />; - } - - return ( - <div className='list'> - <div className='list__wrapper'> - <div className='list__display-name'> - <Icon id='list-ul' className='column-link__icon' fixedWidth /> - {list.get('title')} - </div> - - <div className='account__relationship'> - {button} - </div> - </div> - </div> - ); - } - -} |