refactor(command-palette): extract useCommandKey and SETTINGS_MAIN_TABS metadata

This commit is contained in:
simosmik
2026-04-30 07:51:28 +00:00
parent f1d7df2b1e
commit 384cee2995
5 changed files with 47 additions and 30 deletions

View File

@@ -3,6 +3,7 @@ import type { TFunction } from 'i18next';
import { Button, Input } from '../../../../shared/view/ui';
import { IS_PLATFORM } from '../../../../constants/config';
import { cn } from '../../../../lib/utils';
import { useCommandKey } from '../../../../hooks/useCommandKey';
import GitHubStarBadge from './GitHubStarBadge';
type SearchMode = 'projects' | 'conversations';
@@ -40,6 +41,7 @@ export default function SidebarHeader({
onCollapseSidebar,
t,
}: SidebarHeaderProps) {
const { modKey } = useCommandKey();
const LogoBlock = () => (
<div className="flex min-w-0 items-center gap-2.5">
<div className="flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-primary/90 shadow-sm">
@@ -164,7 +166,7 @@ export default function SidebarHeader({
title="Open command palette"
className="pointer-events-none absolute right-2.5 top-1/2 hidden -translate-y-1/2 items-center gap-0.5 rounded border border-border/60 bg-muted/40 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground md:inline-flex"
>
{typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform) ? '⌘' : 'Ctrl'}
{modKey}
<span>K</span>
</kbd>
)}