Page MenuHomePhabricator

D6292.id22570.diff
No OneTemporary

D6292.id22570.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,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<string>,
@@ -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:00 PM (21 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605301
Default Alt Text
D6292.id22570.diff (2 KB)

Event Timeline