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-03-14 17:31:29 +00:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
2020-04-23 07:13:29 +01:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl'
|
2020-04-17 06:35:46 +01:00
|
|
|
import Sticky from 'react-stickynode'
|
2020-04-24 04:17:27 +01:00
|
|
|
import {
|
|
|
|
CX,
|
|
|
|
POPOVER_PROFILE_OPTIONS,
|
|
|
|
PLACEHOLDER_MISSING_HEADER_SRC,
|
2020-04-28 06:33:58 +01:00
|
|
|
MODAL_EDIT_PROFILE,
|
2020-05-09 03:17:19 +01:00
|
|
|
BREAKPOINT_EXTRA_SMALL,
|
2020-04-24 04:17:27 +01:00
|
|
|
} from '../constants'
|
2020-09-02 23:53:57 +01:00
|
|
|
import {
|
|
|
|
addShortcut,
|
|
|
|
removeShortcut,
|
|
|
|
} from '../actions/shortcuts'
|
2020-04-28 06:33:58 +01:00
|
|
|
import { openModal } from '../actions/modal'
|
2020-04-23 07:13:29 +01:00
|
|
|
import { openPopover } from '../actions/popover'
|
|
|
|
import { me } from '../initial_state'
|
|
|
|
import AccountActionButton from './account_action_button'
|
2020-03-14 17:31:29 +00:00
|
|
|
import Avatar from './avatar'
|
|
|
|
import Button from './button'
|
|
|
|
import DisplayName from './display_name'
|
2020-04-07 02:53:23 +01:00
|
|
|
import Image from './image'
|
2020-03-14 17:31:29 +00:00
|
|
|
import TabBar from './tab_bar'
|
2020-08-07 05:07:45 +01:00
|
|
|
import Pills from './pills'
|
2020-04-07 02:53:23 +01:00
|
|
|
import Text from './text'
|
2020-05-09 03:17:19 +01:00
|
|
|
import Responsive from '../features/ui/util/responsive_component';
|
2020-07-29 21:40:47 +01:00
|
|
|
import ProfileHeaderXSPlaceholder from './placeholder/profile_header_xs_placeholder'
|
2020-03-14 17:31:29 +00:00
|
|
|
|
|
|
|
class ProfileHeader extends ImmutablePureComponent {
|
|
|
|
|
2020-04-17 06:35:46 +01:00
|
|
|
state = {
|
|
|
|
stickied: false,
|
|
|
|
}
|
|
|
|
|
2020-04-28 06:33:58 +01:00
|
|
|
handleOnEditProfile = () => {
|
|
|
|
this.props.onEditProfile()
|
|
|
|
}
|
|
|
|
|
2020-03-14 17:31:29 +00:00
|
|
|
handleOpenMore = () => {
|
|
|
|
const { openProfileOptionsPopover, account } = this.props
|
2020-04-24 04:17:27 +01:00
|
|
|
|
2020-03-14 17:31:29 +00:00
|
|
|
openProfileOptionsPopover({
|
2020-04-24 04:17:27 +01:00
|
|
|
account,
|
2020-03-14 17:31:29 +00:00
|
|
|
targetRef: this.openMoreNode,
|
2020-07-25 00:57:49 +01:00
|
|
|
position: 'left',
|
2020-03-14 17:31:29 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-09-02 23:53:57 +01:00
|
|
|
handleToggleShortcut = () => {
|
|
|
|
const { account, isShortcut } = this.props
|
|
|
|
const accountId = !!account ? account.get('id') : null
|
|
|
|
|
|
|
|
if (!accountId) return
|
|
|
|
|
|
|
|
if (isShortcut) {
|
|
|
|
this.props.onRemoveShortcut(accountId)
|
|
|
|
} else {
|
|
|
|
this.props.onAddShortcut(accountId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-17 06:35:46 +01:00
|
|
|
onStickyStateChange = (status) => {
|
2020-04-24 04:17:27 +01:00
|
|
|
if (status.status === Sticky.STATUS_FIXED) {
|
|
|
|
this.setState({ stickied: true })
|
|
|
|
} else {
|
|
|
|
this.setState({ stickied: false })
|
2020-04-17 06:35:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-14 17:31:29 +00:00
|
|
|
setOpenMoreNodeRef = (n) => {
|
|
|
|
this.openMoreNode = n
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-05-09 03:17:19 +01:00
|
|
|
const {
|
|
|
|
account,
|
|
|
|
children,
|
|
|
|
intl,
|
2020-09-02 23:53:57 +01:00
|
|
|
isShortcut,
|
2020-07-29 21:40:47 +01:00
|
|
|
isXS
|
2020-05-09 03:17:19 +01:00
|
|
|
} = this.props
|
2020-04-17 06:35:46 +01:00
|
|
|
const { stickied } = this.state
|
2020-03-14 17:31:29 +00:00
|
|
|
|
2020-07-29 21:40:47 +01:00
|
|
|
if (isXS && !account) {
|
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.z1, _s.w100PC].join(' ')}>
|
|
|
|
<div className={[_s.d, _s.z1, _s.w100PC, _s.boxShadowBlock, _s.bgPrimary].join(' ')}>
|
|
|
|
<div className={[_s.d, _s.w100PC].join(' ')}>
|
2020-07-29 21:40:47 +01:00
|
|
|
<ProfileHeaderXSPlaceholder />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-03-14 17:31:29 +00:00
|
|
|
const tabs = !account ? null : [
|
|
|
|
{
|
|
|
|
to: `/${account.get('acct')}`,
|
2020-04-24 04:17:27 +01:00
|
|
|
title: intl.formatMessage(messages.timeline),
|
2020-03-14 17:31:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
to: `/${account.get('acct')}/comments`,
|
2020-04-24 04:17:27 +01:00
|
|
|
title: intl.formatMessage(messages.comments),
|
2020-03-14 17:31:29 +00:00
|
|
|
},
|
|
|
|
{
|
2020-06-09 00:38:36 +01:00
|
|
|
to: `/${account.get('acct')}/photos`,
|
|
|
|
title: intl.formatMessage(messages.photos),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
to: `/${account.get('acct')}/videos`,
|
|
|
|
title: intl.formatMessage(messages.videos),
|
2020-03-14 17:31:29 +00:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2020-07-25 04:37:26 +01:00
|
|
|
const isMyProfile = !account ? false : account.get('id') === me
|
|
|
|
if (isMyProfile) {
|
|
|
|
tabs.push({
|
|
|
|
to: `/${account.get('acct')}/bookmarks`,
|
|
|
|
title: intl.formatMessage(messages.bookmarks),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-07-29 21:40:47 +01:00
|
|
|
const headerSrc = !!account ? account.get('header') : undefined
|
2020-07-29 21:49:18 +01:00
|
|
|
const headerMissing = !headerSrc ? true : headerSrc.indexOf(PLACEHOLDER_MISSING_HEADER_SRC) > -1
|
2020-04-23 07:13:29 +01:00
|
|
|
const avatarSize = headerMissing ? 75 : 150
|
2020-05-09 03:17:19 +01:00
|
|
|
const top = headerMissing ? -46 : -380
|
2020-04-08 02:06:59 +01:00
|
|
|
|
2020-04-24 04:17:27 +01:00
|
|
|
const avatarContainerClasses = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-04-17 06:35:46 +01:00
|
|
|
circle: 1,
|
2020-04-23 07:13:29 +01:00
|
|
|
mtNeg75PX: !headerMissing,
|
2020-04-24 04:17:27 +01:00
|
|
|
boxShadowProfileAvatar: !headerMissing,
|
2020-04-17 06:35:46 +01:00
|
|
|
})
|
|
|
|
|
2020-04-24 04:17:27 +01:00
|
|
|
const stickyBarContainerClasses = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-04-17 06:35:46 +01:00
|
|
|
flexRow: 1,
|
|
|
|
px15: 1,
|
2020-08-18 21:43:06 +01:00
|
|
|
aiCenter: 1,
|
2020-04-17 06:35:46 +01:00
|
|
|
displayNone: !stickied,
|
|
|
|
})
|
|
|
|
|
2020-04-24 04:17:27 +01:00
|
|
|
const tabBarContainerClasses = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-04-17 06:35:46 +01:00
|
|
|
displayNone: stickied,
|
|
|
|
})
|
|
|
|
|
2020-05-09 03:17:19 +01:00
|
|
|
const mobileAvatarContainerClasses = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-05-09 03:17:19 +01:00
|
|
|
circle: 1,
|
|
|
|
boxShadowProfileAvatar: 1,
|
|
|
|
mtNeg50PX: !headerMissing,
|
|
|
|
})
|
|
|
|
|
2020-05-29 23:12:35 +01:00
|
|
|
const mobileDescriptionContainerClasses = CX({
|
2020-08-18 21:49:11 +01:00
|
|
|
d: 1,
|
2020-08-18 21:43:06 +01:00
|
|
|
w100PC: 1,
|
2020-05-29 23:12:35 +01:00
|
|
|
px15: 1,
|
|
|
|
mt5: !!me,
|
|
|
|
mb10: 1,
|
|
|
|
pt15: !!me,
|
|
|
|
pb10: 1,
|
|
|
|
})
|
|
|
|
|
2020-03-14 17:31:29 +00:00
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.z1, _s.w100PC].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.z1, _s.w100PC, _s.aiCenter, _s.boxShadowBlock, _s.bgPrimary].join(' ')}>
|
2020-03-24 04:39:12 +00:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w100PC].join(' ')}>
|
2020-04-17 06:35:46 +01:00
|
|
|
{
|
2020-04-29 23:32:49 +01:00
|
|
|
!headerMissing &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.h200PX, _s.px10, _s.w100PC, _s.mt10, _s.overflowHidden].join(' ')}>
|
2020-04-29 23:32:49 +01:00
|
|
|
<Image
|
|
|
|
alt={intl.formatMessage(messages.headerPhoto)}
|
2020-08-18 21:43:06 +01:00
|
|
|
className={[_s.topRightRadiusSmall, _s.topLeftRadiusSmall, _s.h100PC].join(' ')}
|
2020-04-29 23:32:49 +01:00
|
|
|
src={headerSrc}
|
2020-10-22 22:57:22 +01:00
|
|
|
expandOnClick
|
2020-04-29 23:32:49 +01:00
|
|
|
/>
|
2020-04-17 06:35:46 +01:00
|
|
|
</div>
|
|
|
|
}
|
2020-05-05 06:16:01 +01:00
|
|
|
{
|
|
|
|
headerMissing &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.h20PX, _s.w100PC].join(' ')} />
|
2020-05-05 06:16:01 +01:00
|
|
|
}
|
2020-03-24 04:39:12 +00:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w100PC].join(' ')}>
|
2020-04-17 06:35:46 +01:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.aiCenter, _s.px15, _s.mb5].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<div className={mobileAvatarContainerClasses}>
|
2020-10-22 22:57:22 +01:00
|
|
|
<Avatar size={100} account={account} noHover expandOnClick />
|
2020-04-29 23:32:49 +01:00
|
|
|
</div>
|
2020-04-17 06:35:46 +01:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.flexNormal, _s.py10].join(' ')}>
|
2020-05-10 04:26:58 +01:00
|
|
|
<DisplayName
|
|
|
|
account={account}
|
|
|
|
isMultiline
|
|
|
|
isLarge
|
|
|
|
isCentered
|
|
|
|
noHover
|
|
|
|
/>
|
2020-04-29 23:32:49 +01:00
|
|
|
</div>
|
2020-04-17 06:35:46 +01:00
|
|
|
</div>
|
2020-04-29 23:32:49 +01:00
|
|
|
|
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.bgPrimary, _s.aiCenter].join(' ')}>
|
2020-04-29 23:32:49 +01:00
|
|
|
{
|
|
|
|
account && account.get('id') === me &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d,_s.py5].join(' ')}>
|
2020-04-29 23:32:49 +01:00
|
|
|
<Button
|
|
|
|
isOutline
|
|
|
|
backgroundColor='none'
|
|
|
|
color='brand'
|
2020-08-18 21:43:06 +01:00
|
|
|
className={[_s.jcCenter, _s.aiCenter].join(' ')}
|
2020-07-17 21:25:05 +01:00
|
|
|
onClick={this.handleOnEditProfile}
|
2020-04-29 23:32:49 +01:00
|
|
|
>
|
|
|
|
<Text color='inherit' weight='bold' size='medium' className={_s.px15}>
|
|
|
|
{intl.formatMessage(messages.editProfile)}
|
|
|
|
</Text>
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2020-05-29 23:12:35 +01:00
|
|
|
account && account.get('id') !== me && !!me &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.py5].join(' ')}>
|
2020-05-29 23:12:35 +01:00
|
|
|
|
2020-09-02 23:53:57 +01:00
|
|
|
<Button
|
|
|
|
icon={isShortcut ? 'star' : 'star-outline'}
|
|
|
|
iconSize='18px'
|
|
|
|
color='brand'
|
|
|
|
backgroundColor='none'
|
|
|
|
className={[_s.jcCenter, _s.aiCenter, _s.px10, _s.mr15].join(' ')}
|
|
|
|
onClick={this.handleToggleShortcut}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className={[_s.d, _s.flexRow, _s.mr15].join(' ')}>
|
2020-05-29 23:12:35 +01:00
|
|
|
<AccountActionButton account={account} />
|
|
|
|
</div>
|
2020-04-29 23:32:49 +01:00
|
|
|
|
2020-05-29 23:12:35 +01:00
|
|
|
<div>
|
2020-04-29 23:32:49 +01:00
|
|
|
<Button
|
|
|
|
isOutline
|
2020-05-29 23:12:35 +01:00
|
|
|
icon='ellipsis'
|
2020-04-29 23:32:49 +01:00
|
|
|
iconSize='18px'
|
|
|
|
iconClassName={_s.inheritFill}
|
|
|
|
color='brand'
|
|
|
|
backgroundColor='none'
|
2020-09-02 23:53:57 +01:00
|
|
|
className={[_s.jcCenter, _s.aiCenter, _s.ml10, _s.px10].join(' ')}
|
2020-05-29 23:12:35 +01:00
|
|
|
onClick={this.handleOpenMore}
|
|
|
|
buttonRef={this.setOpenMoreNodeRef}
|
2020-04-29 23:32:49 +01:00
|
|
|
/>
|
2020-05-09 03:17:19 +01:00
|
|
|
</div>
|
2020-04-29 23:32:49 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
}
|
2020-05-09 03:17:19 +01:00
|
|
|
|
2020-05-29 23:12:35 +01:00
|
|
|
<div className={mobileDescriptionContainerClasses}>
|
2020-05-09 03:17:19 +01:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.mt10, _s.mb10, _s.pt5, _s.w100PC, _s.pr10].join(' ')}>
|
2020-08-07 05:07:45 +01:00
|
|
|
<Pills pills={tabs} />
|
2020-05-09 03:17:19 +01:00
|
|
|
</div>
|
2020-04-29 23:32:49 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-17 06:35:46 +01:00
|
|
|
</div>
|
2020-04-29 23:32:49 +01:00
|
|
|
</div>
|
2020-05-09 03:17:19 +01:00
|
|
|
|
|
|
|
</Responsive>
|
|
|
|
|
|
|
|
{ /** desktop */ }
|
|
|
|
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
|
|
|
|
<Sticky top={top} enabled onStateChange={this.onStickyStateChange}>
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.z1, _s.w100PC, _s.aiCenter, _s.boxShadowBlock, _s.bgPrimary].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w1015PX].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
{
|
|
|
|
!headerMissing &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.h350PX, _s.w100PC, _s.bottomRightRadiusSmall, _s.bottomLeftRadiusSmall, _s.overflowHidden].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<Image
|
|
|
|
alt={intl.formatMessage(messages.headerPhoto)}
|
2020-08-18 21:43:06 +01:00
|
|
|
className={_s.h100PC}
|
2020-05-09 03:17:19 +01:00
|
|
|
src={headerSrc}
|
2020-10-22 22:57:22 +01:00
|
|
|
expandOnClick
|
2020-05-09 03:17:19 +01:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
headerMissing &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.h20PX, _s.w100PC].join(' ')} />
|
2020-05-09 03:17:19 +01:00
|
|
|
}
|
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.w100PC].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.pr15, _s.pl25, _s.mb5].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<div className={avatarContainerClasses}>
|
2020-07-29 21:40:47 +01:00
|
|
|
{
|
|
|
|
account &&
|
2020-10-22 22:57:22 +01:00
|
|
|
<Avatar size={avatarSize} account={account} noHover expandOnClick />
|
2020-07-29 21:40:47 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
!account &&
|
|
|
|
<div
|
2020-08-18 21:49:11 +01:00
|
|
|
className={[_s.d, _s.circle, _s.overflowHidden, _s.bgSecondary].join(' ')}
|
2020-07-29 21:40:47 +01:00
|
|
|
style={{
|
|
|
|
width: `${avatarSize}px`,
|
|
|
|
height: `${avatarSize}px`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
}
|
2020-05-09 03:17:19 +01:00
|
|
|
</div>
|
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.px15, _s.flexNormal, _s.py10].join(' ')}>
|
2020-05-10 04:26:58 +01:00
|
|
|
<DisplayName account={account} isMultiline isLarge noHover />
|
2020-05-09 03:17:19 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.bgPrimary, _s.h53PX].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<div className={tabBarContainerClasses}>
|
|
|
|
<TabBar tabs={tabs} isLarge />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={stickyBarContainerClasses}>
|
|
|
|
<Avatar size={36} account={account} noHover />
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.ml10].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<DisplayName account={account} noUsername noRelationship noHover isLarge />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{
|
|
|
|
account && account.get('id') === me &&
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.mlAuto, _s.py5].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<Button
|
|
|
|
isOutline
|
|
|
|
backgroundColor='none'
|
|
|
|
color='brand'
|
2020-08-18 21:43:06 +01:00
|
|
|
className={[_s.jcCenter, _s.aiCenter].join(' ')}
|
2020-07-17 21:25:05 +01:00
|
|
|
onClick={this.handleOnEditProfile}
|
2020-05-09 03:17:19 +01:00
|
|
|
>
|
|
|
|
<Text color='inherit' weight='bold' size='medium' className={_s.px15}>
|
|
|
|
{intl.formatMessage(messages.editProfile)}
|
|
|
|
</Text>
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
account && account.get('id') !== me &&
|
2020-09-02 23:53:57 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.mlAuto, _s.pb2, _s.pt7].join(' ')}>
|
2020-05-14 21:45:39 +01:00
|
|
|
{
|
|
|
|
!!me &&
|
2020-09-02 23:53:57 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.mr5, _s.aiCenter, _s.jcCenter].join(' ')}>
|
|
|
|
<Button
|
|
|
|
icon={isShortcut ? 'star' : 'star-outline'}
|
|
|
|
iconSize='18px'
|
|
|
|
color='brand'
|
|
|
|
backgroundColor='none'
|
|
|
|
className={[_s.jcCenter, _s.aiCenter, _s.px10, _s.mr10].join(' ')}
|
|
|
|
onClick={this.handleToggleShortcut}
|
|
|
|
/>
|
2020-05-14 21:45:39 +01:00
|
|
|
<Button
|
|
|
|
isOutline
|
|
|
|
icon='ellipsis'
|
|
|
|
iconSize='18px'
|
|
|
|
iconClassName={_s.inheritFill}
|
|
|
|
color='brand'
|
|
|
|
backgroundColor='none'
|
2020-09-02 23:53:57 +01:00
|
|
|
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10].join(' ')}
|
2020-05-14 21:45:39 +01:00
|
|
|
onClick={this.handleOpenMore}
|
|
|
|
buttonRef={this.setOpenMoreNodeRef}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
}
|
2020-05-09 03:17:19 +01:00
|
|
|
|
2020-09-02 23:53:57 +01:00
|
|
|
<div className={[_s.d, _s.flexRow, _s.pb2].join(' ')}>
|
2020-05-09 03:17:19 +01:00
|
|
|
<AccountActionButton account={account} />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Sticky>
|
|
|
|
</Responsive>
|
2020-03-14 17:31:29 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
}
|
|
|
|
|
2020-09-02 23:53:57 +01:00
|
|
|
const mapStateToProps = (state, { account }) => {
|
|
|
|
const accountId = account ? account.get('id') : null
|
|
|
|
const shortcuts = state.getIn(['shortcuts', 'items'])
|
|
|
|
const isShortcut = !!shortcuts.find((s) => {
|
|
|
|
return s.get('shortcut_id') == accountId && s.get('shortcut_type') === 'account'
|
|
|
|
})
|
|
|
|
return { isShortcut }
|
|
|
|
}
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
const messages = defineMessages({
|
|
|
|
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
|
|
|
follows: { id: 'account.follows', defaultMessage: 'Following' },
|
|
|
|
profile: { id: 'account.profile', defaultMessage: 'Profile' },
|
|
|
|
headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' },
|
|
|
|
timeline: { id: 'timeline', defaultMessage: 'Timeline' },
|
|
|
|
comments: { id: 'comments', defaultMessage: 'Comments' },
|
|
|
|
photos: { id: 'photos', defaultMessage: 'Photos' },
|
|
|
|
videos: { id: 'videos', defaultMessage: 'Videos' },
|
|
|
|
bookmarks: { id: 'bookmarks', defaultMessage: 'Bookmarks' },
|
|
|
|
accountFollowsYou: { id: 'account.follows_you', defaultMessage: 'Follows you' },
|
|
|
|
editProfile: { id: "account.edit_profile", defaultMessage: "Edit profile" },
|
|
|
|
})
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
openProfileOptionsPopover(props) {
|
|
|
|
dispatch(openPopover(POPOVER_PROFILE_OPTIONS, props))
|
|
|
|
},
|
|
|
|
onEditProfile() {
|
|
|
|
dispatch(openModal(MODAL_EDIT_PROFILE))
|
|
|
|
},
|
2020-09-02 23:53:57 +01:00
|
|
|
onAddShortcut(accountId) {
|
|
|
|
dispatch(addShortcut('account', accountId))
|
|
|
|
},
|
|
|
|
onRemoveShortcut(accountId) {
|
|
|
|
dispatch(removeShortcut(null, 'account', accountId))
|
|
|
|
},
|
2020-08-18 01:57:35 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
ProfileHeader.propTypes = {
|
|
|
|
account: ImmutablePropTypes.map,
|
|
|
|
children: PropTypes.any,
|
|
|
|
intl: PropTypes.object.isRequired,
|
2020-09-02 23:53:57 +01:00
|
|
|
onAddShortcut: PropTypes.func.isRequired,
|
2020-08-18 01:57:35 +01:00
|
|
|
onEditProfile: PropTypes.func.isRequired,
|
2020-09-02 23:53:57 +01:00
|
|
|
onRemoveShortcut: PropTypes.func.isRequired,
|
2020-08-18 01:57:35 +01:00
|
|
|
openProfileOptionsPopover: PropTypes.func.isRequired,
|
2020-09-02 23:53:57 +01:00
|
|
|
isShortcut: PropTypes.bool.isRequired,
|
2020-08-18 01:57:35 +01:00
|
|
|
isXS: PropTypes.bool,
|
|
|
|
}
|
|
|
|
|
2020-09-02 23:53:57 +01:00
|
|
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ProfileHeader))
|