Use kdb in space panel shortcut (#12525)

pull/28217/head
Florian Duros 2024-05-15 11:44:17 +02:00 committed by GitHub
parent 667a7548a7
commit 6b0cb75d82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 9 deletions

View File

@ -472,3 +472,10 @@ limitations under the License.
.mx_SpacePanel_sharePublicSpace { .mx_SpacePanel_sharePublicSpace {
margin: 0; margin: 0;
} }
.mx_SpacePanel_Tooltip_KeyboardShortcut {
kbd {
font-family: inherit;
text-transform: capitalize;
}
}

View File

@ -203,6 +203,7 @@ export const KEY_ICON: Record<string, string> = {
if (IS_MAC) { if (IS_MAC) {
KEY_ICON[Key.META] = "⌘"; KEY_ICON[Key.META] = "⌘";
KEY_ICON[Key.ALT] = "⌥"; KEY_ICON[Key.ALT] = "⌥";
KEY_ICON[Key.SHIFT] = "⇧";
} }
export const CATEGORIES: Record<CategoryName, ICategory> = { export const CATEGORIES: Record<CategoryName, ICategory> = {

View File

@ -62,17 +62,16 @@ import QuickSettingsButton from "./QuickSettingsButton";
import { useSettingValue } from "../../../hooks/useSettings"; import { useSettingValue } from "../../../hooks/useSettings";
import UserMenu from "../../structures/UserMenu"; import UserMenu from "../../structures/UserMenu";
import IndicatorScrollbar from "../../structures/IndicatorScrollbar"; import IndicatorScrollbar from "../../structures/IndicatorScrollbar";
import { IS_MAC, Key } from "../../../Keyboard";
import { useDispatcher } from "../../../hooks/useDispatcher"; import { useDispatcher } from "../../../hooks/useDispatcher";
import defaultDispatcher from "../../../dispatcher/dispatcher"; import defaultDispatcher from "../../../dispatcher/dispatcher";
import { ActionPayload } from "../../../dispatcher/payloads"; import { ActionPayload } from "../../../dispatcher/payloads";
import { Action } from "../../../dispatcher/actions"; import { Action } from "../../../dispatcher/actions";
import { NotificationState } from "../../../stores/notifications/NotificationState"; import { NotificationState } from "../../../stores/notifications/NotificationState";
import { ALTERNATE_KEY_NAME } from "../../../accessibility/KeyboardShortcuts";
import { shouldShowComponent } from "../../../customisations/helpers/UIComponents"; import { shouldShowComponent } from "../../../customisations/helpers/UIComponents";
import { UIComponent } from "../../../settings/UIFeature"; import { UIComponent } from "../../../settings/UIFeature";
import { ThreadsActivityCentre } from "./threads-activity-centre/"; import { ThreadsActivityCentre } from "./threads-activity-centre/";
import AccessibleButton from "../elements/AccessibleButton"; import AccessibleButton from "../elements/AccessibleButton";
import { KeyboardShortcut } from "../settings/KeyboardShortcut";
const useSpaces = (): [Room[], MetaSpace[], Room[], SpaceKey] => { const useSpaces = (): [Room[], MetaSpace[], Room[], SpaceKey] => {
const invites = useEventEmitterState<Room[]>(SpaceStore.instance, UPDATE_INVITED_SPACES, () => { const invites = useEventEmitterState<Room[]>(SpaceStore.instance, UPDATE_INVITED_SPACES, () => {
@ -393,14 +392,11 @@ const SpacePanel: React.FC = () => {
className={classNames("mx_SpacePanel_toggleCollapse", { expanded: !isPanelCollapsed })} className={classNames("mx_SpacePanel_toggleCollapse", { expanded: !isPanelCollapsed })}
onClick={() => setPanelCollapsed(!isPanelCollapsed)} onClick={() => setPanelCollapsed(!isPanelCollapsed)}
title={isPanelCollapsed ? _t("action|expand") : _t("action|collapse")} title={isPanelCollapsed ? _t("action|expand") : _t("action|collapse")}
// TODO should use a kbd element for accessibility https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd
caption={ caption={
IS_MAC <KeyboardShortcut
? "⌘ + ⇧ + D" value={{ ctrlOrCmdKey: true, shiftKey: true, key: "d" }}
: _t(ALTERNATE_KEY_NAME[Key.CONTROL]) + className="mx_SpacePanel_Tooltip_KeyboardShortcut"
" + " + />
_t(ALTERNATE_KEY_NAME[Key.SHIFT]) +
" + D"
} }
/> />
</UserMenu> </UserMenu>