2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-08-17 21:39:25 +01:00
|
|
|
import { connect } from 'react-redux'
|
2020-06-16 03:59:48 +01:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
|
|
|
import { makeGetAccount } from '../selectors'
|
|
|
|
import Avatar from './avatar'
|
|
|
|
import DisplayName from './display_name'
|
2019-08-09 17:06:27 +01:00
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
const makeMapStateToProps = () => {
|
2020-06-16 03:59:48 +01:00
|
|
|
const getAccount = makeGetAccount()
|
2019-08-07 06:02:36 +01:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { id }) => ({
|
|
|
|
account: getAccount(state, id),
|
2020-06-16 03:59:48 +01:00
|
|
|
})
|
2019-08-07 06:02:36 +01:00
|
|
|
|
2020-06-16 03:59:48 +01:00
|
|
|
return mapStateToProps
|
|
|
|
}
|
2019-08-07 06:02:36 +01:00
|
|
|
|
2020-02-24 21:56:07 +00:00
|
|
|
export default
|
|
|
|
@connect(makeMapStateToProps)
|
2019-08-07 06:02:36 +01:00
|
|
|
class AutosuggestAccount extends ImmutablePureComponent {
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
2020-04-11 23:29:19 +01:00
|
|
|
}
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
render () {
|
2020-06-16 03:59:48 +01:00
|
|
|
const { account } = this.props
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
return (
|
2020-06-16 03:59:48 +01:00
|
|
|
<div
|
2020-06-16 04:16:43 +01:00
|
|
|
className={[_s.default, _s.cursorPointer, _s.bgSubtle_onHover, _s.flexRow, _s.py10, _s.alignItemsCenter, _s.px10, _s.borderBottom1PX, _s.borderColorSecondary].join(' ')}
|
2020-06-16 03:59:48 +01:00
|
|
|
title={account.get('acct')}
|
|
|
|
>
|
|
|
|
<Avatar account={account} size={26} />
|
|
|
|
<div className={_s.ml10}>
|
|
|
|
<DisplayName account={account} noRelationship noHover />
|
2019-08-07 06:02:36 +01:00
|
|
|
</div>
|
2019-07-02 08:10:25 +01:00
|
|
|
</div>
|
2020-06-16 03:59:48 +01:00
|
|
|
)
|
2019-07-02 08:10:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|