"use client"; import { Search } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { useMounted } from "@/hooks/use-mounted"; import { useTranslations } from "@/lib/i18n/context"; import { isApplePlatform } from "@/lib/keyboard/global-shortcuts"; import { openCommandPalette, preloadCommandPalette } from "./palette-store"; /** * The way into the command palette, at the trailing end of the top bar on * every signed-in page. Where the bar has room it looks like a search field * ("Search…" and the key that opens it); where it has not (a phone, or a * desktop bar narrowed by the sidebar and a docked panel) it is a magnifier * with a tooltip. The switch reads the bar's own width (`@container/topbar` * on the header), not the window's, because a docked panel takes the room * without the window changing. */ export function CommandPaletteTrigger() { const { t } = useTranslations(); // The key hint depends on the platform, which the server cannot know. const mounted = useMounted(); const apple = mounted && isApplePlatform(); const label = t("palette.openLabel"); const keyHint = apple ? "⌘K" : "Ctrl K"; const shortcut = apple ? "Meta+K" : "Control+K"; return (
{label}
); }