= {
key: Key.SPACE,
}],
description: _td("Activate selected button"),
+ }, {
+ keybinds: [{
+ modifiers: [CMD_OR_CTRL, Modifiers.SHIFT],
+ key: Key.D,
+ }],
+ description: _td("Toggle space panel"),
}, {
keybinds: [{
modifiers: [CMD_OR_CTRL],
@@ -348,7 +354,7 @@ const Shortcut: React.FC<{
}
return
- { s.modifiers && s.modifiers.map(m => {
+ { s.modifiers?.map(m => {
return
{ modifierIcon[m] || _t(m) }+
;
diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx
index 427e5f8467..e19725ff60 100644
--- a/src/components/structures/LoggedInView.tsx
+++ b/src/components/structures/LoggedInView.tsx
@@ -27,17 +27,14 @@ import { IMatrixClientCreds } from '../../MatrixClientPeg';
import SettingsStore from "../../settings/SettingsStore";
import ResizeHandle from '../views/elements/ResizeHandle';
-import { Resizer, CollapseDistributor } from '../../resizer';
+import { CollapseDistributor, Resizer } from '../../resizer';
import MatrixClientContext from "../../contexts/MatrixClientContext";
import * as KeyboardShortcuts from "../../accessibility/KeyboardShortcuts";
import HomePage from "./HomePage";
import ResizeNotifier from "../../utils/ResizeNotifier";
import PlatformPeg from "../../PlatformPeg";
import { DefaultTagID } from "../../stores/room-list/models";
-import {
- showToast as showServerLimitToast,
- hideToast as hideServerLimitToast,
-} from "../../toasts/ServerLimitToast";
+import { hideToast as hideServerLimitToast, showToast as showServerLimitToast } from "../../toasts/ServerLimitToast";
import { Action } from "../../dispatcher/actions";
import LeftPanel from "./LeftPanel";
import CallContainer from '../views/voip/CallContainer';
@@ -505,6 +502,10 @@ class LoggedInView extends React.Component {
Modal.closeCurrentModal("homeKeyboardShortcut");
handled = true;
break;
+ case NavigationAction.ToggleSpacePanel:
+ dis.fire(Action.ToggleSpacePanel);
+ handled = true;
+ break;
case NavigationAction.ToggleRoomSidePanel:
if (this.props.page_type === "room_view" || this.props.page_type === "group_view") {
dis.dispatch({
diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx
index 56b5dd4d0e..4c7e01bcdd 100644
--- a/src/components/structures/UserMenu.tsx
+++ b/src/components/structures/UserMenu.tsx
@@ -523,14 +523,14 @@ export default class UserMenu extends React.Component {
;
}
- return (
+ return
@@ -550,6 +550,8 @@ export default class UserMenu extends React.Component {
{ this.renderContextMenu() }
- );
+
+ { this.props.children }
+
;
}
}
diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx
index d945ca395a..9d20782a7e 100644
--- a/src/components/views/spaces/SpacePanel.tsx
+++ b/src/components/views/spaces/SpacePanel.tsx
@@ -58,6 +58,11 @@ import QuickSettingsButton from "./QuickSettingsButton";
import { useSettingValue } from "../../../hooks/useSettings";
import UserMenu from "../../structures/UserMenu";
import IndicatorScrollbar from "../../structures/IndicatorScrollbar";
+import { isMac } from "../../../Keyboard";
+import { useDispatcher } from "../../../hooks/useDispatcher";
+import defaultDispatcher from "../../../dispatcher/dispatcher";
+import { ActionPayload } from "../../../dispatcher/payloads";
+import { Action } from "../../../dispatcher/actions";
const useSpaces = (): [Room[], MetaSpace[], Room[], SpaceKey] => {
const invites = useEventEmitterState(SpaceStore.instance, UPDATE_INVITED_SPACES, () => {
@@ -293,6 +298,12 @@ const SpacePanel = () => {
return () => UIStore.instance.stopTrackingElementDimensions("SpacePanel");
}, []);
+ useDispatcher(defaultDispatcher, (payload: ActionPayload) => {
+ if (payload.action === Action.ToggleSpacePanel) {
+ setPanelCollapsed(!isPanelCollapsed);
+ }
+ });
+
return (
{
if (!result.destination) return; // dropped outside the list
@@ -307,7 +318,21 @@ const SpacePanel = () => {
aria-label={_t("Spaces")}
ref={ref}
>
-
+
+ setPanelCollapsed(!isPanelCollapsed)}
+ title={isPanelCollapsed ? _t("Expand") : _t("Collapse")}
+ tooltip={
+
+ { isPanelCollapsed ? _t("Expand") : _t("Collapse") }
+
+
+ { isMac ? "⌘ + ⇧ + D" : "Ctrl + Shift + D" }
+
+
}
+ />
+
{ (provided, snapshot) => (
{
) }
- setPanelCollapsed(!isPanelCollapsed)}
- title={isPanelCollapsed ? _t("Expand space panel") : _t("Collapse space panel")}
- forceHide={!isPanelCollapsed}
- >
- { !isPanelCollapsed ? _t("Collapse") : null }
-
+
{ metaSpacesEnabled && }
) }
diff --git a/src/dispatcher/actions.ts b/src/dispatcher/actions.ts
index 4e49c1e61b..4133198dd6 100644
--- a/src/dispatcher/actions.ts
+++ b/src/dispatcher/actions.ts
@@ -77,6 +77,11 @@ export enum Action {
*/
ToggleUserMenu = "toggle_user_menu",
+ /**
+ * Toggles the Space panel. No additional payload information required.
+ */
+ ToggleSpacePanel = "toggle_space_panel",
+
/**
* Sets the apps root font size. Should be used with UpdateFontSizePayload
*/
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 1637b0908c..403fab8d03 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -1100,8 +1100,7 @@
"Create": "Create",
"Show all rooms": "Show all rooms",
"Options": "Options",
- "Expand space panel": "Expand space panel",
- "Collapse space panel": "Collapse space panel",
+ "Expand": "Expand",
"Collapse": "Collapse",
"Click to copy": "Click to copy",
"Copied!": "Copied!",
@@ -1130,7 +1129,6 @@
"Recommended for public spaces.": "Recommended for public spaces.",
"Jump to first unread room.": "Jump to first unread room.",
"Jump to first invite.": "Jump to first invite.",
- "Expand": "Expand",
"Space options": "Space options",
"Remove": "Remove",
"This bridge was provisioned by .": "This bridge was provisioned by .",
@@ -3321,6 +3319,7 @@
"Toggle the top left menu": "Toggle the top left menu",
"Close dialog or context menu": "Close dialog or context menu",
"Activate selected button": "Activate selected button",
+ "Toggle space panel": "Toggle space panel",
"Toggle right panel": "Toggle right panel",
"Toggle this dialog": "Toggle this dialog",
"Go to Home View": "Go to Home View",