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,14 +6,11 @@ import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; +import { getCommunityDrawerItemHandler } from './community-drawer-item-handlers.react.js'; import css from './community-drawer-item.css'; import { ExpandButton } from './expand-buttons.react.js'; import SubchannelsButton from './subchannels-button.react.js'; import { useSelector } from '../redux/redux-utils.js'; -import { - useOnClickThread, - useThreadIsActive, -} from '../selectors/thread-selectors.js'; export type DrawerItemProps = { +itemData: CommunityDrawerItemData, @@ -70,28 +67,24 @@ ); }, [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 { uiName } = useResolvedThreadInfo(threadInfo); const titleLabel = classnames(css.title, css[labelStyle]); return ( <> +
{itemExpandButton} - +
{uiName}