diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-20 19:39:18 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-20 19:39:58 +0100 |
commit | 38dd85daab8e8342ec608d24cf81254c0dfde95c (patch) | |
tree | 33502dcbfd0af447fb5b1ef7147485c8c9de95b0 /app/assets/javascripts/components/features/followers | |
parent | da2ef4d676ff71e6ab3edf8d1a7cee8bf6b6d353 (diff) |
Adding notifications column
Diffstat (limited to 'app/assets/javascripts/components/features/followers')
3 files changed, 1 insertions, 130 deletions
diff --git a/app/assets/javascripts/components/features/followers/components/account.jsx b/app/assets/javascripts/components/features/followers/components/account.jsx deleted file mode 100644 index 4a1fca6da..000000000 --- a/app/assets/javascripts/components/features/followers/components/account.jsx +++ /dev/null @@ -1,99 +0,0 @@ -import PureRenderMixin from 'react-addons-pure-render-mixin'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; -import { Link } from 'react-router'; -import IconButton from '../../../components/icon_button'; -import { defineMessages, injectIntl } from 'react-intl'; - -const messages = defineMessages({ - follow: { id: 'account.follow', defaultMessage: 'Follow' } -}); - -const outerStyle = { - padding: '10px', - borderBottom: '1px solid #363c4b' -}; - -const itemStyle = { - flex: '1 1 auto', - display: 'block', - color: '#9baec8', - overflow: 'hidden', - textDecoration: 'none', - fontSize: '14px' -}; - -const noteStyle = { - paddingTop: '5px', - fontSize: '12px', - color: '#616b86' -}; - -const buttonsStyle = { - padding: '10px' -}; - -const Account = React.createClass({ - - propTypes: { - account: ImmutablePropTypes.map.isRequired, - me: React.PropTypes.number.isRequired, - onFollow: React.PropTypes.func.isRequired, - withNote: React.PropTypes.bool - }, - - getDefaultProps () { - return { - withNote: true - }; - }, - - mixins: [PureRenderMixin], - - handleFollow () { - this.props.onFollow(this.props.account); - }, - - render () { - const { account, me, withNote, intl } = this.props; - - if (!account) { - return <div />; - } - - let note, buttons; - - if (account.get('note').length > 0 && withNote) { - note = <div style={noteStyle}>{account.get('note')}</div>; - } - - if (account.get('id') !== me) { - const following = account.getIn(['relationship', 'following']); - - buttons = ( - <div style={buttonsStyle}> - <IconButton icon={following ? 'user-times' : 'user-plus'} title={intl.formatMessage(messages.follow)} onClick={this.handleFollow} active={following} /> - </div> - ); - } - - return ( - <div style={outerStyle}> - <div style={{ display: 'flex' }}> - <Link key={account.get('id')} style={itemStyle} className='account__display-name' to={`/accounts/${account.get('id')}`}> - <div style={{ float: 'left', marginRight: '10px' }}><Avatar src={account.get('avatar')} size={36} /></div> - <DisplayName account={account} /> - </Link> - - {buttons} - </div> - - {note} - </div> - ); - } - -}); - -export default injectIntl(Account); diff --git a/app/assets/javascripts/components/features/followers/containers/account_container.jsx b/app/assets/javascripts/components/features/followers/containers/account_container.jsx deleted file mode 100644 index c5d5c5881..000000000 --- a/app/assets/javascripts/components/features/followers/containers/account_container.jsx +++ /dev/null @@ -1,30 +0,0 @@ -import { connect } from 'react-redux'; -import { makeGetAccount } from '../../../selectors'; -import Account from '../components/account'; -import { - followAccount, - unfollowAccount -} from '../../../actions/accounts'; - -const makeMapStateToProps = () => { - const getAccount = makeGetAccount(); - - const mapStateToProps = (state, props) => ({ - account: getAccount(state, props.id), - me: state.getIn(['meta', 'me']) - }); - - return mapStateToProps; -}; - -const mapDispatchToProps = (dispatch) => ({ - onFollow (account) { - if (account.getIn(['relationship', 'following'])) { - dispatch(unfollowAccount(account.get('id'))); - } else { - dispatch(followAccount(account.get('id'))); - } - } -}); - -export default connect(makeMapStateToProps, mapDispatchToProps)(Account); diff --git a/app/assets/javascripts/components/features/followers/index.jsx b/app/assets/javascripts/components/features/followers/index.jsx index 13eed69ca..38755d862 100644 --- a/app/assets/javascripts/components/features/followers/index.jsx +++ b/app/assets/javascripts/components/features/followers/index.jsx @@ -7,7 +7,7 @@ import { expandFollowers } from '../../actions/accounts'; import { ScrollContainer } from 'react-router-scroll'; -import AccountContainer from './containers/account_container'; +import AccountContainer from '../../containers/account_container'; const mapStateToProps = (state, props) => ({ accountIds: state.getIn(['user_lists', 'followers', Number(props.params.accountId), 'items']) |