Page MenuHomePhabricator

D6292.id21034.diff
No OneTemporary

D6292.id21034.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
@@ -6,10 +6,8 @@
import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react';
-import {
- useOnClickThread,
- useThreadIsActive,
-} from '../selectors/thread-selectors';
+import { 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';
@@ -72,23 +70,33 @@
const isCreateMode = useSelector(
state => state.navInfo.chatMode === 'create',
);
- const onClick = useOnClickThread(threadInfo);
- const selectItemIfNotActiveCreation = React.useCallback(
+ const tab = useSelector(state => state.navInfo.tab);
+ const Handler = React.useMemo(() => getCommunityDrawerItemHandler(tab), [
+ tab,
+ ]);
+
+ const [handler, setHandler] = React.useState({
+ // eslint-disable-next-line no-unused-vars
+ onClick: event => {},
+ });
+
+ const onClick = React.useCallback(
(event: SyntheticEvent<HTMLAnchorElement>) => {
if (!isCreateMode || !active) {
- onClick(event);
+ handler.onClick(event);
}
},
- [isCreateMode, active, onClick],
+ [isCreateMode, active, handler],
);
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={onClick} className={css.titleWrapper}>
<div className={titleLabel}>{threadInfo.uiName}</div>
</a>
</div>

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 2:55 PM (21 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605285
Default Alt Text
D6292.id21034.diff (1 KB)

Event Timeline