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

Commit

Permalink
Add labs flag for default open right panel
Browse files Browse the repository at this point in the history
This adds an experimental default open right panel mode as a quick fix for those
who prefer to have the right panel consistently across rooms.

If no right panel state is known for the room or it was closed on the last room
visit, it will default to the room member list. Otherwise, the saved card last
used in that room is shown.

Fixes element-hq/element-web#20666
  • Loading branch information
jryans committed Jan 24, 2022
1 parent 4540cf5 commit 270ff9d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@
"Meta Spaces": "Meta Spaces",
"Use new room breadcrumbs": "Use new room breadcrumbs",
"New spotlight search experience": "New spotlight search experience",
"Right panel stays open (defaults to room member list)": "Right panel stays open (defaults to room member list)",
"Jump to date (adds /jumptodate)": "Jump to date (adds /jumptodate)",
"Don't send read receipts": "Don't send read receipts",
"Font size": "Font size",
Expand Down
7 changes: 7 additions & 0 deletions src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ export const SETTINGS: {[setting: string]: ISetting} = {
displayName: _td("New spotlight search experience"),
default: false,
},
"feature_right_panel_default_open": {
isFeature: true,
labsGroup: LabGroup.Rooms,
supportedLevels: LEVELS_FEATURE,
displayName: _td("Right panel stays open (defaults to room member list)"),
default: false,
},
"feature_jump_to_date": {
// We purposely leave out `isFeature: true` so it doesn't show in Labs
// by default. We will conditionally show it depending on whether we can
Expand Down
15 changes: 15 additions & 0 deletions src/stores/right-panel/RightPanelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,21 @@ export default class RightPanelStore extends ReadyWatchingStore {
this.isViewingRoom = true; // Is viewing room will of course be removed when removing groups
// load values from byRoomCache with the viewedRoomId.
this.loadCacheFromSettings();
// If the right panel stays open mode is used, and the panel was either
// closed or never shown for that room, then force it open and display
// the room member list.
if (
SettingsStore.getValue("feature_right_panel_default_open") &&
!this.byRoom[this.viewedRoomId]?.isOpen
) {
this.byRoom[this.viewedRoomId] = {
isOpen: true,
history: [
{ phase: RightPanelPhases.RoomSummary },
{ phase: RightPanelPhases.RoomMemberList },
],
};
}
this.emitAndUpdateSettings();
};

Expand Down

0 comments on commit 270ff9d

Please sign in to comment.