Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Refactor RightPanel to match expected behaviour #3703

Merged
merged 20 commits into from
Dec 11, 2019

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Dec 6, 2019

Fixes element-hq/element-web#10769
Fixes element-hq/element-web#8772
Fixes element-hq/element-web#10149

Reviewer: It'll probably be easier to go commit by commit here.

Instead of tracking a collapsedRhs boolean across the core of the app, we now use a store which is responsible for tracking whether or not the panel should even be open. The right panel is additionally hooked up to settings (not exposed in the UI) to make better use of the defaults it offers - it makes the change to automatically show the right panel for new users a bit easier, if we ever decide that.

The new RightPanelStore (and accompanying RightPanelStorePhases because circular imports) does all the tracking and handling, including toggling of the panel's phases. It tracks the last safe phase for the user so that when they refresh the app it is exactly how they left it, including whether or not the panel was even open.


TODO:

This should make it easier to funnel the expected behaviour through a central block of code.
This lays a foundation for redirecting all the traffic through the new store, but for now the core parts of the app need to stop caring if the right panel is open.
This introduces a new dispatch action (unused, so far) and routes the buttons towards the RightPanelStore for processing.
This was for a caret that is no longer in the app. Instead, the header buttons act as a toggle.
Clicking on the member icon was fine, but clicking on the file panel wouldn't bring it up - it had to be clicked a second time to actually show the panel.
Mid-PR cleanup.
@MarcoZehe
Copy link
Contributor

Will this also address element-hq/element-web/issues/11319?

@turt2live
Copy link
Member Author

@MarcoZehe unlikely, as that change is a bit more convoluted than this PR can reasonably scope in.

Currently this is only used in the GroupView and for forwarding messages.
The right panel needs to be opened manually now.
The subclasses listen for view_user and similar dispatches, which then start up the RightPanel. We weren't registering a listener though because we changed to using the RightPanelStore for most of our logic.
We dispatch to open, not call directly into the store.
This requires us to track some of the phase's state in the RightPanelStore, which is not great - trying to get it through the app is a bit difficult.
@turt2live turt2live force-pushed the travis/right-panel-v2 branch from 397a3a9 to 405b3f6 Compare December 6, 2019 23:33
@turt2live turt2live marked this pull request as ready for review December 6, 2019 23:49
@turt2live turt2live requested review from a team and removed request for a team December 6, 2019 23:49
@turt2live
Copy link
Member Author

Taking this out of review because bugs

This is to prevent the member info from staying open, which could explode if the user isn't in the room you're switching to.
It doesn't seem to affect anything by being removed.
@turt2live turt2live requested a review from a team December 10, 2019 17:02
@dbkr dbkr requested review from dbkr and removed request for a team December 11, 2019 17:31
@turt2live turt2live merged commit 7230d51 into develop Dec 11, 2019
@turt2live turt2live deleted the travis/right-panel-v2 branch December 11, 2019 17:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants