Page MenuHomePhorge

D6668.1765371125.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D6668.1765371125.diff

diff --git a/web/sidebar/community-drawer-item-handlers.react.js b/web/sidebar/community-drawer-item-handlers.react.js
--- a/web/sidebar/community-drawer-item-handlers.react.js
+++ b/web/sidebar/community-drawer-item-handlers.react.js
@@ -14,7 +14,7 @@
import type { NavigationTab } from '../types/nav-types';
import type { CommunityDrawerItemHandler } from './community-drawer-item-handler.react';
-type HandlerProps = {
+export type HandlerProps = {
+setHandler: (handler: CommunityDrawerItemHandler) => void,
+threadInfo: ThreadInfo,
};
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,8 +6,7 @@
import type { CommunityDrawerItemData } from 'lib/utils/drawer-utils.react';
import { useResolvedThreadInfo } from 'lib/utils/entity-helpers';
-import { useSelector } from '../redux/redux-utils';
-import { getCommunityDrawerItemHandler } from './community-drawer-item-handlers.react';
+import type { HandlerProps } 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';
@@ -18,6 +17,7 @@
+expanded: boolean,
+paddingLeft: number,
+expandable?: boolean,
+ +Handler: React.ComponentType<HandlerProps>,
};
const indentation = 14;
@@ -30,6 +30,7 @@
toggleExpanded,
paddingLeft,
expandable = true,
+ Handler,
} = props;
const children = React.useMemo(() => {
@@ -56,6 +57,7 @@
key={item.threadInfo.id}
paddingLeft={paddingLeft + indentation}
expandable={expandable}
+ Handler={Handler}
/>
));
}, [
@@ -63,8 +65,9 @@
hasSubchannelsButton,
itemChildren,
paddingLeft,
- expandable,
threadInfo,
+ expandable,
+ Handler,
]);
const onExpandToggled = React.useCallback(
@@ -96,10 +99,6 @@
expanded,
]);
- const Handler = useSelector(state =>
- getCommunityDrawerItemHandler(state.navInfo.tab),
- );
-
const [handler, setHandler] = React.useState({
// eslint-disable-next-line no-unused-vars
onClick: event => {},
@@ -132,6 +131,7 @@
+itemData: CommunityDrawerItemData<string>,
+paddingLeft: number,
+expandable?: boolean,
+ +Handler: React.ComponentType<HandlerProps>,
};
function CommunityDrawerItemChat(
diff --git a/web/sidebar/community-drawer.react.js b/web/sidebar/community-drawer.react.js
--- a/web/sidebar/community-drawer.react.js
+++ b/web/sidebar/community-drawer.react.js
@@ -15,6 +15,7 @@
import { ThreadListProvider } from '../chat/thread-list-provider';
import { useSelector } from '../redux/redux-utils';
import CommunityDrawerItemCommunity from './community-drawer-item-community.react';
+import { getCommunityDrawerItemHandler } from './community-drawer-item-handlers.react';
import css from './community-drawer.css';
const maxDepth = 2;
@@ -45,6 +46,11 @@
setOpenCommunity(open => (open === index ? null : index));
}, []);
+ const HandlerChat = React.useMemo(
+ () => getCommunityDrawerItemHandler('chat'),
+ [],
+ );
+
const communitiesComponentsDefault = React.useMemo(
() =>
drawerItemsData.map(item => (
@@ -55,9 +61,15 @@
expanded={item.threadInfo.id === openCommunity}
paddingLeft={10}
expandable={true}
+ Handler={HandlerChat}
/>
)),
- [drawerItemsData, openCommunity, setOpenCommunityOrClose],
+ [HandlerChat, drawerItemsData, openCommunity, setOpenCommunityOrClose],
+ );
+
+ const HandlerCal = React.useMemo(
+ () => getCommunityDrawerItemHandler('calendar'),
+ [],
);
const communitiesComponentsCal = React.useMemo(
@@ -69,9 +81,10 @@
expanded={false}
paddingLeft={10}
expandable={false}
+ Handler={HandlerCal}
/>
)),
- [drawerItemsData],
+ [drawerItemsData, HandlerCal],
);
const defaultStyle = tab === 'calendar' ? css.hidden : null;

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 10, 12:52 PM (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5863883
Default Alt Text
D6668.1765371125.diff (4 KB)

Event Timeline