Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393595
D6292.id22442.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.id22442.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
@@ -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
Details
Attached
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)
Attached To
Mode
D6292: [web] Make drawer items react based on the current app
Attached
Detach File
Event Timeline
Log In to Comment