diff --git a/web/invite-links/invite-links-menu.css b/web/components/community-actions-menu.css
similarity index 100%
rename from web/invite-links/invite-links-menu.css
rename to web/components/community-actions-menu.css
diff --git a/web/invite-links/invite-links-menu.react.js b/web/components/community-actions-menu.react.js
similarity index 89%
rename from web/invite-links/invite-links-menu.react.js
rename to web/components/community-actions-menu.react.js
index 51fec87df..04e76081f 100644
--- a/web/invite-links/invite-links-menu.react.js
+++ b/web/components/community-actions-menu.react.js
@@ -1,113 +1,113 @@
// @flow
import * as React from 'react';
import { useModalContext } from 'lib/components/modal-provider.react.js';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { threadHasPermission } from 'lib/shared/thread-utils.js';
import type { InviteLink } from 'lib/types/link-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
-import css from './invite-links-menu.css';
-import ManageInviteLinksModal from './manage-invite-links-modal.react.js';
-import ViewInviteLinkModal from './view-invite-link-modal.react.js';
+import css from './community-actions-menu.css';
import MenuItem from '../components/menu-item.react.js';
import Menu from '../components/menu.react.js';
+import ManageInviteLinksModal from '../invite-links/manage-invite-links-modal.react.js';
+import ViewInviteLinkModal from '../invite-links/view-invite-link-modal.react.js';
import { useSelector } from '../redux/redux-utils.js';
import { AddLink } from '../vectors.react.js';
type Props = {
+communityID: string,
};
-function InviteLinksMenu(props: Props): React.Node {
+function CommunityActionsMenu(props: Props): React.Node {
const { communityID } = props;
const inviteLink: ?InviteLink = useSelector(primaryInviteLinksSelector)[
communityID
];
const { pushModal } = useModalContext();
const community = useSelector(
state => threadInfoSelector(state)[communityID],
);
const canManageLinks = threadHasPermission(
community,
threadPermissions.MANAGE_INVITE_LINKS,
);
const openViewInviteLinkModal = React.useCallback(() => {
if (!inviteLink) {
return;
}
pushModal();
}, [inviteLink, pushModal]);
const openManageInviteLinksModal = React.useCallback(() => {
pushModal();
}, [communityID, pushModal]);
const items = React.useMemo(() => {
const itemSpecs = [];
if (canManageLinks) {
itemSpecs.push({
text: 'Manage invite links',
iconComponent: ,
onClick: openManageInviteLinksModal,
});
}
if (inviteLink) {
itemSpecs.push({
text: 'Invite link',
icon: 'link',
onClick: openViewInviteLinkModal,
});
}
return itemSpecs;
}, [
canManageLinks,
inviteLink,
openManageInviteLinksModal,
openViewInviteLinkModal,
]);
const menuItems = React.useMemo(
() =>
items.map(item => {
if (item.icon) {
return (
);
}
return (
);
}),
[items],
);
const icon = ;
return (
);
}
-export default InviteLinksMenu;
+export default CommunityActionsMenu;
diff --git a/web/sidebar/community-drawer-item-community.react.js b/web/sidebar/community-drawer-item-community.react.js
index 912a27a81..4ff8a7634 100644
--- a/web/sidebar/community-drawer-item-community.react.js
+++ b/web/sidebar/community-drawer-item-community.react.js
@@ -1,100 +1,100 @@
// @flow
import classnames from 'classnames';
import * as React from 'react';
import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js';
import { getCommunityDrawerItemCommunityHandler } from './community-drawer-item-community-handlers.react.js';
import css from './community-drawer-item.css';
import type { DrawerItemProps } from './community-drawer-item.react.js';
import {
getChildren,
getExpandButton,
} from './community-drawer-utils.react.js';
import ThreadAvatar from '../avatars/thread-avatar.react.js';
-import InviteLinksMenu from '../invite-links/invite-links-menu.react.js';
+import CommunityActionsMenu from '../components/community-actions-menu.react.js';
function CommunityDrawerItemCommunity(props: DrawerItemProps): React.Node {
const {
itemData: { threadInfo, itemChildren, hasSubchannelsButton, labelStyle },
paddingLeft,
expandable = true,
handlerType,
} = props;
const Handler = getCommunityDrawerItemCommunityHandler(handlerType);
const [handler, setHandler] = React.useState({
onClick: () => {},
isActive: false,
expanded: false,
toggleExpanded: () => {},
});
const children = React.useMemo(
() =>
getChildren({
expanded: handler.expanded,
hasSubchannelsButton,
itemChildren,
paddingLeft,
threadInfo,
expandable,
handlerType,
}),
[
handler.expanded,
hasSubchannelsButton,
itemChildren,
paddingLeft,
threadInfo,
expandable,
handlerType,
],
);
const itemExpandButton = React.useMemo(
() =>
getExpandButton({
expandable,
childrenLength: itemChildren?.length,
hasSubchannelsButton,
onExpandToggled: null,
expanded: handler.expanded,
}),
[expandable, itemChildren?.length, hasSubchannelsButton, handler.expanded],
);
const classes = classnames({
[css.communityBase]: true,
[css.communityExpanded]: handler.expanded,
});
const { uiName } = useResolvedThreadInfo(threadInfo);
const titleLabel = classnames({
[css[labelStyle]]: true,
[css.activeTitle]: handler.isActive,
});
const style = React.useMemo(() => ({ paddingLeft }), [paddingLeft]);
return (
);
}
const MemoizedCommunityDrawerItemCommunity: React.ComponentType =
React.memo(CommunityDrawerItemCommunity);
export default MemoizedCommunityDrawerItemCommunity;