2016-02-23 15:46:27 +00:00
|
|
|
/*
|
2023-11-30 08:19:16 +00:00
|
|
|
Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
|
2016-02-23 15:46:27 +00:00
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-08 13:28:07 +00:00
|
|
|
import React, { ReactNode } from "react";
|
2023-11-30 08:19:16 +00:00
|
|
|
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";
|
2020-03-28 00:51:01 +00:00
|
|
|
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";
|
2022-08-30 15:13:39 -04:00
|
|
|
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;
|
2023-03-08 13:28:07 +00:00
|
|
|
children?: ReactNode;
|
2020-10-30 17:29:32 +00:00
|
|
|
}
|
2016-03-08 12:16:34 +00:00
|
|
|
|
2023-11-30 08:19:16 +00:00
|
|
|
export default class AuxPanel extends React.Component<IProps> {
|
2022-12-16 12:29:59 +00:00
|
|
|
public static defaultProps = {
|
2018-02-09 13:23:34 +00:00
|
|
|
showApps: true,
|
2020-08-29 12:14:16 +01:00
|
|
|
};
|
2018-02-09 13:23:34 +00:00
|
|
|
|
2023-11-30 08:19:16 +00: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
|
|
|
|
2023-02-13 17:01:43 +00:00
|
|
|
public render(): React.ReactNode {
|
2017-05-17 21:15:57 +01:00
|
|
|
const callView = (
|
2022-08-30 15:13:39 -04:00
|
|
|
<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}
|
2021-11-23 11:13:51 +01:00
|
|
|
showApps={this.props.showApps}
|
2016-02-23 15:46:27 +00:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
|
2020-09-16 11:38:50 +01:00
|
|
|
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}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
2017-05-17 21:15:57 +01:00
|
|
|
|
2016-02-23 15:46:27 +00:00
|
|
|
return (
|
2023-05-18 08:54:31 +00:00
|
|
|
<AutoHideScrollbar className="mx_AuxPanel">
|
2021-08-27 13:31:43 +02:00
|
|
|
{this.props.children}
|
2017-05-17 21:15:57 +01:00
|
|
|
{appsDrawer}
|
2016-02-23 15:46:27 +00:00
|
|
|
{callView}
|
2020-03-28 00:51:01 +00:00
|
|
|
</AutoHideScrollbar>
|
2016-02-23 15:46:27 +00:00
|
|
|
);
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|
|
|
|
|
}
|