import { useState } from "react";
import {
IconArrowRight,
IconDeviceDesktop,
IconFileText,
IconFolder,
IconMoon,
IconPalette,
IconPlus,
IconSearch,
IconSettings,
IconSun,
IconUser,
} from "@tabler/icons-react";
import { CommandDialog, type CommandGroup } from "@/components/wensity/command";
const groups: CommandGroup[] = [
{
heading: "Recent",
items: [
{ id: "customer-jane", label: "Jane Cooper", description: "Open customer profile", icon: <IconUser /> },
{ id: "q2-report", label: "Q2 revenue report", description: "Edited 12 minutes ago", icon: <IconFileText /> },
],
},
{
heading: "Navigate",
items: [
{ id: "dashboard", label: "Dashboard", description: "Workspace overview", icon: <IconDeviceDesktop /> },
{ id: "customers", label: "Customers", description: "Accounts, segments, and notes", icon: <IconUser /> },
{ id: "files", label: "Files", description: "Contracts and shared assets", icon: <IconFolder /> },
],
},
{
heading: "Actions",
items: [
{ id: "new-file", label: "Create file", icon: <IconPlus />, shortcut: ["⌘", "N"] },
{ id: "invite", label: "Invite teammate", icon: <IconArrowRight />, shortcut: ["⌘", "I"] },
{ id: "search", label: "Search everywhere", icon: <IconSearch />, shortcut: ["⌘", "K"] },
],
},
{
heading: "Preferences",
items: [
{
id: "theme",
label: "Theme",
description: "Light, dark, or system",
icon: <IconPalette />,
pageTitle: "Theme",
items: [
{
items: [
{ id: "theme-light", label: "Light", icon: <IconSun /> },
{ id: "theme-dark", label: "Dark", icon: <IconMoon /> },
{ id: "theme-system", label: "System", icon: <IconDeviceDesktop /> },
],
},
],
},
{ id: "settings", label: "Workspace settings", icon: <IconSettings />, shortcut: ["⌘", ","] },
],
},
];
export function CommandInDialog() {
const [open, setOpen] = useState(false);
return (
<CommandDialog
open={open}
onOpenChange={setOpen}
groups={groups}
shortcut={{ key: "k", meta: true }}
trigger={
<button
type="button"
className="inline-flex h-9 items-center gap-2 rounded-lg border border-[var(--border)] px-3 text-[13px] text-[var(--muted-foreground)] transition-colors duration-100 ease-out hover:bg-[color-mix(in_srgb,var(--foreground)_4%,var(--background))] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--foreground)_18%,transparent)]"
>
<IconSearch stroke={1.75} className="size-4" />
Search...
</button>
}
/>
);
}