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,11 @@ import css from './community-drawer-content.css'; import CommunityDrawerItemCommunity from './community-drawer-item-community.react'; -const maxDepth = 2; const labelStyles = ['titleLevel0', 'titleLevel1', 'titleLevel2']; function CommunityDrawerContent(): React.Node { + const tab = useSelector(state => state.navInfo.tab); + const maxDepth = tab === 'calendar' ? 0 : 2; const childThreadInfosMap = useSelector(childThreadInfos); const communities = useSelector(communityThreadSelector); const communitiesSuffixed = React.useMemo(() => appendSuffix(communities), [ @@ -47,6 +48,7 @@ toggleExpanded={setOpenCommunityOrClose} expanded={item.threadInfo.id === openCommunity} paddingLeft={10} + allowExpanding={maxDepth > 0} /> )); diff --git a/web/sidebar/community-drawer-item-community.react.js b/web/sidebar/community-drawer-item-community.react.js --- a/web/sidebar/community-drawer-item-community.react.js +++ b/web/sidebar/community-drawer-item-community.react.js @@ -10,7 +10,7 @@ function CommunityDrawerItemCommunity(props: DrawerItemProps): React.Node { const classes = classnames({ [css.communityBase]: true, - [css.communityExpanded]: props.expanded, + [css.communityExpanded]: props.expanded && props.allowExpanding, }); return (
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, + +allowExpanding?: boolean, }; const indentation = 14; @@ -27,6 +28,7 @@ expanded, toggleExpanded, paddingLeft, + allowExpanding = true, } = props; const children = React.useMemo(() => { @@ -52,15 +54,26 @@ itemData={item} key={item.threadInfo.id} paddingLeft={paddingLeft + indentation} + allowExpanding={allowExpanding} /> )); - }, [expanded, hasSubchannelsButton, itemChildren, paddingLeft, threadInfo]); + }, [ + expanded, + hasSubchannelsButton, + itemChildren, + paddingLeft, + allowExpanding, + threadInfo, + ]); const onExpandToggled = React.useCallback(() => { toggleExpanded(threadInfo.id); }, [toggleExpanded, threadInfo.id]); const itemExpandButton = React.useMemo(() => { + if (!allowExpanding) { + return null; + } if (!itemChildren?.length && !hasSubchannelsButton) { return (
@@ -73,7 +86,13 @@
); - }, [itemChildren?.length, hasSubchannelsButton, onExpandToggled, expanded]); + }, [ + allowExpanding, + itemChildren?.length, + hasSubchannelsButton, + onExpandToggled, + expanded, + ]); const Handler = useSelector(state => getCommunityDrawerItemHandler(state.navInfo.tab), @@ -112,6 +131,7 @@ export type CommunityDrawerItemChatProps = { +itemData: CommunityDrawerItemData, +paddingLeft: number, + +allowExpanding?: boolean, }; function CommunityDrawerItemChat(