From f4e8e8bebf5f90f71311f419da8e1a19f7811d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 10 Oct 2024 23:06:15 +0200 Subject: [PATCH] pl-fe: Only show enabled shortcuts when unauthenticated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../ui/components/modals/hotkeys-modal.tsx | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/pl-fe/src/features/ui/components/modals/hotkeys-modal.tsx b/packages/pl-fe/src/features/ui/components/modals/hotkeys-modal.tsx index caa9a884f..63eebcb72 100644 --- a/packages/pl-fe/src/features/ui/components/modals/hotkeys-modal.tsx +++ b/packages/pl-fe/src/features/ui/components/modals/hotkeys-modal.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Modal } from 'pl-fe/components/ui'; -import { useFeatures } from 'pl-fe/hooks'; +import { useFeatures, useLoggedIn } from 'pl-fe/hooks'; import type { BaseModalProps } from '../modal-root'; @@ -21,13 +21,14 @@ const TableCell: React.FC<{ className?: string; children: React.ReactNode }> = ( const HotkeysModal: React.FC = ({ onClose }) => { const features = useFeatures(); + const { isLoggedIn } = useLoggedIn(); const hotkeys = [ - { + isLoggedIn && { key: r, label: , }, - { + isLoggedIn && { key: m, label: , }, @@ -35,15 +36,15 @@ const HotkeysModal: React.FC = ({ onClose }) => { key: p, label: , }, - { + isLoggedIn && { key: f, label: , }, - features.emojiReacts && { + isLoggedIn && features.emojiReacts && { key: e, label: , }, - { + isLoggedIn && { key: b, label: , }, @@ -71,11 +72,11 @@ const HotkeysModal: React.FC = ({ onClose }) => { key: <>down, j, label: , }, - { + isLoggedIn && { key: n, label: , }, - { + isLoggedIn && { key: <>alt + n, label: , }, @@ -83,7 +84,7 @@ const HotkeysModal: React.FC = ({ onClose }) => { key: backspace, label: , }, - { + isLoggedIn && { key: <>s, /, label: , }, @@ -91,31 +92,31 @@ const HotkeysModal: React.FC = ({ onClose }) => { key: esc, label: , }, - { + isLoggedIn && { key: <>g + h, label: , }, - { + isLoggedIn && { key: <>g + n, label: , }, - { + isLoggedIn && { key: <>g + f, label: , }, - { + isLoggedIn && { key: <>g + p, label: , }, - { + isLoggedIn && { key: <>g + b, label: , }, - { + isLoggedIn && { key: <>g + m, label: , }, - features.followRequests && { + isLoggedIn && features.followRequests && { key: <>g + r, label: , },