Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393576
D6292.id21034.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6292.id21034.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6292: [web] Make drawer items react based on the current app
Attached
Detach File
Event Timeline
Log In to Comment