Skip to content

The open alternative to Salesforce, designed for AI.

Added hint for cmdk-menu (#1743)

brendanlaschke35ff695471d8
diff --git a/front/src/AppNavbar.tsx b/front/src/AppNavbar.tsx
index e6d31ce6a56..2f953c4b43b 100644
--- a/front/src/AppNavbar.tsx
+++ b/front/src/AppNavbar.tsx
@@ -39,6 +39,7 @@ export const AppNavbar = () => {
onClick={() => {
openCommandMenu();
}}
+ keyboard={['⌘', 'K']}
/>
<NavItem
label="Notifications"
diff --git a/front/src/modules/ui/navbar/components/NavItem.tsx b/front/src/modules/ui/navbar/components/NavItem.tsx
index 74ad162d3a1..3d064f18630 100644
--- a/front/src/modules/ui/navbar/components/NavItem.tsx
+++ b/front/src/modules/ui/navbar/components/NavItem.tsx
@@ -18,6 +18,7 @@ type NavItemProps = {
danger?: boolean;
soon?: boolean;
count?: number;
+ keyboard?: string[];
};
type StyledItemProps = {
@@ -58,6 +59,9 @@ const StyledItem = styled.button<StyledItemProps>`
color: ${(props) =>
props.danger ? props.theme.color.red : props.theme.font.color.primary};
}
+ :hover .keyboard-shortcuts {
+ visibility: visible;
+ }
user-select: none;
@media (max-width: ${MOBILE_VIEWPORT}px) {
@@ -98,6 +102,17 @@ const StyledItemCount = styled.div`
width: 16px;
`;
+const StyledKeyBoardShortcut = styled.div`
+ align-items: center;
+ border-radius: 4px;
+ color: ${({ theme }) => theme.font.color.light};
+ display: flex;
+ justify-content: center;
+ letter-spacing: 1px;
+ margin-left: auto;
+ visibility: hidden;
+`;
+
const NavItem = ({
label,
Icon,
@@ -107,6 +122,7 @@ const NavItem = ({
danger,
soon,
count,
+ keyboard,
}: NavItemProps) => {
const theme = useTheme();
const navigate = useNavigate();
@@ -138,6 +154,11 @@ const NavItem = ({
<StyledItemLabel>{label}</StyledItemLabel>
{soon && <StyledSoonPill>Soon</StyledSoonPill>}
{!!count && <StyledItemCount>{count}</StyledItemCount>}
+ {keyboard && (
+ <StyledKeyBoardShortcut className="keyboard-shortcuts">
+ {keyboard.map((key) => key)}
+ </StyledKeyBoardShortcut>
+ )}
</StyledItem>
);
};