Page MenuHomePhorge

D6363.1768350322.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D6363.1768350322.diff

diff --git a/web/sidebar/community-drawer-content.react.js b/web/sidebar/community-drawer-content.react.js
--- a/web/sidebar/community-drawer-content.react.js
+++ b/web/sidebar/community-drawer-content.react.js
@@ -15,10 +15,12 @@
import css from './community-drawer-content.css';
import CommunityDrawerItemCommunity from './community-drawer-item-community.react';
-const maxDepth = 2;
const labelStyles = ['titleLevel0', 'titleLevel1', 'titleLevel2'];
+const maxDepth = 2;
+
function CommunityDrawerContent(): React.Node {
+ const tab = useSelector(state => state.navInfo.tab);
const childThreadInfosMap = useSelector(childThreadInfos);
const communities = useSelector(communityThreadSelector);
const communitiesSuffixed = React.useMemo(() => appendSuffix(communities), [
@@ -40,17 +42,51 @@
setOpenCommunity(open => (open === index ? null : index));
}, []);
- const communitiesComponents = drawerItemsData.map(item => (
- <CommunityDrawerItemCommunity
- itemData={item}
- key={item.threadInfo.id}
- toggleExpanded={setOpenCommunityOrClose}
- expanded={item.threadInfo.id === openCommunity}
- paddingLeft={10}
- />
- ));
-
- return <div className={css.container}>{communitiesComponents}</div>;
+ const communitiesComponentsDefault = React.useMemo(
+ () =>
+ drawerItemsData.map(item => (
+ <CommunityDrawerItemCommunity
+ itemData={item}
+ key={`${item.threadInfo.id}_chat`}
+ toggleExpanded={setOpenCommunityOrClose}
+ expanded={item.threadInfo.id === openCommunity}
+ paddingLeft={10}
+ expandable={true}
+ />
+ )),
+ [drawerItemsData, openCommunity, setOpenCommunityOrClose],
+ );
+
+ const communitiesComponentsCal = React.useMemo(
+ () =>
+ drawerItemsData.map(item => (
+ <CommunityDrawerItemCommunity
+ itemData={item}
+ key={`${item.threadInfo.id}_cal`}
+ toggleExpanded={() => {}}
+ expanded={false}
+ paddingLeft={10}
+ expandable={false}
+ />
+ )),
+ [drawerItemsData],
+ );
+
+ const defaultStyle = React.useMemo(
+ () => (tab === 'calendar' ? { display: 'none' } : null),
+ [tab],
+ );
+ const calStyle = React.useMemo(
+ () => (tab !== 'calendar' ? { display: 'none' } : null),
+ [tab],
+ );
+
+ return (
+ <div className={css.container}>
+ <div style={defaultStyle}>{communitiesComponentsDefault}</div>
+ <div style={calStyle}>{communitiesComponentsCal}</div>
+ </div>
+ );
}
export default CommunityDrawerContent;
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
@@ -16,6 +16,7 @@
+toggleExpanded: (threadID: string) => void,
+expanded: boolean,
+paddingLeft: number,
+ +expandable?: boolean,
};
const indentation = 14;
@@ -27,6 +28,7 @@
expanded,
toggleExpanded,
paddingLeft,
+ expandable = true,
} = props;
const children = React.useMemo(() => {
@@ -52,15 +54,26 @@
itemData={item}
key={item.threadInfo.id}
paddingLeft={paddingLeft + indentation}
+ expandable={expandable}
/>
));
- }, [expanded, hasSubchannelsButton, itemChildren, paddingLeft, threadInfo]);
+ }, [
+ expanded,
+ hasSubchannelsButton,
+ itemChildren,
+ paddingLeft,
+ expandable,
+ threadInfo,
+ ]);
const onExpandToggled = React.useCallback(() => {
toggleExpanded(threadInfo.id);
}, [toggleExpanded, threadInfo.id]);
const itemExpandButton = React.useMemo(() => {
+ if (!expandable) {
+ return null;
+ }
if (!itemChildren?.length && !hasSubchannelsButton) {
return (
<div className={css.buttonContainer}>
@@ -73,7 +86,13 @@
<ExpandButton onClick={onExpandToggled} expanded={expanded} />
</div>
);
- }, [itemChildren?.length, hasSubchannelsButton, onExpandToggled, expanded]);
+ }, [
+ expandable,
+ itemChildren?.length,
+ hasSubchannelsButton,
+ onExpandToggled,
+ expanded,
+ ]);
const Handler = useSelector(state =>
getCommunityDrawerItemHandler(state.navInfo.tab),
@@ -105,6 +124,7 @@
export type CommunityDrawerItemChatProps = {
+itemData: CommunityDrawerItemData<string>,
+paddingLeft: number,
+ +expandable?: boolean,
};
function CommunityDrawerItemChat(

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 14, 12:25 AM (36 m, 38 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5929454
Default Alt Text
D6363.1768350322.diff (4 KB)

Event Timeline