You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hooks.ts 706B

12345678910111213141516171819202122232425
  1. import { useSelector } from 'react-redux';
  2. import { isMobileBrowser } from '../base/environment/utils';
  3. import KeyboardShortcutsButton from './components/KeyboardShortcutsButton';
  4. import { areKeyboardShortcutsEnabled } from './functions';
  5. const shortcuts = {
  6. key: 'shortcuts',
  7. Content: KeyboardShortcutsButton,
  8. group: 4
  9. };
  10. /**
  11. * A hook that returns the keyboard shortcuts button if it is enabled and undefined otherwise.
  12. *
  13. * @returns {Object | undefined}
  14. */
  15. export function useKeyboardShortcutsButton() {
  16. const _areKeyboardShortcutsEnabled = useSelector(areKeyboardShortcutsEnabled);
  17. if (!isMobileBrowser() && _areKeyboardShortcutsEnabled) {
  18. return shortcuts;
  19. }
  20. }