Skip to content

Commit 2314459

Browse files
authored
✨ feat: add platform-specific keyboard shortcuts for command palette tooltip (#547)
- Update command palette tooltip to show Cmd+K on macOS and Win+K on Windows - Replace hardcoded 'CMD + K' text with dynamic icons based on user's OS - Use Command icon for macOS and WindowsLogo icon for Windows users - Consistent with existing platform-specific shortcuts in the app
1 parent 7a4bac9 commit 2314459

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/web/src/views/Calendar/components/Sidebar/SidebarIconRow/SidebarIconRow.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React from "react";
2-
import { Command } from "@phosphor-icons/react";
2+
import { Command, WindowsLogo } from "@phosphor-icons/react";
33
import { theme } from "@web/common/styles/theme";
4+
import { DesktopOS, getDesktopOS } from "@web/common/utils/device.util";
45
import { CalendarIcon } from "@web/components/Icons/Calendar";
56
import { CommandIcon } from "@web/components/Icons/Command";
67
import { TodoIcon } from "@web/components/Icons/Todo";
8+
import { Text } from "@web/components/Text";
79
import { TooltipWrapper } from "@web/components/Tooltip/TooltipWrapper";
810
import { selectSidebarTab } from "@web/ducks/events/selectors/view.selectors";
911
import { viewSlice } from "@web/ducks/events/slices/view.slice";
@@ -26,12 +28,23 @@ export const SidebarIconRow = () => {
2628
}
2729
};
2830

31+
const getCommandPaletteShortcut = () => {
32+
const desktopOS = getDesktopOS();
33+
const isMacOS = desktopOS === DesktopOS.MacOS;
34+
35+
return (
36+
<Text size="s" style={{ display: "flex", alignItems: "center" }}>
37+
{isMacOS ? <Command size={14} /> : <WindowsLogo size={14} />} + K
38+
</Text>
39+
);
40+
};
41+
2942
return (
3043
<IconRow>
3144
<LeftIconGroup>
3245
<TooltipWrapper
3346
description="Open command palette"
34-
shortcut="CMD + K"
47+
shortcut={getCommandPaletteShortcut()}
3548
onClick={toggleCmdPalette}
3649
>
3750
<CommandIcon

0 commit comments

Comments
 (0)