"use client"; import { NodeKind } from "lib/ai/workflow/workflow.interface"; import { ReactNode, useMemo } from "react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "ui/dropdown-menu"; import { NodeIcon } from "./node-icon"; import { useTranslations } from "next-intl"; import { Tooltip, TooltipContent, TooltipTrigger } from "ui/tooltip"; const unSupportedKinds: NodeKind[] = [NodeKind.Code]; export function NodeSelect({ children, onChange, open, onOpenChange, }: { onChange: (nodeKind: NodeKind) => void; children: ReactNode; open?: boolean; onOpenChange?: (open: boolean) => void; }) { return ( {children} ); } function NodeSelectContent({ onChange, }: { onChange: (nodeKind: NodeKind) => void }) { const t = useTranslations(); const descriptions = useMemo(() => { return t.raw("Workflow.kindsDescription") ?? {}; }, [t]); return Object.keys(NodeKind) .filter((key) => NodeKind[key] !== NodeKind.Input) .sort((a, b) => { const aIndex = unSupportedKinds.indexOf(NodeKind[a]); const bIndex = unSupportedKinds.indexOf(NodeKind[b]); return aIndex - bIndex; }) .map((key) => ( { if (unSupportedKinds.includes(NodeKind[key])) { return; } onChange(NodeKind[key]); }} key={key} > {key} {unSupportedKinds.includes(NodeKind[key]) && ( Soon... )} {key} {descriptions[NodeKind[key]] ?? "...soon"} )); }