Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3299585
D3332.id10134.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3332.id10134.diff
View Options
diff --git a/web/chat/thread-menu.react.js b/web/chat/thread-menu.react.js
--- a/web/chat/thread-menu.react.js
+++ b/web/chat/thread-menu.react.js
@@ -23,6 +23,8 @@
threadPermissions,
} from 'lib/types/thread-types';
+import { useModalContext } from '../modals/modal-provider.react';
+import ThreadSettingsModal from '../modals/threads/thread-settings-modal.react';
import { useSelector } from '../redux/redux-utils';
import SWMansionIcon from '../SWMansionIcon.react';
import ThreadMenuItem from './thread-menu-item.react';
@@ -35,8 +37,26 @@
function ThreadMenu(props: ThreadMenuProps): React.Node {
const [isOpen, setIsOpen] = React.useState(false);
+ const { setModal } = useModalContext();
+
const { threadInfo } = props;
+ const onClickSettings = React.useCallback(
+ () => setModal(<ThreadSettingsModal threadID={threadInfo.id} />),
+ [setModal, threadInfo.id],
+ );
+
+ const settingsItem = React.useMemo(() => {
+ return (
+ <ThreadMenuItem
+ key="settings"
+ text="Settings"
+ icon={faCog}
+ onClick={onClickSettings}
+ />
+ );
+ }, [onClickSettings]);
+
const membersItem = React.useMemo(() => {
if (threadInfo.type === threadTypes.PERSONAL) {
return null;
@@ -117,16 +137,12 @@
}, [threadInfo]);
const menuItems = React.useMemo(() => {
- const settingsItem = (
- <ThreadMenuItem key="settings" text="Settings" icon={faCog} />
- );
const notificationsItem = (
<ThreadMenuItem key="notifications" text="Notifications" icon={faBell} />
);
const separator = <hr key="separator" className={css.separator} />;
// TODO: Enable menu items when the modals are implemented
- const SHOW_SETTINGS = false;
const SHOW_NOTIFICATIONS = false;
const SHOW_MEMBERS = false;
const SHOW_SIDEBAR = false;
@@ -135,7 +151,7 @@
const SHOW_LEAVE_THREAD = false;
const items = [
- SHOW_SETTINGS && settingsItem,
+ settingsItem,
SHOW_NOTIFICATIONS && notificationsItem,
SHOW_MEMBERS && membersItem,
SHOW_SIDEBAR && sidebarItem,
@@ -146,6 +162,7 @@
];
return items.filter(Boolean);
}, [
+ settingsItem,
membersItem,
sidebarItem,
viewSubchannelsItem,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 1:50 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2534876
Default Alt Text
D3332.id10134.diff (2 KB)
Attached To
Mode
D3332: [web] Show settings modal from thread menu
Attached
Detach File
Event Timeline
Log In to Comment