diff --git a/res/css/views/dialogs/_SpotlightDialog.scss b/res/css/views/dialogs/_SpotlightDialog.scss index dd752ecdef5..62df1b143c1 100644 --- a/res/css/views/dialogs/_SpotlightDialog.scss +++ b/res/css/views/dialogs/_SpotlightDialog.scss @@ -174,6 +174,7 @@ limitations under the License. .mx_SpotlightDialog_otherSearches { .mx_SpotlightDialog_startChat, + .mx_SpotlightDialog_joinRoomAlias, .mx_SpotlightDialog_explorePublicRooms { padding-left: 32px; position: relative; @@ -197,6 +198,10 @@ limitations under the License. mask-image: url('$(res)/img/element-icons/room/members.svg'); } + .mx_SpotlightDialog_joinRoomAlias::before { + mask-image: url('$(res)/img/element-icons/roomlist/hash-circle.svg'); + } + .mx_SpotlightDialog_explorePublicRooms::before { mask-image: url('$(res)/img/element-icons/roomlist/explore.svg'); } diff --git a/src/components/views/dialogs/SpotlightDialog.tsx b/src/components/views/dialogs/SpotlightDialog.tsx index 08cbdf43973..4c0bf1da1df 100644 --- a/src/components/views/dialogs/SpotlightDialog.tsx +++ b/src/components/views/dialogs/SpotlightDialog.tsx @@ -72,6 +72,7 @@ import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload"; import { getMetaSpaceName } from "../../../stores/spaces"; import { getKeyBindingsManager } from "../../../KeyBindingsManager"; import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts"; +import { getCachedRoomIDForAlias } from "../../../RoomAliasCache"; const MAX_RECENT_SEARCHES = 10; const SECTION_LIMIT = 50; // only show 50 results per section for performance reasons @@ -413,11 +414,42 @@ const SpotlightDialog: React.FC = ({ initialText = "", onFinished }) => ; } + let joinRoomSection: JSX.Element; + if (trimmedQuery.startsWith("#") && + trimmedQuery.includes(":") && + (!getCachedRoomIDForAlias(trimmedQuery) || !cli.getRoom(getCachedRoomIDForAlias(trimmedQuery))) + ) { + joinRoomSection =
+
+ +
+
; + } + content = <> { peopleSection } { roomsSection } { spacesSection } { spaceRoomsSection } + { joinRoomSection }

{ _t('Use "%(query)s" to search', { query }) }

diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 357982a09cb..997bebff288 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2794,6 +2794,7 @@ "Settings - %(spaceName)s": "Settings - %(spaceName)s", "Spaces you're in": "Spaces you're in", "Other rooms in %(spaceName)s": "Other rooms in %(spaceName)s", + "Join %(roomAddress)s": "Join %(roomAddress)s", "Use \"%(query)s\" to search": "Use \"%(query)s\" to search", "Public rooms": "Public rooms", "Other searches": "Other searches",