Closes https://github.com/twentyhq/core-team-issues/issues/321 - Create component - Create stories - Fix bug due to `WorkflowDiagramCanvasEditableEffect`
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import {
|
|
Button,
|
|
IconButton,
|
|
IconDotsVertical,
|
|
getOsControlSymbol,
|
|
useIsMobile,
|
|
} from 'twenty-ui';
|
|
|
|
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
|
import { FeatureFlagKey } from '~/generated/graphql';
|
|
|
|
export const PageHeaderOpenCommandMenuButton = () => {
|
|
const { openRootCommandMenu } = useCommandMenu();
|
|
|
|
const isCommandMenuV2Enabled = useIsFeatureEnabled(
|
|
FeatureFlagKey.IsCommandMenuV2Enabled,
|
|
);
|
|
|
|
const isMobile = useIsMobile();
|
|
|
|
return (
|
|
<>
|
|
{isCommandMenuV2Enabled ? (
|
|
<Button
|
|
Icon={IconDotsVertical}
|
|
dataTestId="page-header-open-command-menu-button"
|
|
size={isMobile ? 'medium' : 'small'}
|
|
variant="secondary"
|
|
accent="default"
|
|
hotkeys={[getOsControlSymbol(), 'K']}
|
|
ariaLabel="Open command menu"
|
|
onClick={openRootCommandMenu}
|
|
/>
|
|
) : (
|
|
<IconButton
|
|
Icon={IconDotsVertical}
|
|
size="medium"
|
|
dataTestId="more-showpage-button"
|
|
accent="default"
|
|
variant="secondary"
|
|
onClick={openRootCommandMenu}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
};
|