Files
IdP/apps/frontend/components/chat/bot-chat-message-context-menu.tsx
2026-06-25 23:48:57 +03:00

39 lines
956 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client';
import { Copy } from 'lucide-react';
import {
ContextMenu,
ContextMenuContent,
ContextMenuItem,
ContextMenuTrigger
} from '@/components/ui/context-menu';
interface BotChatMessageContextMenuProps {
text?: string;
onCopy?: () => void;
children: React.ReactNode;
}
export function BotChatMessageContextMenu({ text, onCopy, children }: BotChatMessageContextMenuProps) {
const copyText = text?.trim();
return (
<ContextMenu>
<ContextMenuTrigger asChild>{children}</ContextMenuTrigger>
<ContextMenuContent className="min-w-[200px]">
{copyText ? (
<ContextMenuItem
onClick={() => {
void navigator.clipboard.writeText(copyText);
onCopy?.();
}}
>
<Copy className="h-4 w-4" />
Копировать текст
</ContextMenuItem>
) : null}
</ContextMenuContent>
</ContextMenu>
);
}