57 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-02-22 18:26:23 -05:00
import { Fragment } from 'react'
2020-02-08 01:12:01 -05:00
import { NavLink } from 'react-router-dom'
2020-02-05 17:45:48 -05:00
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { me } from '../initial_state'
import { makeGetAccount } from '../selectors'
2020-03-31 12:04:50 -04:00
import Icon from './icon'
2020-02-22 18:26:23 -05:00
import SidebarSectionItem from './sidebar_section_item'
2020-03-27 19:08:19 -04:00
import Text from './text'
2019-08-14 23:04:03 -04:00
const mapStateToProps = state => {
2020-02-05 17:45:48 -05:00
const getAccount = makeGetAccount()
2019-08-14 23:04:03 -04:00
return {
account: getAccount(state, me),
2020-02-05 17:45:48 -05:00
}
}
2019-08-14 23:04:03 -04:00
2020-02-28 10:20:47 -05:00
export default
@connect(mapStateToProps)
2020-02-22 18:26:23 -05:00
class SidebarHeader extends ImmutablePureComponent {
2019-08-14 23:04:03 -04:00
static propTypes = {
account: ImmutablePropTypes.map,
2020-02-08 01:12:01 -05:00
}
render() {
2020-02-22 18:26:23 -05:00
const { account } = this.props
2020-02-08 01:12:01 -05:00
2020-03-31 12:04:50 -04:00
const isPro = account.get('is_pro')
2020-02-08 01:12:01 -05:00
return (
2020-02-22 18:26:23 -05:00
<Fragment>
<h1 className={[_s.default].join(' ')}>
2020-03-27 19:08:19 -04:00
<NavLink to='/' aria-label='Gab' className={[_s.default, _s.flexRow, _s.noSelect, _s.noUnderline, _s.height50PX, _s.cursorPointer, _s.px10].join(' ')}>
2020-04-06 21:53:23 -04:00
<Icon id='gab-logo' className={_s.fillColorBrand} />
2020-03-31 12:04:50 -04:00
{
isPro &&
2020-04-06 21:53:23 -04:00
<Text weight='bold' color='brand' size='extraSmall' className={[_s.pb5].join(' ')}>
2020-03-31 12:04:50 -04:00
PRO
</Text>
}
2020-02-22 18:26:23 -05:00
</NavLink>
</h1>
{
(!!me && !!account) &&
<SidebarSectionItem
image={account.get('avatar')}
title={account.get('acct')}
to={`/${account.get('acct')}`}
/>
}
</Fragment>
2020-02-08 01:12:01 -05:00
)
}
}