diff --git a/components.json b/components.json
index 218b7d3af0..c4f4502719 100644
--- a/components.json
+++ b/components.json
@@ -5,5 +5,7 @@
"src/components/views/rooms/Autocomplete.tsx": "src/components/views/rooms/Autocomplete.tsx",
"src/components/views/rooms/RoomTile.tsx": "src/components/views/rooms/RoomTile.tsx",
"src/components/views/elements/RoomName.tsx": "src/components/views/elements/RoomName.tsx",
- "src/editor/commands.tsx": "src/editor/commands.tsx"
+ "src/components/views/dialogs/spotlight/PublicRoomResultDetails.tsx": "src/components/views/dialogs/spotlight/PublicRoomResultDetails.tsx",
+ "src/editor/commands.tsx": "src/editor/commands.tsx",
+ "src/hooks/useRoomName.ts": "src/hooks/useRoomName.ts"
}
diff --git a/res/css/superhero/custom.css b/res/css/superhero/custom.css
index 12a8221bcc..4276a1fb54 100644
--- a/res/css/superhero/custom.css
+++ b/res/css/superhero/custom.css
@@ -1,9 +1,10 @@
+.sh_RoomTokenGatedRoom {
+ align-items: center;
+ display: flex;
+}
+
.sh_RoomTokenGatedRoomIcon {
width: 16px;
height: 16px;
margin-right: 4px;
}
-.mx_RoomTile .mx_RoomTile_titleContainer .mx_RoomTile_title {
- align-items: center;
- display: flex;
-}
diff --git a/src/components/views/dialogs/spotlight/PublicRoomResultDetails.tsx b/src/components/views/dialogs/spotlight/PublicRoomResultDetails.tsx
new file mode 100644
index 0000000000..5ff12ffa72
--- /dev/null
+++ b/src/components/views/dialogs/spotlight/PublicRoomResultDetails.tsx
@@ -0,0 +1,71 @@
+/*
+Copyright 2022 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 { IPublicRoomsChunkRoom } from "matrix-js-sdk/src/matrix";
+import { linkifyAndSanitizeHtml } from "matrix-react-sdk/src/HtmlUtils";
+import { _t } from "matrix-react-sdk/src/languageHandler";
+import React from "react";
+
+import RoomName from "../../elements/RoomName";
+
+const MAX_NAME_LENGTH = 80;
+const MAX_TOPIC_LENGTH = 800;
+
+interface Props {
+ room: IPublicRoomsChunkRoom;
+ labelId: string;
+ descriptionId: string;
+ detailsId: string;
+}
+
+export function PublicRoomResultDetails({ room, labelId, descriptionId, detailsId }: Props): JSX.Element {
+ let topic = room.topic || "";
+ // Additional truncation based on line numbers is done via CSS,
+ // but to ensure that the DOM is not polluted with a huge string
+ // we give it a hard limit before rendering.
+ if (topic.length > MAX_TOPIC_LENGTH) {
+ topic = `${topic.substring(0, MAX_TOPIC_LENGTH)}...`;
+ }
+
+ return (
+