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(), + [setModal, threadInfo.id], + ); + + const settingsItem = React.useMemo(() => { + return ( + + ); + }, [onClickSettings]); + const membersItem = React.useMemo(() => { if (threadInfo.type === threadTypes.PERSONAL) { return null; @@ -117,16 +137,12 @@ }, [threadInfo]); const menuItems = React.useMemo(() => { - const settingsItem = ( - - ); const notificationsItem = ( ); const 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,