diff --git a/sigap-website/app/(pages)/(admin)/layout.tsx b/sigap-website/app/(pages)/(admin)/layout.tsx index f433106..215d2a4 100644 --- a/sigap-website/app/(pages)/(admin)/layout.tsx +++ b/sigap-website/app/(pages)/(admin)/layout.tsx @@ -25,7 +25,7 @@ import { MoreHorizontal } from "lucide-react"; import { ThemeSwitcher } from "@/app/_components/theme-switcher"; import { Separator } from "@/app/_components/ui/separator"; import { InboxDrawer } from "@/app/_components/inbox-drawer"; -import FloatingActionSearchBar from "@/app/_components/floating-action-search-bar"; +import { FloatingActionSearchBar } from "@/app/_components/floating-action-search-bar"; import { AppSidebar } from "@/app/(pages)/(admin)/_components/app-sidebar"; import { createClient } from "@/app/_utils/supabase/server"; import { redirect } from "next/navigation"; diff --git a/sigap-website/app/_components/action-search-bar.tsx b/sigap-website/app/_components/action-search-bar.tsx index 1c58883..f8598a0 100644 --- a/sigap-website/app/_components/action-search-bar.tsx +++ b/sigap-website/app/_components/action-search-bar.tsx @@ -1,121 +1,243 @@ -"use client"; +"use client" -import React, { - useState, - useEffect, - forwardRef, - useImperativeHandle, -} from "react"; -import { Input } from "@/app/_components/ui/input"; -import { motion, AnimatePresence } from "framer-motion"; -import { - Search, - Send, - BarChart2, - Globe, - Video, - PlaneTakeoff, - AudioLines, -} from "lucide-react"; -import useDebounce from "@/app/_hooks/use-debounce"; +import React, { useState, useEffect, forwardRef, useImperativeHandle } from "react" +import { Input } from "@/app/_components/ui/input" +import { motion, AnimatePresence } from "framer-motion" +import { Search, Send, BarChart2, Globe, Video, PlaneTakeoff, AudioLines, X } from "lucide-react" +import { cn } from "../_lib/utils" +import useDebounce from "../_hooks/use-debounce" -interface Action { - id: string; - label: string; - icon: React.ReactNode; - description?: string; - short?: string; - end?: string; +export interface Action { + id: string + label: string + icon: React.ReactNode + description?: string + shortcut?: string + category?: string + onClick?: () => void + prefix?: string + regex?: RegExp + placeholder?: string } -interface SearchResult { - actions: Action[]; +export interface ActionSearchBarProps { + actions?: Action[] + defaultActions?: boolean + autoFocus?: boolean + isFloating?: boolean + placeholder?: string + onSearch?: (query: string) => void + onActionSelect?: (actionId: string) => void + onSuggestionSelect?: (suggestion: any) => void + className?: string + inputClassName?: string + dropdownClassName?: string + showShortcutHint?: boolean + commandKey?: string + value?: string + onChange?: (value: string) => void + activeActionId?: string | null + onClearAction?: () => void + showActiveAction?: boolean } -const allActions = [ +const defaultActionsList: Action[] = [ { id: "1", label: "Book tickets", icon: , description: "Operator", - short: "⌘K", - end: "Agent", + shortcut: "⌘K", + category: "Agent", }, { id: "2", label: "Summarize", icon: , description: "gpt-4o", - short: "⌘cmd+p", - end: "Command", + shortcut: "⌘cmd+p", + category: "Command", }, { id: "3", label: "Screen Studio", icon: