Page MenuHomePhabricator

[web] Make drawer items not expandable in the calendar tab

Authored by inka on Jan 24 2023, 10:33 AM.
Referenced Files
Unknown Object (File)
Fri, Mar 17, 10:19 PM
Unknown Object (File)
Wed, Mar 8, 2:12 AM
Unknown Object (File)
Feb 21 2023, 6:15 PM
Unknown Object (File)
Feb 21 2023, 4:20 PM
Unknown Object (File)
Feb 21 2023, 9:53 AM
Unknown Object (File)
Feb 20 2023, 8:39 PM
Unknown Object (File)
Feb 20 2023, 7:24 PM
Unknown Object (File)
Feb 20 2023, 3:30 PM



The new designs specify, that drawer items are not supposed to be expandable in the Calendar tab.

Test Plan

Run the web app, check that drawer items are not expandable in the Calendar tab, but stay expandable in outher tabs.

Diff Detail

rCOMM Comm
Lint Not Applicable
Tests Not Applicable

Event Timeline

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.

inka requested review of this revision.Jan 24 2023, 10:48 AM

Remove falsy dark background in the Calendar tab

tomek requested changes to this revision.Jan 26 2023, 4:46 AM
tomek added inline comments.
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[0].id : null,

should become something like this

const [openCommunity, setOpenCommunity] = React.useState(
  communitiesSuffixed.length === 1 && maxDepth > 0? communitiesSuffixed[0].id : null,

We can also consider introducing a new variable

const expandable = maxDepth > 0;
This revision now requires changes to proceed.Jan 26 2023, 4:46 AM

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.

Change strategy to preserve drawer state from one app, when switching to another tab

The state is preserved now

Remove accidental changes

tomek added inline comments.
69 ↗(On Diff #22118)

Can we make this an optional prop and don't provide it here instead of using an empty function?

78–85 ↗(On Diff #22118)

You can create a class e.g. .hidden and use it conditionally.

This revision is now accepted and ready to land.Feb 7 2023, 8:28 AM