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

Commit 8a263ac

Browse files
authored
Remove legacy room header and promote beta room header (#105)
* Remove legacy room header and promote beta room header Signed-off-by: Michael Telatynski <[email protected]> * Tidy up Signed-off-by: Michael Telatynski <[email protected]> * Remove unused component Signed-off-by: Michael Telatynski <[email protected]> * Prune i18n Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent e60d3bd commit 8a263ac

File tree

19 files changed

+16
-3769
lines changed

19 files changed

+16
-3769
lines changed

res/css/_components.pcss

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
@import "./components/views/beacon/_LeftPanelLiveShareWarning.pcss";
1313
@import "./components/views/beacon/_LiveTimeRemaining.pcss";
1414
@import "./components/views/beacon/_OwnBeaconStatus.pcss";
15-
@import "./components/views/beacon/_RoomLiveShareWarning.pcss";
1615
@import "./components/views/beacon/_ShareLatestLocation.pcss";
1716
@import "./components/views/beacon/_StyledLiveBeaconIcon.pcss";
1817
@import "./components/views/context_menus/_KebabContextMenu.pcss";

res/css/components/views/beacon/_RoomLiveShareWarning.pcss

-51
This file was deleted.

src/components/structures/RoomView.tsx

+12-126
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ import RoomPreviewBar from "../views/rooms/RoomPreviewBar";
6565
import RoomPreviewCard from "../views/rooms/RoomPreviewCard";
6666
import RoomUpgradeWarningBar from "../views/rooms/RoomUpgradeWarningBar";
6767
import AuxPanel from "../views/rooms/AuxPanel";
68-
import LegacyRoomHeader from "../views/rooms/LegacyRoomHeader";
6968
import RoomHeader from "../views/rooms/RoomHeader";
7069
import { IOOBData, IThreepidInvite } from "../../stores/ThreepidInviteStore";
7170
import EffectsOverlay from "../views/elements/EffectsOverlay";
@@ -313,26 +312,7 @@ function LocalRoomView(props: LocalRoomViewProps): ReactElement {
313312
return (
314313
<div className="mx_RoomView mx_RoomView--local">
315314
<ErrorBoundary>
316-
{SettingsStore.getValue("feature_new_room_decoration_ui") ? (
317-
<RoomHeader room={room} />
318-
) : (
319-
<LegacyRoomHeader
320-
room={context.room}
321-
searchInfo={undefined}
322-
inRoom={true}
323-
onSearchClick={null}
324-
onInviteClick={null}
325-
onForgetClick={null}
326-
e2eStatus={room.encrypted ? E2EStatus.Normal : undefined}
327-
onAppsClick={null}
328-
appsShown={false}
329-
excludedRightPanelPhaseButtons={[]}
330-
showButtons={false}
331-
enableRoomOptionsMenu={false}
332-
viewingCall={false}
333-
activeCall={null}
334-
/>
335-
)}
315+
<RoomHeader room={room} />
336316
<main className="mx_RoomView_body" ref={props.roomView}>
337317
<FileDropTarget parent={props.roomView.current} onFileDrop={props.onFileDrop} />
338318
<div className="mx_RoomView_timeline">
@@ -366,26 +346,7 @@ function LocalRoomCreateLoader(props: ILocalRoomCreateLoaderProps): ReactElement
366346
return (
367347
<div className="mx_RoomView mx_RoomView--local">
368348
<ErrorBoundary>
369-
{SettingsStore.getValue("feature_new_room_decoration_ui") ? (
370-
<RoomHeader room={props.localRoom} />
371-
) : (
372-
<LegacyRoomHeader
373-
room={props.localRoom}
374-
searchInfo={undefined}
375-
inRoom={true}
376-
onSearchClick={null}
377-
onInviteClick={null}
378-
onForgetClick={null}
379-
e2eStatus={props.localRoom.encrypted ? E2EStatus.Normal : undefined}
380-
onAppsClick={null}
381-
appsShown={false}
382-
excludedRightPanelPhaseButtons={[]}
383-
showButtons={false}
384-
enableRoomOptionsMenu={false}
385-
viewingCall={false}
386-
activeCall={null}
387-
/>
388-
)}
349+
<RoomHeader room={props.localRoom} />
389350
<div className="mx_RoomView_body">
390351
<LargeLoader text={text} />
391352
</div>
@@ -1753,13 +1714,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
17531714
});
17541715
};
17551716

1756-
private onAppsClick = (): void => {
1757-
dis.dispatch({
1758-
action: "appsDrawer",
1759-
show: !this.state.showApps,
1760-
});
1761-
};
1762-
17631717
private onForgetClick = (): void => {
17641718
dis.dispatch({
17651719
action: "forget_room",
@@ -1836,10 +1790,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
18361790
dis.fire(Action.ViewRoomDirectory);
18371791
};
18381792

1839-
private onSearchClick = (): void => {
1840-
dis.fire(Action.FocusMessageSearch);
1841-
};
1842-
18431793
private onSearchChange = debounce((e: ChangeEvent): void => {
18441794
const term = (e.target as HTMLInputElement).value;
18451795
this.onSearch(term);
@@ -2121,15 +2071,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
21212071
}
21222072
}
21232073

2124-
const roomHeaderType = SettingsStore.getValue("feature_new_room_decoration_ui") ? "new" : "legacy";
2125-
21262074
if (!this.state.room) {
21272075
const loading = !this.state.matrixClientIsReady || this.state.roomLoading || this.state.peekLoading;
21282076
if (loading) {
21292077
// Assume preview loading if we don't have a ready client or a room ID (still resolving the alias)
21302078
const previewLoading = !this.state.matrixClientIsReady || !this.state.roomId || this.state.peekLoading;
21312079
return (
2132-
<div className="mx_RoomView" data-room-header={roomHeaderType}>
2080+
<div className="mx_RoomView">
21332081
<ErrorBoundary>
21342082
<RoomPreviewBar
21352083
canPreview={false}
@@ -2154,7 +2102,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
21542102
// We've got to this room by following a link, possibly a third party invite.
21552103
const roomAlias = this.state.roomAlias;
21562104
return (
2157-
<div className="mx_RoomView" data-room-header={roomHeaderType}>
2105+
<div className="mx_RoomView">
21582106
<ErrorBoundary>
21592107
<RoomPreviewBar
21602108
onJoinClick={this.onJoinButtonClicked}
@@ -2224,7 +2172,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
22242172

22252173
// We have a regular invite for this room.
22262174
return (
2227-
<div className="mx_RoomView" data-room-header={roomHeaderType}>
2175+
<div className="mx_RoomView">
22282176
<ErrorBoundary>
22292177
<RoomPreviewBar
22302178
onJoinClick={this.onJoinButtonClicked}
@@ -2248,7 +2196,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
22482196
([KnownMembership.Knock, KnownMembership.Leave] as Array<string>).includes(myMembership)
22492197
) {
22502198
return (
2251-
<div className="mx_RoomView" data-room-header={roomHeaderType}>
2199+
<div className="mx_RoomView">
22522200
<ErrorBoundary>
22532201
<RoomPreviewBar
22542202
onJoinClick={this.onJoinButtonClicked}
@@ -2354,11 +2302,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
23542302
/>
23552303
);
23562304
if (!this.state.canPeek && !this.state.room?.isSpaceRoom()) {
2357-
return (
2358-
<div className="mx_RoomView" data-room-header={roomHeaderType}>
2359-
{previewBar}
2360-
</div>
2361-
);
2305+
return <div className="mx_RoomView">{previewBar}</div>;
23622306
}
23632307
} else if (hiddenHighlightCount > 0) {
23642308
aux = (
@@ -2587,46 +2531,9 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
25872531
}
25882532
const mainSplitContentClasses = classNames("mx_RoomView_body", mainSplitContentClassName);
25892533

2590-
let excludedRightPanelPhaseButtons = [RightPanelPhases.Timeline];
2591-
let onAppsClick: (() => void) | null = this.onAppsClick;
2592-
let onForgetClick: (() => void) | null = this.onForgetClick;
2593-
let onSearchClick: (() => void) | null = this.onSearchClick;
2594-
let onInviteClick: (() => void) | null = null;
2595-
let viewingCall = false;
2596-
2597-
// Simplify the header for other main split types
2598-
switch (mainSplitContentType) {
2599-
case MainSplitContentType.MaximisedWidget:
2600-
excludedRightPanelPhaseButtons = [];
2601-
onAppsClick = null;
2602-
onForgetClick = null;
2603-
onSearchClick = null;
2604-
break;
2605-
case MainSplitContentType.Call:
2606-
excludedRightPanelPhaseButtons = [];
2607-
onAppsClick = null;
2608-
onForgetClick = null;
2609-
onSearchClick = null;
2610-
if (this.state.room.canInvite(this.context.client.getSafeUserId())) {
2611-
onInviteClick = this.onInviteClick;
2612-
}
2613-
viewingCall = true;
2614-
}
2615-
2616-
const myMember = this.state.room!.getMember(this.context.client!.getSafeUserId());
2617-
const showForgetButton =
2618-
!this.context.client.isGuest() &&
2619-
(([KnownMembership.Leave, KnownMembership.Ban] as Array<string>).includes(myMembership) ||
2620-
myMember?.isKicked());
2621-
26222534
return (
26232535
<RoomContext.Provider value={this.state}>
2624-
<div
2625-
className={mainClasses}
2626-
ref={this.roomView}
2627-
onKeyDown={this.onReactKeyDown}
2628-
data-room-header={roomHeaderType}
2629-
>
2536+
<div className={mainClasses} ref={this.roomView} onKeyDown={this.onReactKeyDown}>
26302537
{showChatEffects && this.roomView.current && (
26312538
<EffectsOverlay roomWidth={this.roomView.current.offsetWidth} />
26322539
)}
@@ -2644,31 +2551,10 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
26442551
ref={this.roomViewBody}
26452552
data-layout={this.state.layout}
26462553
>
2647-
{SettingsStore.getValue("feature_new_room_decoration_ui") ? (
2648-
<RoomHeader
2649-
room={this.state.room}
2650-
additionalButtons={this.state.viewRoomOpts.buttons}
2651-
/>
2652-
) : (
2653-
<LegacyRoomHeader
2654-
room={this.state.room}
2655-
searchInfo={this.state.search}
2656-
oobData={this.props.oobData}
2657-
inRoom={myMembership === KnownMembership.Join}
2658-
onSearchClick={onSearchClick}
2659-
onInviteClick={onInviteClick}
2660-
onForgetClick={showForgetButton ? onForgetClick : null}
2661-
e2eStatus={this.state.e2eStatus}
2662-
onAppsClick={this.state.hasPinnedWidgets ? onAppsClick : null}
2663-
appsShown={this.state.showApps}
2664-
excludedRightPanelPhaseButtons={excludedRightPanelPhaseButtons}
2665-
showButtons={!this.viewsLocalRoom}
2666-
enableRoomOptionsMenu={!this.viewsLocalRoom}
2667-
viewingCall={viewingCall}
2668-
activeCall={this.state.activeCall}
2669-
additionalButtons={this.state.viewRoomOpts.buttons}
2670-
/>
2671-
)}
2554+
<RoomHeader
2555+
room={this.state.room}
2556+
additionalButtons={this.state.viewRoomOpts.buttons}
2557+
/>
26722558
{mainSplitBody}
26732559
</div>
26742560
</MainSplit>

src/components/structures/WaitingForThirdPartyRoomView.tsx

+1-21
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
1111

1212
import { useRoomContext } from "../../contexts/RoomContext";
1313
import ResizeNotifier from "../../utils/ResizeNotifier";
14-
import { E2EStatus } from "../../utils/ShieldUtils";
1514
import ErrorBoundary from "../views/elements/ErrorBoundary";
16-
import LegacyRoomHeader from "../views/rooms/LegacyRoomHeader";
1715
import RoomHeader from "../views/rooms/RoomHeader";
1816
import ScrollPanel from "./ScrollPanel";
1917
import EventTileBubble from "../views/messages/EventTileBubble";
2018
import NewRoomIntro from "../views/rooms/NewRoomIntro";
2119
import { UnwrappedEventTile } from "../views/rooms/EventTile";
2220
import { _t } from "../../languageHandler";
2321
import SdkConfig from "../../SdkConfig";
24-
import SettingsStore from "../../settings/SettingsStore";
2522

2623
interface Props {
2724
roomView: RefObject<HTMLElement>;
@@ -41,24 +38,7 @@ export const WaitingForThirdPartyRoomView: React.FC<Props> = ({ roomView, resize
4138
return (
4239
<div className="mx_RoomView mx_RoomView--local">
4340
<ErrorBoundary>
44-
{SettingsStore.getValue("feature_new_room_decoration_ui") ? (
45-
<RoomHeader room={context.room!} />
46-
) : (
47-
<LegacyRoomHeader
48-
room={context.room}
49-
inRoom={true}
50-
onInviteClick={null}
51-
onForgetClick={null}
52-
e2eStatus={E2EStatus.Normal}
53-
onAppsClick={null}
54-
appsShown={false}
55-
excludedRightPanelPhaseButtons={[]}
56-
showButtons={false}
57-
enableRoomOptionsMenu={false}
58-
viewingCall={false}
59-
activeCall={null}
60-
/>
61-
)}
41+
<RoomHeader room={context.room!} />
6242
<main className="mx_RoomView_body" ref={roomView}>
6343
<div className="mx_RoomView_timeline">
6444
<ScrollPanel className="mx_RoomView_messagePanel" resizeNotifier={resizeNotifier}>

0 commit comments

Comments
 (0)