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

Commit 270ff9d

Browse files
committed
Add labs flag for default open right panel
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
1 parent 4540cf5 commit 270ff9d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@
889889
"Meta Spaces": "Meta Spaces",
890890
"Use new room breadcrumbs": "Use new room breadcrumbs",
891891
"New spotlight search experience": "New spotlight search experience",
892+
"Right panel stays open (defaults to room member list)": "Right panel stays open (defaults to room member list)",
892893
"Jump to date (adds /jumptodate)": "Jump to date (adds /jumptodate)",
893894
"Don't send read receipts": "Don't send read receipts",
894895
"Font size": "Font size",

src/settings/Settings.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ export const SETTINGS: {[setting: string]: ISetting} = {
366366
displayName: _td("New spotlight search experience"),
367367
default: false,
368368
},
369+
"feature_right_panel_default_open": {
370+
isFeature: true,
371+
labsGroup: LabGroup.Rooms,
372+
supportedLevels: LEVELS_FEATURE,
373+
displayName: _td("Right panel stays open (defaults to room member list)"),
374+
default: false,
375+
},
369376
"feature_jump_to_date": {
370377
// We purposely leave out `isFeature: true` so it doesn't show in Labs
371378
// by default. We will conditionally show it depending on whether we can

src/stores/right-panel/RightPanelStore.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,21 @@ export default class RightPanelStore extends ReadyWatchingStore {
368368
this.isViewingRoom = true; // Is viewing room will of course be removed when removing groups
369369
// load values from byRoomCache with the viewedRoomId.
370370
this.loadCacheFromSettings();
371+
// If the right panel stays open mode is used, and the panel was either
372+
// closed or never shown for that room, then force it open and display
373+
// the room member list.
374+
if (
375+
SettingsStore.getValue("feature_right_panel_default_open") &&
376+
!this.byRoom[this.viewedRoomId]?.isOpen
377+
) {
378+
this.byRoom[this.viewedRoomId] = {
379+
isOpen: true,
380+
history: [
381+
{ phase: RightPanelPhases.RoomSummary },
382+
{ phase: RightPanelPhases.RoomMemberList },
383+
],
384+
};
385+
}
371386
this.emitAndUpdateSettings();
372387
};
373388

0 commit comments

Comments
 (0)