mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-01 18:28:38 +00:00
refactor: inline useCommandKey as MOD_KEY constant in two call sites
This commit is contained in:
@@ -3,7 +3,6 @@ import { Check, ChevronDown } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { useServerPlatform } from "../../../../hooks/useServerPlatform";
|
||||
import { useCommandKey } from "../../../../hooks/useCommandKey";
|
||||
import SessionProviderLogo from "../../../llm-logo-provider/SessionProviderLogo";
|
||||
import {
|
||||
CLAUDE_MODELS,
|
||||
@@ -28,6 +27,9 @@ import {
|
||||
Card,
|
||||
} from "../../../../shared/view/ui";
|
||||
|
||||
const MOD_KEY =
|
||||
typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl";
|
||||
|
||||
type ProviderSelectionEmptyStateProps = {
|
||||
selectedSession: ProjectSession | null;
|
||||
currentSessionId: string | null;
|
||||
@@ -108,7 +110,6 @@ export default function ProviderSelectionEmptyState({
|
||||
}: ProviderSelectionEmptyStateProps) {
|
||||
const { t } = useTranslation("chat");
|
||||
const { isWindowsServer } = useServerPlatform();
|
||||
const { modKey } = useCommandKey();
|
||||
const [dialogOpen, setDialogOpen] = useState(false);
|
||||
|
||||
const visibleProviderGroups = useMemo(
|
||||
@@ -293,7 +294,7 @@ export default function ProviderSelectionEmptyState({
|
||||
<p className="mt-3 flex items-center justify-center gap-1.5 text-center text-xs text-muted-foreground/60">
|
||||
<span>Press</span>
|
||||
<kbd className="inline-flex items-center gap-0.5 rounded border border-border/60 bg-muted/40 px-1.5 py-0.5 font-mono text-[10px]">
|
||||
{modKey}
|
||||
{MOD_KEY}
|
||||
<span>K</span>
|
||||
</kbd>
|
||||
<span>to search sessions, files, and commits</span>
|
||||
|
||||
@@ -3,9 +3,11 @@ 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';
|
||||
|
||||
const MOD_KEY =
|
||||
typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform) ? '⌘' : 'Ctrl';
|
||||
|
||||
type SearchMode = 'projects' | 'conversations';
|
||||
|
||||
type SidebarHeaderProps = {
|
||||
@@ -41,7 +43,6 @@ 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">
|
||||
@@ -166,7 +167,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"
|
||||
>
|
||||
{modKey}
|
||||
{MOD_KEY}
|
||||
<span>K</span>
|
||||
</kbd>
|
||||
)}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
export type CommandKey = {
|
||||
isMac: boolean;
|
||||
modKey: '⌘' | 'Ctrl';
|
||||
};
|
||||
|
||||
export function useCommandKey(): CommandKey {
|
||||
const isMac =
|
||||
typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform);
|
||||
return { isMac, modKey: isMac ? '⌘' : 'Ctrl' };
|
||||
}
|
||||
Reference in New Issue
Block a user