Only show core navigation elements (call/chat/notification/info) when a widget is maximised (#7114)
Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
This commit is contained in:
parent
fe24c8ad2a
commit
82ae39435c
4 changed files with 63 additions and 21 deletions
|
@ -2179,7 +2179,21 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||||
// TODO-video MainSplitContentType.Video:
|
// TODO-video MainSplitContentType.Video:
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
|
let excludedRightPanelPhaseButtons = [RightPanelPhases.Timeline];
|
||||||
|
let onAppsClick = this.onAppsClick;
|
||||||
|
let onForgetClick = this.onForgetClick;
|
||||||
|
let onSearchClick = this.onSearchClick;
|
||||||
|
if (this.state.mainSplitContentType === MainSplitContentType.MaximisedWidget) {
|
||||||
|
// Disable phase buttons and action button to have a simplified header when a widget is maximised
|
||||||
|
// and enable (not disable) the RightPanelPhases.Timeline button
|
||||||
|
excludedRightPanelPhaseButtons = [
|
||||||
|
RightPanelPhases.ThreadPanel,
|
||||||
|
RightPanelPhases.PinnedMessages,
|
||||||
|
];
|
||||||
|
onAppsClick = null;
|
||||||
|
onForgetClick = null;
|
||||||
|
onSearchClick = null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<RoomContext.Provider value={this.state}>
|
<RoomContext.Provider value={this.state}>
|
||||||
<main className={mainClasses} ref={this.roomView} onKeyDown={this.onReactKeyDown}>
|
<main className={mainClasses} ref={this.roomView} onKeyDown={this.onReactKeyDown}>
|
||||||
|
@ -2192,12 +2206,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||||
searchInfo={searchInfo}
|
searchInfo={searchInfo}
|
||||||
oobData={this.props.oobData}
|
oobData={this.props.oobData}
|
||||||
inRoom={myMembership === 'join'}
|
inRoom={myMembership === 'join'}
|
||||||
onSearchClick={this.onSearchClick}
|
onSearchClick={onSearchClick}
|
||||||
onForgetClick={(myMembership === "leave") ? this.onForgetClick : null}
|
onForgetClick={(myMembership === "leave") ? onForgetClick : null}
|
||||||
e2eStatus={this.state.e2eStatus}
|
e2eStatus={this.state.e2eStatus}
|
||||||
onAppsClick={this.state.hasPinnedWidgets ? this.onAppsClick : null}
|
onAppsClick={this.state.hasPinnedWidgets ? onAppsClick : null}
|
||||||
appsShown={this.state.showApps}
|
appsShown={this.state.showApps}
|
||||||
onCallPlaced={this.onCallPlaced}
|
onCallPlaced={this.onCallPlaced}
|
||||||
|
excludedRightPanelPhaseButtons={excludedRightPanelPhaseButtons}
|
||||||
/>
|
/>
|
||||||
<MainSplit panel={rightPanel} resizeNotifier={this.props.resizeNotifier}>
|
<MainSplit panel={rightPanel} resizeNotifier={this.props.resizeNotifier}>
|
||||||
<div className="mx_RoomView_body">
|
<div className="mx_RoomView_body">
|
||||||
|
|
|
@ -43,6 +43,7 @@ import { _t } from '../../languageHandler';
|
||||||
import ThreadListContextMenu from '../views/context_menus/ThreadListContextMenu';
|
import ThreadListContextMenu from '../views/context_menus/ThreadListContextMenu';
|
||||||
import RightPanelStore from '../../stores/RightPanelStore';
|
import RightPanelStore from '../../stores/RightPanelStore';
|
||||||
import SettingsStore from '../../settings/SettingsStore';
|
import SettingsStore from '../../settings/SettingsStore';
|
||||||
|
import { WidgetLayoutStore } from '../../stores/widgets/WidgetLayoutStore';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
room: Room;
|
room: Room;
|
||||||
|
@ -209,6 +210,12 @@ export default class ThreadView extends React.Component<IProps, IState> {
|
||||||
if (!SettingsStore.getValue("feature_maximised_widgets")) {
|
if (!SettingsStore.getValue("feature_maximised_widgets")) {
|
||||||
previousPhase = RightPanelPhases.ThreadPanel;
|
previousPhase = RightPanelPhases.ThreadPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// change the previous phase to the threadPanel in case there is no maximised widget anymore
|
||||||
|
if (!WidgetLayoutStore.instance.hasMaximisedWidget(this.props.room)) {
|
||||||
|
previousPhase = RightPanelPhases.ThreadPanel;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure the previous Phase is always one of the two: Timeline or ThreadPanel
|
// Make sure the previous Phase is always one of the two: Timeline or ThreadPanel
|
||||||
if (![RightPanelPhases.ThreadPanel, RightPanelPhases.Timeline].includes(previousPhase)) {
|
if (![RightPanelPhases.ThreadPanel, RightPanelPhases.Timeline].includes(previousPhase)) {
|
||||||
previousPhase = RightPanelPhases.ThreadPanel;
|
previousPhase = RightPanelPhases.ThreadPanel;
|
||||||
|
|
|
@ -81,6 +81,7 @@ const TimelineCardHeaderButton = ({ room, isHighlighted, onClick }) => {
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
room?: Room;
|
room?: Room;
|
||||||
|
excludedRightPanelPhaseButtons?: Array<RightPanelPhases>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.right_panel.RoomHeaderButtons")
|
@replaceableComponent("views.right_panel.RoomHeaderButtons")
|
||||||
|
@ -150,38 +151,54 @@ export default class RoomHeaderButtons extends HeaderButtons<IProps> {
|
||||||
};
|
};
|
||||||
|
|
||||||
public renderButtons() {
|
public renderButtons() {
|
||||||
return <>
|
const rightPanelPhaseButtons: Map<RightPanelPhases, any> = new Map();
|
||||||
|
|
||||||
|
rightPanelPhaseButtons.set(RightPanelPhases.PinnedMessages,
|
||||||
<PinnedMessagesHeaderButton
|
<PinnedMessagesHeaderButton
|
||||||
room={this.props.room}
|
room={this.props.room}
|
||||||
isHighlighted={this.isPhase(RightPanelPhases.PinnedMessages)}
|
isHighlighted={this.isPhase(RightPanelPhases.PinnedMessages)}
|
||||||
onClick={this.onPinnedMessagesClicked}
|
onClick={this.onPinnedMessagesClicked} />,
|
||||||
/>
|
);
|
||||||
|
rightPanelPhaseButtons.set(RightPanelPhases.Timeline,
|
||||||
<TimelineCardHeaderButton
|
<TimelineCardHeaderButton
|
||||||
room={this.props.room}
|
room={this.props.room}
|
||||||
isHighlighted={this.isPhase(RightPanelPhases.Timeline)}
|
isHighlighted={this.isPhase(RightPanelPhases.Timeline)}
|
||||||
onClick={this.onTimelineCardClicked}
|
onClick={this.onTimelineCardClicked} />,
|
||||||
/>
|
);
|
||||||
{ SettingsStore.getValue("feature_thread") && <HeaderButton
|
rightPanelPhaseButtons.set(RightPanelPhases.ThreadPanel,
|
||||||
|
SettingsStore.getValue("feature_thread")
|
||||||
|
? <HeaderButton
|
||||||
name="threadsButton"
|
name="threadsButton"
|
||||||
title={_t("Threads")}
|
title={_t("Threads")}
|
||||||
onClick={this.onThreadsPanelClicked}
|
onClick={this.onThreadsPanelClicked}
|
||||||
isHighlighted={this.isPhase(RoomHeaderButtons.THREAD_PHASES)}
|
isHighlighted={this.isPhase(RoomHeaderButtons.THREAD_PHASES)}
|
||||||
analytics={['Right Panel', 'Threads List Button', 'click']}
|
analytics={['Right Panel', 'Threads List Button', 'click']} />
|
||||||
/> }
|
: null,
|
||||||
|
);
|
||||||
|
rightPanelPhaseButtons.set(RightPanelPhases.NotificationPanel,
|
||||||
<HeaderButton
|
<HeaderButton
|
||||||
name="notifsButton"
|
name="notifsButton"
|
||||||
title={_t('Notifications')}
|
title={_t('Notifications')}
|
||||||
isHighlighted={this.isPhase(RightPanelPhases.NotificationPanel)}
|
isHighlighted={this.isPhase(RightPanelPhases.NotificationPanel)}
|
||||||
onClick={this.onNotificationsClicked}
|
onClick={this.onNotificationsClicked}
|
||||||
analytics={['Right Panel', 'Notification List Button', 'click']}
|
analytics={['Right Panel', 'Notification List Button', 'click']} />,
|
||||||
/>
|
);
|
||||||
|
rightPanelPhaseButtons.set(RightPanelPhases.RoomSummary,
|
||||||
<HeaderButton
|
<HeaderButton
|
||||||
name="roomSummaryButton"
|
name="roomSummaryButton"
|
||||||
title={_t('Room Info')}
|
title={_t('Room Info')}
|
||||||
isHighlighted={this.isPhase(ROOM_INFO_PHASES)}
|
isHighlighted={this.isPhase(ROOM_INFO_PHASES)}
|
||||||
onClick={this.onRoomSummaryClicked}
|
onClick={this.onRoomSummaryClicked}
|
||||||
analytics={['Right Panel', 'Room Summary Button', 'click']}
|
analytics={['Right Panel', 'Room Summary Button', 'click']} />,
|
||||||
/>
|
);
|
||||||
|
|
||||||
|
return <>
|
||||||
|
{
|
||||||
|
Array.from(rightPanelPhaseButtons.keys()).map((phase) =>
|
||||||
|
( this.props.excludedRightPanelPhaseButtons.includes(phase)
|
||||||
|
? null
|
||||||
|
: rightPanelPhaseButtons.get(phase)))
|
||||||
|
}
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import { SearchScope } from './SearchBar';
|
||||||
import { ContextMenuTooltipButton } from '../../structures/ContextMenu';
|
import { ContextMenuTooltipButton } from '../../structures/ContextMenu';
|
||||||
import RoomContextMenu from "../context_menus/RoomContextMenu";
|
import RoomContextMenu from "../context_menus/RoomContextMenu";
|
||||||
import { contextMenuBelow } from './RoomTile';
|
import { contextMenuBelow } from './RoomTile';
|
||||||
|
import { RightPanelPhases } from '../../../stores/RightPanelStorePhases';
|
||||||
|
|
||||||
export interface ISearchInfo {
|
export interface ISearchInfo {
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
|
@ -57,6 +58,7 @@ interface IProps {
|
||||||
e2eStatus: E2EStatus;
|
e2eStatus: E2EStatus;
|
||||||
appsShown: boolean;
|
appsShown: boolean;
|
||||||
searchInfo: ISearchInfo;
|
searchInfo: ISearchInfo;
|
||||||
|
excludedRightPanelPhaseButtons?: Array<RightPanelPhases>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
@ -68,6 +70,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
editing: false,
|
editing: false,
|
||||||
inRoom: false,
|
inRoom: false,
|
||||||
|
excludedRightPanelPhaseButtons: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
|
@ -263,7 +266,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
|
||||||
{ searchStatus }
|
{ searchStatus }
|
||||||
{ topicElement }
|
{ topicElement }
|
||||||
{ rightRow }
|
{ rightRow }
|
||||||
<RoomHeaderButtons room={this.props.room} />
|
<RoomHeaderButtons room={this.props.room} excludedRightPanelPhaseButtons={this.props.excludedRightPanelPhaseButtons} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue