2015-11-27 10:42:03 +00:00
|
|
|
/*
|
2023-08-01 08:32:53 +01:00
|
|
|
Copyright 2023 The Matrix.org Foundation C.I.C.
|
2015-11-27 10:42:03 +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-08-01 08:32:53 +01:00
|
|
|
import React from "react";
|
2021-12-09 09:10:23 +00:00
|
|
|
|
2022-09-25 10:57:25 -04:00
|
|
|
import type { Room } from "matrix-js-sdk/src/models/room";
|
2017-05-25 11:39:08 +01:00
|
|
|
import { _t } from "../../../languageHandler";
|
2021-02-18 15:16:59 +00:00
|
|
|
import RoomName from "../elements/RoomName";
|
2021-07-01 19:54:05 +01:00
|
|
|
import { IOOBData } from "../../../stores/ThreepidInviteStore";
|
2022-09-25 10:57:25 -04:00
|
|
|
|
2023-08-01 08:32:53 +01:00
|
|
|
export default function RoomHeader({ room, oobData }: { room?: Room; oobData?: IOOBData }): JSX.Element {
|
|
|
|
|
let oobName = _t("Join Room");
|
|
|
|
|
if (oobData && oobData.name) {
|
|
|
|
|
oobName = oobData.name;
|
2022-09-25 10:57:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2023-08-01 08:32:53 +01:00
|
|
|
<header className="mx_LegacyRoomHeader light-panel">
|
|
|
|
|
<div className="mx_LegacyRoomHeader_wrapper">
|
|
|
|
|
{room && (
|
|
|
|
|
<RoomName room={room}>
|
|
|
|
|
{(name) => {
|
|
|
|
|
const roomName = name || oobName;
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className="mx_LegacyRoomHeader_name"
|
|
|
|
|
dir="auto"
|
|
|
|
|
title={roomName}
|
|
|
|
|
role="heading"
|
|
|
|
|
aria-level={1}
|
|
|
|
|
>
|
|
|
|
|
{roomName}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}}
|
|
|
|
|
</RoomName>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
2022-09-25 10:57:25 -04:00
|
|
|
);
|
2020-08-29 12:14:16 +01:00
|
|
|
}
|