Page MenuHomePhabricator

[native] Add subchannels button to drawer items
ClosedPublic

Authored by inka on Dec 22 2022, 8:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 27, 9:39 AM
Unknown Object (File)
Wed, Nov 27, 9:35 AM
Unknown Object (File)
Wed, Nov 27, 7:39 AM
Unknown Object (File)
Wed, Nov 6, 3:35 PM
Unknown Object (File)
Mon, Nov 4, 11:11 PM
Unknown Object (File)
Mon, Nov 4, 11:11 PM
Unknown Object (File)
Mon, Nov 4, 11:10 PM
Unknown Object (File)
Mon, Nov 4, 1:18 AM
Subscribers

Details

Summary

Linear issue: https://linear.app/comm/issue/ENG-2284/add-links-to-subchannels-in-level-2-chats
drawer items at level 2 are not supposed to expand further, but if they do have subchannels, expanding them should reveal a button that allows to navigate to a modal, displaying the subchannels.

image.png (1×540 px, 87 KB)

Test Plan

Ran ios simulator, checked that buttons are present where they should be present and that they navigate to the modal.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/navigation/community-drawer-content.react.js
102–121 ↗(On Diff #20033)

CommunityDrawerItems receive data based upon which they render. This data is prepared for them here, in the CommunityDrawerContent component, so that each item doesn't need to worry about which level its on etc.
Whether the subchannels button should be rendered by an item is based on two things:

  1. does it have any subchannels
  2. is it on level 2 (MAX_DEPTH)

So since an item doesn't know what level it is on, this information is looked at here, and the showSubchannelsButton flag is set.

inka requested review of this revision.Dec 22 2022, 8:52 AM
tomek requested changes to this revision.Dec 27 2022, 5:27 AM
tomek added inline comments.
native/navigation/community-drawer-content.react.js
46 ↗(On Diff #20033)

It's better to make this name describe a state. Currently it might be confused with an action.

115 ↗(On Diff #20033)

Shouldn't we check if these are channels like in D5951? Could you test a case where a channel on lvl + 1 === MAX_DEPTH has some sidebars and doesn't have any channels?

This revision now requires changes to proceed.Dec 27 2022, 5:27 AM
native/navigation/community-drawer-content.react.js
115 ↗(On Diff #20033)

Right, this code is incorrect.
But in D5951 we use useFilteredChatListData, and get a $ReadOnlyArray<ChatThreadItem>, because we need the mostRecentMessageInfo for each subchannel. Here I don't need that, so I'll stick with using childThreadInfos selector that returns { +[id: string]: $ReadOnlyArray<ThreadInfo> }, and I'll filter out children that aren't channels.

Change showSubchannelsButton to hasSubchannelsButton, fix condition for displaying subchannels button

tomek added inline comments.
native/navigation/community-drawer-content.react.js
133–136 ↗(On Diff #20215)

This can be simplified by using array.some

This revision is now accepted and ready to land.Dec 29 2022, 1:03 AM

Address code review, rebase