Changeset View
Changeset View
Standalone View
Standalone View
web/sidebar/community-drawer-content.react.js
Show All 9 Lines | |||||
import { | import { | ||||
createRecursiveDrawerItemsData, | createRecursiveDrawerItemsData, | ||||
appendSuffix, | appendSuffix, | ||||
} from 'lib/utils/drawer-utils.react'; | } from 'lib/utils/drawer-utils.react'; | ||||
import css from './community-drawer-content.css'; | import css from './community-drawer-content.css'; | ||||
import CommunityDrawerItemCommunity from './community-drawer-item-community.react'; | import CommunityDrawerItemCommunity from './community-drawer-item-community.react'; | ||||
const maxDepth = 2; | |||||
const labelStyles = ['titleLevel0', 'titleLevel1', 'titleLevel2']; | const labelStyles = ['titleLevel0', 'titleLevel1', 'titleLevel2']; | ||||
function CommunityDrawerContent(): React.Node { | function CommunityDrawerContent(): React.Node { | ||||
const tab = useSelector(state => state.navInfo.tab); | |||||
const maxDepth = tab === 'calendar' ? 0 : 2; | |||||
inka: Max depth defines how many levels of chats will be displayed in the drawer. In the calendar tab… | |||||
const childThreadInfosMap = useSelector(childThreadInfos); | const childThreadInfosMap = useSelector(childThreadInfos); | ||||
const communities = useSelector(communityThreadSelector); | const communities = useSelector(communityThreadSelector); | ||||
const communitiesSuffixed = React.useMemo(() => appendSuffix(communities), [ | const communitiesSuffixed = React.useMemo(() => appendSuffix(communities), [ | ||||
communities, | communities, | ||||
]); | ]); | ||||
const drawerItemsData = createRecursiveDrawerItemsData( | const drawerItemsData = createRecursiveDrawerItemsData( | ||||
childThreadInfosMap, | childThreadInfosMap, | ||||
Show All 12 Lines | function CommunityDrawerContent(): React.Node { | ||||
const communitiesComponents = drawerItemsData.map(item => ( | const communitiesComponents = drawerItemsData.map(item => ( | ||||
<CommunityDrawerItemCommunity | <CommunityDrawerItemCommunity | ||||
itemData={item} | itemData={item} | ||||
key={item.threadInfo.id} | key={item.threadInfo.id} | ||||
toggleExpanded={setOpenCommunityOrClose} | toggleExpanded={setOpenCommunityOrClose} | ||||
expanded={item.threadInfo.id === openCommunity} | expanded={item.threadInfo.id === openCommunity} | ||||
paddingLeft={10} | paddingLeft={10} | ||||
showExpandButton={maxDepth > 0} | |||||
inkaAuthorUnsubmitted Done Inline ActionsFor now assuming, that we will never want to display only communities, and have them expand to subchannels buttons. That would be rather silly. The code we already have doesn't even allow this. inka: For now assuming, that we will never want to display only communities, and have them expand to… | |||||
/> | /> | ||||
)); | )); | ||||
return <div className={css.container}>{communitiesComponents}</div>; | return <div className={css.container}>{communitiesComponents}</div>; | ||||
} | } | ||||
export default CommunityDrawerContent; | export default CommunityDrawerContent; |
Max depth defines how many levels of chats will be displayed in the drawer. In the calendar tab, we want to display only the communities