Files
ThreadNet-Web/src/components/views/rooms/AuxPanel.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
2.4 KiB
TypeScript
Raw Normal View History

/*
Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ReactNode } from "react";
import { Room } from "matrix-js-sdk/src/matrix";
2021-06-18 16:22:31 +01:00
import AppsDrawer from "./AppsDrawer";
2018-12-24 15:09:10 +00:00
import SettingsStore from "../../../settings/SettingsStore";
import AutoHideScrollbar from "../../structures/AutoHideScrollbar";
2021-06-16 12:07:58 +01:00
import { UIFeature } from "../../../settings/UIFeature";
2021-06-22 17:23:13 +01:00
import ResizeNotifier from "../../../utils/ResizeNotifier";
import LegacyCallViewForRoom from "../voip/LegacyCallViewForRoom";
2021-06-16 12:07:58 +01:00
import { objectHasDiff } from "../../../utils/objects";
2017-05-30 16:09:57 +02:00
2020-10-30 17:29:32 +00:00
interface IProps {
// js-sdk room object
2021-07-01 23:23:03 +01:00
room: Room;
userId: string;
showApps: boolean; // Render apps
resizeNotifier: ResizeNotifier;
children?: ReactNode;
2020-10-30 17:29:32 +00:00
}
export default class AuxPanel extends React.Component<IProps> {
public static defaultProps = {
showApps: true,
2020-08-29 12:14:16 +01:00
};
public shouldComponentUpdate(nextProps: IProps): boolean {
return objectHasDiff(this.props, nextProps);
2020-08-29 12:14:16 +01:00
}
2019-01-08 11:14:31 +00:00
public render(): React.ReactNode {
const callView = (
<LegacyCallViewForRoom
2020-12-03 17:45:49 +00:00
roomId={this.props.room.roomId}
2021-03-02 14:09:11 +01:00
resizeNotifier={this.props.resizeNotifier}
showApps={this.props.showApps}
/>
);
let appsDrawer;
if (SettingsStore.getValue(UIFeature.Widgets)) {
appsDrawer = (
<AppsDrawer
room={this.props.room}
userId={this.props.userId}
showApps={this.props.showApps}
resizeNotifier={this.props.resizeNotifier}
/>
);
}
return (
2023-05-18 08:54:31 +00:00
<AutoHideScrollbar className="mx_AuxPanel">
2021-08-27 13:31:43 +02:00
{this.props.children}
{appsDrawer}
{callView}
</AutoHideScrollbar>
);
2020-08-29 12:14:16 +01:00
}
}