HomePhabricator
Diffusion Comm 11b19a3e414c

[web] Add PossiblyEmptyNavStateInfoBar to handle collapse animation in the…

Description

[web] Add PossiblyEmptyNavStateInfoBar to handle collapse animation in the topbar when no community is selected

Summary:
Issue: https://linear.app/comm/issue/ENG-2740/add-navigation-state-info-to-the-top-bar
This component is needed as a wrapper for NavStateInfoBar, because sometimes no community is selected in the drawer. In such case, the part of the topbar that shows the navigation info is supposed to collapse. This cannot be handled
by NavStateInfoBar directly, because it calls hooks that take ThreadInfo as an argument (which in such case is undefined), and we cannot call hooks conditionally.
We also want the navigation state info to be visible during the collapse animation. This is why PossiblyEmptyNavStateInfoBar has a threadInfo in it's state. It remembers the previous threadInfo for the time of the animation. Then
it is set to null. If it was not being set to null after the animation, during the expand animation we would see for a fragment of a second the previous navigation state, that would suddenly be updated, and that looks glitchy.

There is a slight glitch sometimes when switching from the Calendar tab (with no community selected) to the Chat tab, but this is caused by ChatThreadList component being very low, and influencing the overall performance of the app.
It had been decided that it's fine. We have tasks to improve the performance of the ChatThreadList: ENG-2225 and ENG-891.

The styling will be updated in future diffs

Test Plan: Run web app, added PossiblyEmptyNavStateInfoBar component to the Topbar component, checked that is behaves as expected.

Reviewers: kamil, michal, bartek

Reviewed By: bartek

Subscribers: ashoat, tomek, atul

Differential Revision: https://phab.comm.dev/D6841