From ff93fd3c74ecd2f34bc6dbf34c09ce23326ef13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?= <71827178+bosiraphael@users.noreply.github.com> Date: Wed, 15 Jan 2025 13:53:18 +0100 Subject: [PATCH] 190 display ctrl instead of for windows users (#9617) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/twentyhq/core-team-issues/issues/190 Capture d’écran 2025-01-15 à 12 07 12 To test, update the user agent in your browser dev tools: Capture d’écran 2025-01-15 à 12 14 29 --- .../components/CmdEnterActionButton.tsx | 6 ++--- ...cordIndexActionMenuBarAllActionsButton.tsx | 4 +-- .../RightDrawerActionMenuDropdown.tsx | 6 +++-- .../constants/KeyboardShortcutsGeneral.ts | 3 ++- .../components/MainNavigationDrawerItems.tsx | 4 +-- .../SignInAppNavigationDrawerMock.tsx | 3 ++- .../PageHeaderOpenCommandMenuButton.tsx | 10 +++++-- .../__stories__/NavigationDrawer.stories.tsx | 3 ++- .../NavigationDrawerItem.stories.tsx | 3 ++- .../src/input/button/components/Button.tsx | 12 ++++++--- .../components/__stories__/Button.stories.tsx | 10 +++---- .../__tests__/getOsControlSymbol.test.ts | 27 +++++++++++++++++++ .../__tests__/getOsShortcutSeparator.test.ts | 27 +++++++++++++++++++ .../utilities/device/getOsControlSymbol.ts | 7 +++++ .../device/getOsShortcutSeparator.ts | 6 +++++ .../src/utilities/device/getUserDevice.ts | 26 ++++++++++++++++++ packages/twenty-ui/src/utilities/index.ts | 3 +++ 17 files changed, 136 insertions(+), 24 deletions(-) create mode 100644 packages/twenty-ui/src/utilities/device/__tests__/getOsControlSymbol.test.ts create mode 100644 packages/twenty-ui/src/utilities/device/__tests__/getOsShortcutSeparator.test.ts create mode 100644 packages/twenty-ui/src/utilities/device/getOsControlSymbol.ts create mode 100644 packages/twenty-ui/src/utilities/device/getOsShortcutSeparator.ts create mode 100644 packages/twenty-ui/src/utilities/device/getUserDevice.ts diff --git a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx index ae21df17c..84951d3b2 100644 --- a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx @@ -1,7 +1,7 @@ -import { Button } from 'twenty-ui'; +import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope'; import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys'; import { Key } from 'ts-key-enum'; -import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope'; +import { Button, getOsControlSymbol } from 'twenty-ui'; export const CmdEnterActionButton = ({ title, @@ -24,7 +24,7 @@ export const CmdEnterActionButton = ({ accent="blue" size="medium" onClick={onClick} - shortcut={'⌘⏎'} + hotkeys={[getOsControlSymbol(), '⏎']} /> ); }; diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBarAllActionsButton.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBarAllActionsButton.tsx index 336b4f734..9805b6375 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBarAllActionsButton.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBarAllActionsButton.tsx @@ -1,7 +1,7 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; -import { IconLayoutSidebarRightExpand } from 'twenty-ui'; +import { IconLayoutSidebarRightExpand, getOsControlSymbol } from 'twenty-ui'; const StyledButton = styled.div` border-radius: ${({ theme }) => theme.border.radius.sm}; @@ -46,7 +46,7 @@ export const RecordIndexActionMenuBarAllActionsButton = () => { All Actions - ⌘K + {getOsControlSymbol()}K ); diff --git a/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx index a35f7dbef..f054b12a5 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx @@ -14,7 +14,7 @@ import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/ import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useTheme } from '@emotion/react'; import { Key } from 'ts-key-enum'; -import { Button, MenuItem } from 'twenty-ui'; +import { Button, MenuItem, getOsControlSymbol } from 'twenty-ui'; import { FeatureFlagKey } from '~/generated/graphql'; export const RightDrawerActionMenuDropdown = () => { @@ -68,7 +68,9 @@ export const RightDrawerActionMenuDropdown = () => { RightDrawerActionMenuDropdownHotkeyScope.RightDrawerActionMenuDropdown, }} data-select-disable - clickableComponent={