"use client"; import { appStore } from "@/app/store"; import { AudioWaveformIcon, PencilLine } from "lucide-react"; import { type PropsWithChildren, useState } from "react"; import { Command, CommandGroup, CommandItem, CommandList } from "ui/command"; import { Separator } from "ui/separator"; import { Popover, PopoverContent, PopoverTrigger } from "ui/popover"; import { useTranslations } from "next-intl"; import { generateUUID } from "lib/utils"; import { AgentSummary } from "app-types/agent"; import Link from "next/link"; import { authClient } from "auth/client"; type Props = PropsWithChildren<{ agent: AgentSummary; side?: "top" | "bottom" | "left" | "right"; align?: "start" | "end" | "center"; }>; export function AgentDropdown({ agent, children, side, align }: Props) { const t = useTranslations(); const [open, setOpen] = useState(false); const { data: session } = authClient.useSession(); const isOwner = session?.user?.id === agent.userId; return ( {children}
{ appStore.setState((state) => ({ voiceChat: { ...state.voiceChat, isOpen: true, threadId: generateUUID(), agentId: agent.id, }, })); }} > {t("Chat.VoiceChat.title")}
{isOwner && ( {t("Common.edit")} )}
{!isOwner && agent.userName && ( <>

{t("Common.sharedBy", { userName: agent.userName })}

)}
); }