From 04f8228741fadaf7c46d7737f7cf4460dd675649 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 25 Jan 2022 20:21:38 +0000 Subject: [PATCH] Tweak room list header menu for when space is active (#7577) * Remove start chat entry from space-variant room list header + menu * Add options to the RoomListHeader plus menu * Tweak behaviour of room list header + menu space variant explore action --- res/css/views/rooms/_RoomListHeader.scss | 3 ++ src/components/views/rooms/RoomListHeader.tsx | 47 ++++++++++++++----- src/i18n/strings/en_EN.json | 2 +- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/res/css/views/rooms/_RoomListHeader.scss b/res/css/views/rooms/_RoomListHeader.scss index bdc0ffd75e..442456ff0e 100644 --- a/res/css/views/rooms/_RoomListHeader.scss +++ b/res/css/views/rooms/_RoomListHeader.scss @@ -109,3 +109,6 @@ limitations under the License. .mx_RoomListHeader_iconExplore::before { mask-image: url('$(res)/img/element-icons/roomlist/hash-search.svg'); } +.mx_RoomListHeader_iconPlus::before { + mask-image: url('$(res)/img/element-icons/plus.svg'); +} diff --git a/src/components/views/rooms/RoomListHeader.tsx b/src/components/views/rooms/RoomListHeader.tsx index 57b91eaeb9..ac38d0519b 100644 --- a/src/components/views/rooms/RoomListHeader.tsx +++ b/src/components/views/rooms/RoomListHeader.tsx @@ -1,5 +1,5 @@ /* -Copyright 2021 The Matrix.org Foundation C.I.C. +Copyright 2021 - 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. @@ -30,7 +30,12 @@ import IconizedContextMenu, { } from "../context_menus/IconizedContextMenu"; import defaultDispatcher from "../../../dispatcher/dispatcher"; import dis from "../../../dispatcher/dispatcher"; -import { shouldShowSpaceInvite, showCreateNewRoom, showSpaceInvite } from "../../../utils/space"; +import { + shouldShowSpaceInvite, + showCreateNewRoom, + showCreateNewSubspace, + showSpaceInvite, +} from "../../../utils/space"; import { CommunityPrototypeStore } from "../../../stores/CommunityPrototypeStore"; import { ButtonEvent } from "../elements/AccessibleButton"; import Modal from "../../../Modal"; @@ -52,6 +57,7 @@ import { } from "../../../stores/spaces"; import RightPanelStore from "../../../stores/right-panel/RightPanelStore"; import TooltipTarget from "../elements/TooltipTarget"; +import { BetaPill } from "../beta/BetaCard"; const contextMenuBelow = (elementRect: DOMRect) => { // align the context menu's icons with the icon which opened the context menu @@ -257,16 +263,6 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => { > { inviteOption } - { - e.preventDefault(); - e.stopPropagation(); - defaultDispatcher.dispatch({ action: "view_create_chat" }); - closePlusMenu(); - }} - /> { createNewRoomOption } { onClick={(e) => { e.preventDefault(); e.stopPropagation(); - defaultDispatcher.dispatch({ action: Action.ViewRoomDirectory }); + defaultDispatcher.dispatch({ + action: Action.ViewRoom, + room_id: activeSpace.roomId, + }); closePlusMenu(); }} /> + { + e.preventDefault(); + e.stopPropagation(); + showCreateNewRoom(activeSpace); + closePlusMenu(); + }} + /> + { + e.preventDefault(); + e.stopPropagation(); + showCreateNewSubspace(activeSpace); + closePlusMenu(); + }} + > + + ; } else if (plusMenuDisplayed) { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 179c78dd9c..f3f38ce8ae 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1783,6 +1783,7 @@ "%(count)s results|other": "%(count)s results", "%(count)s results|one": "%(count)s result", "Invite": "Invite", + "Add space": "Add space", "Join public room": "Join public room", "Currently joining %(count)s rooms|other": "Currently joining %(count)s rooms", "Currently joining %(count)s rooms|one": "Currently joining %(count)s room", @@ -3122,7 +3123,6 @@ "To join this Space, hide communities in your preferences": "To join this Space, hide communities in your preferences", "To view %(spaceName)s, you need an invite": "To view %(spaceName)s, you need an invite", "Created from ": "Created from ", - "Add space": "Add space", "Welcome to ": "Welcome to ", "Random": "Random", "Support": "Support",