Page MenuHomePhabricator

D6292.id22442.diff
No OneTemporary

D6292.id22442.diff

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
@@ -7,10 +7,7 @@
import { useResolvedThreadInfo } from 'lib/utils/entity-helpers';
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';
@@ -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<HTMLAnchorElement>) => {
- 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 (
<>
+ <Handler setHandler={setHandler} threadInfo={threadInfo} />
<div className={css.threadEntry}>
{itemExpandButton}
- <a onClick={selectItemIfNotActiveCreation} className={css.titleWrapper}>
+ <a onClick={handler.onClick} className={css.titleWrapper}>
<div className={titleLabel}>{uiName}</div>
</a>
</div>

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 3:01 PM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605302
Default Alt Text
D6292.id22442.diff (1 KB)

Event Timeline