diff --git a/web/sidebar/community-drawer-item.react.js b/web/sidebar/community-drawer-item.react.js --- a/web/sidebar/community-drawer-item.react.js +++ b/web/sidebar/community-drawer-item.react.js @@ -6,10 +6,7 @@ import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react'; import { useSelector } from '../redux/redux-utils'; -import { - useOnClickThread, - useThreadIsActive, -} from '../selectors/thread-selectors'; +import { getCommunityDrawerItemHandler } from './community-drawer-item-handlers.react'; import css from './community-drawer-item.css'; import { ExpandButton } from './expand-buttons.react'; import SubchannelsButton from './subchannels-button.react'; @@ -69,27 +66,23 @@ ); }, [itemChildren?.length, hasSubchannelsButton, onExpandToggled, expanded]); - const active = useThreadIsActive(threadInfo.id); - const isCreateMode = useSelector( - state => state.navInfo.chatMode === 'create', - ); - const onClick = useOnClickThread(threadInfo); - const selectItemIfNotActiveCreation = React.useCallback( - (event: SyntheticEvent) => { - if (!isCreateMode || !active) { - onClick(event); - } - }, - [isCreateMode, active, onClick], + const Handler = useSelector(state => + getCommunityDrawerItemHandler(state.navInfo.tab), ); + const [handler, setHandler] = React.useState({ + // eslint-disable-next-line no-unused-vars + onClick: event => {}, + }); + const titleLabel = classnames(css.title, css[labelStyle]); return ( <> +
{itemExpandButton} - +
{threadInfo.uiName}