2016-02-23 15:46:27 +00:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
|
Copyright 2015-2023 The Matrix.org Foundation C.I.C.
|
2016-02-23 15:46:27 +00:00
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2016-02-23 15:46:27 +00:00
|
|
|
*/
|
|
|
|
|
|
2025-02-05 13:25:06 +00:00
|
|
|
import React, { type ReactNode } from "react";
|
|
|
|
|
import { type 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";
|
2025-02-05 13:25:06 +00:00
|
|
|
import type 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-12-20 15:32:24 +00:00
|
|
|
<AutoHideScrollbar role="region" 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
|
|
|
}
|
|
|
|
|
}
|