diff --git a/src/app/organisms/room/RoomSettings.jsx b/src/app/organisms/room/RoomSettings.jsx index d00f092d..4c4fc2fa 100644 --- a/src/app/organisms/room/RoomSettings.jsx +++ b/src/app/organisms/room/RoomSettings.jsx @@ -2,13 +2,16 @@ import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import './RoomSettings.scss'; +import { blurOnBubbling } from '../../atoms/button/script'; + import initMatrix from '../../../client/initMatrix'; import cons from '../../../client/state/cons'; import navigation from '../../../client/state/navigation'; -import { openInviteUser } from '../../../client/action/navigation'; +import { openInviteUser, toggleRoomSettings } from '../../../client/action/navigation'; import * as roomActions from '../../../client/action/room'; import Text from '../../atoms/text/Text'; +import RawIcon from '../../atoms/system-icons/RawIcon'; import Header, { TitleWrapper } from '../../atoms/header/Header'; import ScrollView from '../../atoms/scroll/ScrollView'; import Tabs from '../../atoms/tabs/Tabs'; @@ -28,6 +31,7 @@ import ShieldUserIC from '../../../../public/res/ic/outlined/shield-user.svg'; import LockIC from '../../../../public/res/ic/outlined/lock.svg'; import AddUserIC from '../../../../public/res/ic/outlined/add-user.svg'; import LeaveArrowIC from '../../../../public/res/ic/outlined/leave-arrow.svg'; +import ChevronTopIC from '../../../../public/res/ic/outlined/chevron-top.svg'; import { useForceUpdate } from '../../hooks/useForceUpdate'; @@ -124,6 +128,7 @@ SecuritySettings.propTypes = { function RoomSettings({ roomId }) { const [, forceUpdate] = useForceUpdate(); const [selectedTab, setSelectedTab] = useState(tabItems[0]); + const room = initMatrix.matrixClient.getRoom(roomId); const handleTabChange = (tabItem) => { setSelectedTab(tabItem); @@ -153,9 +158,20 @@ function RoomSettings({ roomId }) {
- - Room settings - +
- {twemojify(isOpen ? `${room.name} - space settings` : 'Space settings')} + {isOpen && twemojify(room.name)} + — space settings )} contentOptions={} diff --git a/src/client/event/hotkeys.js b/src/client/event/hotkeys.js index 6d7ec384..c606dbb3 100644 --- a/src/client/event/hotkeys.js +++ b/src/client/event/hotkeys.js @@ -1,4 +1,4 @@ -import { openSearch } from '../action/navigation'; +import { openSearch, toggleRoomSettings } from '../action/navigation'; import navigation from '../state/navigation'; function listenKeyboard(event) { @@ -17,11 +17,19 @@ function listenKeyboard(event) { if (['text', 'textarea'].includes(document.activeElement.type)) { return; } + + // esc - close room settings panel + if (event.keyCode === 27 && navigation.isRoomSettings) { + toggleRoomSettings(); + } + if ((event.keyCode !== 8 && event.keyCode < 48) || (event.keyCode >= 91 && event.keyCode <= 93) || (event.keyCode >= 112 && event.keyCode <= 183)) { return; } + + // press any key to focus and type in message field const msgTextarea = document.getElementById('message-textarea'); msgTextarea?.focus(); }