Page MenuHomePhabricator

D6292.diff
No OneTemporary

D6292.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
Thu, Nov 28, 5:36 PM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594533
Default Alt Text
D6292.diff (2 KB)

Event Timeline