The new designs specify, that drawer items are not supposed to be expandable in the Calendar tab.
Run the web app, check that drawer items are not expandable in the Calendar tab, but stay expandable in outher tabs.
|22 ↗||(On Diff #21255)|
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
|51 ↗||(On Diff #21255)|
For 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.
|51 ↗||(On Diff #21256)|
We could also use expandable as a name. Usually, it doesn't make a big difference, but it's nicer to see <CommunityDrawerItemCommunity expandable /> than <CommunityDrawerItemCommunity allowExpanding />
|13 ↗||(On Diff #21256)|
This feels like a hack. Can we modify the code so that when allowExpanding is false, all the communities have expanded = false? Probably
const [openCommunity, setOpenCommunity] = React.useState( communitiesSuffixed.length === 1 ? communitiesSuffixed.id : null, );
should become something like this
const [openCommunity, setOpenCommunity] = React.useState( communitiesSuffixed.length === 1 && maxDepth > 0? communitiesSuffixed.id : null, );
We can also consider introducing a new variable
const expandable = maxDepth > 0;
This solution doesn't preserve the state (expanded/collapsed) of items on deeper levels. ie if I expand chats from levels 0,1,2, then navigate to Calendar, then navigate back to Chat, the only item that is expanded is the community. So I will have to change my approach.
The best solution I found for now is having two lists of CommunityDrawerItems in the CommunityDrawerContent (or two CommunityDrawerContents in the CommunityDrawer), and rendering both of them every time, just setting one of them to have display: none or visibility: hidden. This is not a great solution, it doesn't scale well if we wanted the drawer to display in a yet another way for another app. But the drawer items can still trigger different behaviours in different apps with this approach, just the way the drawer is displayed is limited. And I think we will not want the way the drawer looks to change for each app. I think the "always collapsed" and "expandable" options probably cover all that we need. So I will go with this solution for now, and if in the future we decide it's not enough - that we want the drawer to be able to take many different forms - then it will possibly have to be changed.