Allow maintaining a different right panel width for thread panels (#11064)
* Move Room context threadId our of RoomView state * Allow maintaining a different right panel width for thread panels * Fix types * Fix types * Add tests * Increase coverage * Increase coverage * Add comments * Update src/components/structures/MainSplit.tsx Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
parent
cb2b1718ff
commit
7236e48765
9 changed files with 190 additions and 7 deletions
|
@ -179,6 +179,11 @@ export interface IRoomState {
|
|||
showApps: boolean;
|
||||
isPeeking: boolean;
|
||||
showRightPanel: boolean;
|
||||
/**
|
||||
* Whether the right panel shown is either of ThreadPanel or ThreadView.
|
||||
* Always false when `showRightPanel` is false.
|
||||
*/
|
||||
threadRightPanel: boolean;
|
||||
// error object, as from the matrix client/server API
|
||||
// If we failed to load information about the room,
|
||||
// store the error here.
|
||||
|
@ -223,7 +228,6 @@ export interface IRoomState {
|
|||
wasContextSwitch?: boolean;
|
||||
editState?: EditorStateTransfer;
|
||||
timelineRenderingType: TimelineRenderingType;
|
||||
threadId?: string;
|
||||
liveTimeline?: EventTimeline;
|
||||
narrow: boolean;
|
||||
msc3946ProcessDynamicPredecessor: boolean;
|
||||
|
@ -402,6 +406,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
showApps: false,
|
||||
isPeeking: false,
|
||||
showRightPanel: false,
|
||||
threadRightPanel: false,
|
||||
joining: false,
|
||||
showTopUnreadMessagesBar: false,
|
||||
statusBarVisible: false,
|
||||
|
@ -623,6 +628,11 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
mainSplitContentType: room ? this.getMainSplitContentType(room) : undefined,
|
||||
initialEventId: undefined, // default to clearing this, will get set later in the method if needed
|
||||
showRightPanel: roomId ? this.context.rightPanelStore.isOpenForRoom(roomId) : false,
|
||||
threadRightPanel: roomId
|
||||
? [RightPanelPhases.ThreadView, RightPanelPhases.ThreadPanel].includes(
|
||||
this.context.rightPanelStore.currentCardForRoom(roomId).phase!,
|
||||
)
|
||||
: false,
|
||||
activeCall: roomId ? CallStore.instance.getActiveCall(roomId) : null,
|
||||
};
|
||||
|
||||
|
@ -1011,8 +1021,14 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
}
|
||||
|
||||
private onRightPanelStoreUpdate = (): void => {
|
||||
const { roomId } = this.state;
|
||||
this.setState({
|
||||
showRightPanel: this.state.roomId ? this.context.rightPanelStore.isOpenForRoom(this.state.roomId) : false,
|
||||
showRightPanel: roomId ? this.context.rightPanelStore.isOpenForRoom(roomId) : false,
|
||||
threadRightPanel: roomId
|
||||
? [RightPanelPhases.ThreadView, RightPanelPhases.ThreadPanel].includes(
|
||||
this.context.rightPanelStore.currentCardForRoom(roomId).phase!,
|
||||
)
|
||||
: false,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -2439,7 +2455,14 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
viewingCall={viewingCall}
|
||||
activeCall={this.state.activeCall}
|
||||
/>
|
||||
<MainSplit panel={rightPanel} resizeNotifier={this.props.resizeNotifier}>
|
||||
<MainSplit
|
||||
panel={rightPanel}
|
||||
resizeNotifier={this.props.resizeNotifier}
|
||||
// Override defaults when a thread is being shown to allow persisting a separate
|
||||
// right panel width for thread panels as they tend to want to be wider.
|
||||
sizeKey={this.state.threadRightPanel ? "thread" : undefined}
|
||||
defaultSize={this.state.threadRightPanel ? 500 : undefined}
|
||||
>
|
||||
<div
|
||||
className={mainSplitContentClasses}
|
||||
ref={this.roomViewBody}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue