This commit is contained in:
mgabdev
2020-05-14 23:17:31 -04:00
parent 59466ccc08
commit a1977ba450
16 changed files with 103 additions and 62 deletions

View File

@@ -83,6 +83,10 @@ export default
@connect(makeMapStateToProps, mapDispatchToProps)
class Comment extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
}
static propTypes = {
indent: PropTypes.number,
intl: PropTypes.object.isRequired,
@@ -118,7 +122,7 @@ class Comment extends ImmutablePureComponent {
}
handleOnReply = () => {
this.props.onReply(this.props.status)
this.props.onReply(this.props.status, this.context.router)
}
handleOnFavorite = () => {

View File

@@ -37,7 +37,7 @@ class FloatingActionButton extends PureComponent {
className={[_s.posFixed, _s.z4, _s.mb15, _s.mr15, _s.bottom55PX, _s.right0].join(' ')}
>
<Button
onClick={onOpenCompose}
to='/compose'
className={[_s.py15, _s.height60PX, _s.saveAreaInsetMR, _s.saveAreaInsetMB, _s.width60PX, _s.justifyContentCenter, _s.alignItemsCenter].join(' ')}
title={message}
aria-label={message}

View File

@@ -1,11 +1,15 @@
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { openSidebar } from '../actions/sidebar'
import { openPopover } from '../actions/popover'
import { BREAKPOINT_EXTRA_SMALL } from '../constants'
import { me } from '../initial_state'
import { makeGetAccount } from '../selectors'
import Responsive from '../features/ui/util/responsive_component'
import { CX } from '../constants'
import {
CX,
POPOVER_NAV_SETTINGS,
} from '../constants'
import Avatar from './avatar'
import BackButton from './back_button'
import Button from './button'
@@ -23,8 +27,11 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(openSidebar())
},
onOpenNavSettingsPopover() {
dispatch(openPopover())
onOpenNavSettingsPopover(targetRef) {
dispatch(openPopover(POPOVER_NAV_SETTINGS, {
targetRef,
position: 'top',
}))
}
})
@@ -42,9 +49,12 @@ class NavigationBar extends ImmutablePureComponent {
onOpenNavSettingsPopover: PropTypes.func.isRequired,
}
handleProfileClick = () => {
// : todo :
// open menu
handleOnOpenNavSettingsPopover = () => {
this.props.onOpenNavSettingsPopover(this.avatarNode)
}
setAvatarNode = (c) => {
this.avatarNode = c
}
render() {
@@ -104,8 +114,9 @@ class NavigationBar extends ImmutablePureComponent {
{
!!account &&
<button
ref={this.setAvatarNode}
title={account.get('display_name')}
onClick={this.handleProfileClick}
onClick={this.handleOnOpenNavSettingsPopover}
className={[_s.height53PX, _s.bgTransparent, _s.outlineNone, _s.cursorPointer, _s.default, _s.justifyContentCenter, _s.ml15].join(' ')}
>
<Avatar account={account} size={32} noHover />

View File

@@ -3,6 +3,7 @@ import {
POPOVER_DATE_PICKER,
POPOVER_EMOJI_PICKER,
POPOVER_GROUP_OPTIONS,
POPOVER_NAV_SETTINGS,
POPOVER_PROFILE_OPTIONS,
POPOVER_REPOST_OPTIONS,
POPOVER_SEARCH,
@@ -16,6 +17,7 @@ import {
DatePickerPopover,
EmojiPickerPopover,
GroupOptionsPopover,
NavSettingsPopover,
ProfileOptionsPopover,
RepostOptionsPopover,
SearchPopover,
@@ -38,6 +40,7 @@ const POPOVER_COMPONENTS = {}
POPOVER_COMPONENTS[POPOVER_DATE_PICKER] = DatePickerPopover
POPOVER_COMPONENTS[POPOVER_EMOJI_PICKER] = EmojiPickerPopover
POPOVER_COMPONENTS[POPOVER_GROUP_OPTIONS] = GroupOptionsPopover
POPOVER_COMPONENTS[POPOVER_NAV_SETTINGS] = NavSettingsPopover
POPOVER_COMPONENTS[POPOVER_PROFILE_OPTIONS] = ProfileOptionsPopover
POPOVER_COMPONENTS[POPOVER_REPOST_OPTIONS] = RepostOptionsPopover
POPOVER_COMPONENTS[POPOVER_SEARCH] = SearchPopover

View File

@@ -86,7 +86,7 @@ class RepostOptionsPopover extends ImmutablePureComponent {
]
handleOnQuote = () => {
this.props.onQuote(this.props.status, this.context.router.history)
this.props.onQuote(this.props.status, this.context.router)
}
handleOnRepost = () => {

View File

@@ -180,6 +180,10 @@ export default
@connect(mapStateToProps, mapDispatchToProps)
class StatusOptionsPopover extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
}
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
groupRelationships: ImmutablePropTypes.map,

View File

@@ -137,36 +137,36 @@ class SidebarXS extends ImmutablePureComponent {
onClick: this.handleSidebarClose,
title: intl.formatMessage(messages.lists),
},
{
icon: 'group',
to: '/follow_requests',
onClick: this.handleSidebarClose,
title: intl.formatMessage(messages.follow_requests),
},
{
icon: 'block',
to: '/blocks',
onClick: this.handleSidebarClose,
title: intl.formatMessage(messages.blocks),
},
{
icon: 'website',
to: '/domain_blocks',
onClick: this.handleSidebarClose,
title: intl.formatMessage(messages.domain_blocks),
},
{
icon: 'audio-mute',
to: '/mutes',
onClick: this.handleSidebarClose,
title: intl.formatMessage(messages.mutes),
},
{
icon: 'report',
to: '/filters',
onClick: this.handleSidebarClose,
title: intl.formatMessage(messages.filters),
},
// {
// icon: 'group',
// to: '/follow_requests',
// onClick: this.handleSidebarClose,
// title: intl.formatMessage(messages.follow_requests),
// },
// {
// icon: 'block',
// to: '/blocks',
// onClick: this.handleSidebarClose,
// title: intl.formatMessage(messages.blocks),
// },
// {
// icon: 'website',
// to: '/settings/domain_blocks',
// onClick: this.handleSidebarClose,
// title: intl.formatMessage(messages.domain_blocks),
// },
// {
// icon: 'audio-mute',
// to: '/mutes',
// onClick: this.handleSidebarClose,
// title: intl.formatMessage(messages.mutes),
// },
// {
// icon: 'report',
// to: '/filters',
// onClick: this.handleSidebarClose,
// title: intl.formatMessage(messages.filters),
// },
{
onClick: this.props.onOpenDisplayModel, //on open display model
title: intl.formatMessage(messages.display),

View File

@@ -284,9 +284,13 @@ class Status extends ImmutablePureComponent {
this.props.onOpenVideo(media, startTime)
}
handleHotkeyReply = e => {
handleHotkeyReply = (e) => {
e.preventDefault()
this.props.onReply(this._properStatus(), this.context.router.history)
this.props.onReply(this._properStatus(), this.context.router)
}
handleOnReply = (status) => {
this.props.onReply(status || this._properStatus(), this.context.router)
}
handleHotkeyFavorite = () => {
@@ -299,7 +303,7 @@ class Status extends ImmutablePureComponent {
handleHotkeyMention = e => {
e.preventDefault()
this.props.onMention(this._properStatus().get('account'), this.context.router.history)
this.props.onMention(this._properStatus().get('account'), this.context.router)
}
handleHotkeyOpen = () => {
@@ -532,7 +536,7 @@ class Status extends ImmutablePureComponent {
<StatusActionBar
status={status}
onFavorite={this.props.onFavorite}
onReply={this.props.onReply}
onReply={this.handleOnReply}
onRepost={this.props.onRepost}
onShare={this.props.onShare}
onOpenLikes={this.props.onOpenLikes}