Updated StatusSharePopover -> SharePopover, Added group, account share

• Updated:
- StatusSharePopover -> SharePopover

• Added:
- group, account share
- group url in routes.rb
- group url in GroupSerializer.rb
- share buttons in ProfileOptionsPopover, GroupOptionsPopover
This commit is contained in:
mgabdev
2020-12-24 13:27:55 -05:00
parent 0ceccce04a
commit 7dd71a06ca
11 changed files with 119 additions and 49 deletions

View File

@@ -8,7 +8,11 @@ import {
addShortcut,
removeShortcut,
} from '../../actions/shortcuts'
import { closePopover } from '../../actions/popover'
import {
openPopover,
closePopover,
} from '../../actions/popover'
import { POPOVER_SHARE } from '../../constants'
import PopoverLayout from './popover_layout'
import List from '../list'
@@ -27,6 +31,10 @@ class GroupOptionsPopover extends ImmutablePureComponent {
}
}
handleOnShare = () => {
this.props.onShare(this.props.group)
}
render() {
const {
group,
@@ -66,8 +74,16 @@ class GroupOptionsPopover extends ImmutablePureComponent {
to: `/groups/${groupId}/edit`,
isHidden: !isAdmin,
})
listItems.push({})
}
listItems.push({
hideArrow: true,
icon: 'share',
title: 'Share group',
onClick: this.handleOnShare,
})
listItems.push({})
listItems.push({
hideArrow: true,
icon: 'star',
@@ -109,7 +125,7 @@ const mapStateToProps = (state, { group }) => {
return { isShortcut }
}
const mapDispatchToProps = (dispatch) => ({
const mapDispatchToProps = (dispatch, { innerRef }) => ({
onClosePopover: () => dispatch(closePopover()),
onAddShortcut(groupId) {
dispatch(addShortcut('group', groupId))
@@ -117,6 +133,13 @@ const mapDispatchToProps = (dispatch) => ({
onRemoveShortcut(groupId) {
dispatch(removeShortcut(null, 'group', groupId))
},
onShare(group) {
dispatch(openPopover(POPOVER_SHARE, {
innerRef,
group,
position: 'top',
}))
},
})
GroupOptionsPopover.defaultProps = {