diff --git a/app/javascript/gabsocial/components/modal/group_members_modal.js b/app/javascript/gabsocial/components/modal/group_members_modal.js deleted file mode 100644 index 7ff10161..00000000 --- a/app/javascript/gabsocial/components/modal/group_members_modal.js +++ /dev/null @@ -1,37 +0,0 @@ -import { defineMessages, injectIntl } from 'react-intl' -import ModalLayout from './modal_layout' -import GroupMembers from '../../features/group_members' - -const messages = defineMessages({ - title: { id: 'group_members', defaultMessage: 'Group members' }, -}) - -export default -@injectIntl -class GroupMembersModal extends PureComponent { - - static propTypes = { - groupId: PropTypes.string.isRequired, - intl: PropTypes.object.isRequired, - onClose: PropTypes.func.isRequired, - } - - render() { - const { - intl, - onClose, - groupId, - } = this.props - - return ( - - - - ) - } -} diff --git a/app/javascript/gabsocial/components/modal/group_removed_accounts_modal.js b/app/javascript/gabsocial/components/modal/group_removed_accounts_modal.js deleted file mode 100644 index 3c411c99..00000000 --- a/app/javascript/gabsocial/components/modal/group_removed_accounts_modal.js +++ /dev/null @@ -1,37 +0,0 @@ -import { defineMessages, injectIntl } from 'react-intl' -import ModalLayout from './modal_layout' -import GroupRemovedAccounts from '../../features/group_removed_accounts' - -const messages = defineMessages({ - title: { id: 'group_removed', defaultMessage: 'Removed accounts' }, -}) - -export default -@injectIntl -class GroupRemovedAccountsModal extends PureComponent { - - static propTypes = { - groupId: PropTypes.string.isRequired, - intl: PropTypes.object.isRequired, - onClose: PropTypes.func.isRequired, - } - - render() { - const { - intl, - onClose, - groupId, - } = this.props - - return ( - - - - ) - } -} diff --git a/app/javascript/gabsocial/components/modal/modal_root.js b/app/javascript/gabsocial/components/modal/modal_root.js index bb076a27..e478547d 100644 --- a/app/javascript/gabsocial/components/modal/modal_root.js +++ b/app/javascript/gabsocial/components/modal/modal_root.js @@ -17,8 +17,6 @@ import { MODAL_GIF_PICKER, MODAL_GROUP_CREATE, MODAL_GROUP_DELETE, - MODAL_GROUP_MEMBERS, - MODAL_GROUP_REMOVED_ACCOUNTS, MODAL_HASHTAG_TIMELINE_SETTINGS, MODAL_HOME_TIMELINE_SETTINGS, MODAL_HOTKEYS, @@ -86,8 +84,6 @@ MODAL_COMPONENTS[MODAL_EMBED] = EmbedModal MODAL_COMPONENTS[MODAL_GIF_PICKER] = GifPickerModal MODAL_COMPONENTS[MODAL_GROUP_CREATE] = GroupCreateModal MODAL_COMPONENTS[MODAL_GROUP_DELETE] = GroupDeleteModal -MODAL_COMPONENTS[MODAL_GROUP_MEMBERS] = GroupMembersModal -MODAL_COMPONENTS[MODAL_GROUP_REMOVED_ACCOUNTS] = GroupRemovedAccountsModal MODAL_COMPONENTS[MODAL_HASHTAG_TIMELINE_SETTINGS] = HashtagTimelineSettingsModal MODAL_COMPONENTS[MODAL_HOME_TIMELINE_SETTINGS] = HomeTimelineSettingsModal MODAL_COMPONENTS[MODAL_HOTKEYS] = HotkeysModal diff --git a/app/javascript/gabsocial/components/popover/group_options_popover.js b/app/javascript/gabsocial/components/popover/group_options_popover.js index 1b80887f..222fcea2 100644 --- a/app/javascript/gabsocial/components/popover/group_options_popover.js +++ b/app/javascript/gabsocial/components/popover/group_options_popover.js @@ -1,16 +1,10 @@ import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' import { defineMessages, injectIntl } from 'react-intl' -import { - MODAL_GROUP_CREATE, - MODAL_GROUP_MEMBERS, - MODAL_GROUP_REMOVED_ACCOUNTS, -} from '../../constants' import { addShortcut, removeShortcut, } from '../../actions/shortcuts' -import { openModal } from '../../actions/modal' import { closePopover } from '../../actions/popover' import PopoverLayout from './popover_layout' import List from '../list' @@ -33,19 +27,6 @@ const mapStateToProps = (state, { group }) => { } const mapDispatchToProps = (dispatch) => ({ - - onOpenEditGroup(groupId) { - dispatch(closePopover()) - dispatch(openModal(MODAL_GROUP_CREATE, { groupId })) - }, - onOpenRemovedMembers(groupId) { - dispatch(closePopover()) - dispatch(openModal(MODAL_GROUP_REMOVED_ACCOUNTS, { groupId })) - }, - onOpenGroupMembers(groupId) { - dispatch(closePopover()) - dispatch(openModal(MODAL_GROUP_MEMBERS, { groupId })) - }, onClosePopover: () => dispatch(closePopover()), onAddShortcut(groupId) { dispatch(addShortcut('group', groupId)) @@ -53,7 +34,6 @@ const mapDispatchToProps = (dispatch) => ({ onRemoveShortcut(groupId) { dispatch(removeShortcut(null, 'group', groupId)) }, - }) export default @@ -70,21 +50,6 @@ class GroupOptionsPopover extends ImmutablePureComponent { onAddShortcut: PropTypes.func.isRequired, onRemoveShortcut: PropTypes.func.isRequired, onClosePopover: PropTypes.func.isRequired, - onOpenEditGroup: PropTypes.func.isRequired, - onOpenGroupMembers: PropTypes.func.isRequired, - onOpenRemovedMembers: PropTypes.func.isRequired, - } - - handleEditGroup = () => { - this.props.onOpenEditGroup(this.props.group.get('id')) - } - - handleOnOpenRemovedMembers = () => { - this.props.onOpenRemovedMembers(this.props.group.get('id')) - } - - handleOnOpenGroupMembers = () => { - this.props.onOpenGroupMembers(this.props.group.get('id')) } handleOnClosePopover = () => { @@ -102,32 +67,40 @@ class GroupOptionsPopover extends ImmutablePureComponent { render() { const { + group, intl, isAdmin, isShortcut, isXS, } = this.props + if (!group) return
+ + const groupId = group.get('id') + const listItems = [ { hideArrow: true, icon: 'group', title: intl.formatMessage(messages.groupMembers), - onClick: this.handleOnOpenGroupMembers, + onClick: this.handleOnClosePopover, + to: `/groups/${groupId}/members`, isHidden: !isAdmin, }, { hideArrow: true, icon: 'block', title: intl.formatMessage(messages.removedMembers), - onClick: this.handleOnOpenRemovedMembers, + onClick: this.handleOnClosePopover, + to: `/groups/${groupId}/removed-accounts`, isHidden: !isAdmin, }, { hideArrow: true, icon: 'pencil', title: intl.formatMessage(messages.editGroup), - onClick: this.handleEditGroup, + onClick: this.handleOnClosePopover, + to: `/groups/${groupId}/edit`, isHidden: !isAdmin, }, { diff --git a/app/javascript/gabsocial/constants.js b/app/javascript/gabsocial/constants.js index cb988bb0..33a43497 100644 --- a/app/javascript/gabsocial/constants.js +++ b/app/javascript/gabsocial/constants.js @@ -50,8 +50,6 @@ export const MODAL_EMBED = 'EMBED' export const MODAL_GIF_PICKER = 'GIF_PICKER' export const MODAL_GROUP_CREATE = 'GROUP_CREATE' export const MODAL_GROUP_DELETE = 'GROUP_DELETE' -export const MODAL_GROUP_MEMBERS = 'GROUP_MEMBERS' -export const MODAL_GROUP_REMOVED_ACCOUNTS = 'GROUP_REMOVED_ACCOUNTS' export const MODAL_HASHTAG_TIMELINE_SETTINGS = 'HASHTAG_TIMELINE_SETTINGS' export const MODAL_HOME_TIMELINE_SETTINGS = 'HOME_TIMELINE_SETTINGS' export const MODAL_HOTKEYS = 'HOTKEYS' diff --git a/app/javascript/gabsocial/features/ui/util/async_components.js b/app/javascript/gabsocial/features/ui/util/async_components.js index 492d8780..1b9053bf 100644 --- a/app/javascript/gabsocial/features/ui/util/async_components.js +++ b/app/javascript/gabsocial/features/ui/util/async_components.js @@ -34,12 +34,10 @@ export function GroupCreate() { return import(/* webpackChunkName: "features/gro export function GroupCreateModal() { return import(/* webpackChunkName: "components/group_create_modal" */'../../../components/modal/group_create_modal') } export function GroupDeleteModal() { return import(/* webpackChunkName: "components/group_delete_modal" */'../../../components/modal/group_delete_modal') } export function GroupListSortOptionsPopover() { return import(/* webpackChunkName: "components/group_list_sort_options_popover" */'../../../components/popover/group_list_sort_options_popover') } -export function GroupMembersModal() { return import(/* webpackChunkName: "components/group_members_modal" */'../../../components/modal/group_members_modal') } export function GroupMemberOptionsPopover() { return import(/* webpackChunkName: "components/group_member_options_popover" */'../../../components/popover/group_member_options_popover') } export function GroupMembers() { return import(/* webpackChunkName: "features/group_members" */'../../group_members') } export function GroupOptionsPopover() { return import(/* webpackChunkName: "components/group_options_popover" */'../../../components/popover/group_options_popover') } export function GroupRemovedAccounts() { return import(/* webpackChunkName: "features/group_removed_accounts" */'../../group_removed_accounts') } -export function GroupRemovedAccountsModal() { return import(/* webpackChunkName: "components/group_removed_accounts_modal" */'../../../components/modal/group_removed_accounts_modal') } export function GroupTimeline() { return import(/* webpackChunkName: "features/group_timeline" */'../../group_timeline') } export function HashtagTimeline() { return import(/* webpackChunkName: "features/hashtag_timeline" */'../../hashtag_timeline') } export function HashtagTimelineSettingsModal() { return import(/* webpackChunkName: "components/hashtag_timeline_settings_modal" */'../../../components/modal/hashtag_timeline_settings_modal') }