global fix and update bot Api

This commit is contained in:
lendry
2026-06-26 13:01:52 +03:00
parent d3ea470d02
commit aa228d84eb
29 changed files with 980 additions and 221 deletions

View File

@@ -1,6 +1,6 @@
'use client';
import { CheckCircle2, Copy, Forward, Pencil, Reply, Trash2 } from 'lucide-react';
import { CheckCircle2, Copy, Forward, Pencil, Pin, PinOff, Reply, Trash2, XCircle } from 'lucide-react';
import { ChatMessageReactions } from '@/components/chat/chat-message-reactions';
import {
ContextMenu,
@@ -24,6 +24,7 @@ interface ChatMessageContextMenuProps {
onDelete?: () => void;
onReply?: () => void;
onForward?: () => void;
onTogglePin?: () => void;
onSelect?: () => void;
onToggleReaction?: (emoji: string) => void;
onCopy?: () => void;
@@ -39,6 +40,7 @@ export function ChatMessageContextMenu({
onDelete,
onReply,
onForward,
onTogglePin,
onSelect,
onToggleReaction,
onCopy
@@ -125,6 +127,17 @@ export function ChatMessageContextMenu({
Переслать
</ContextMenuItem>
) : null}
{onTogglePin && !disabled ? (
<ContextMenuItem
onSelect={(event) => {
event.preventDefault();
runMenuAction(onTogglePin);
}}
>
{message.isPinned ? <PinOff className="h-4 w-4" /> : <Pin className="h-4 w-4" />}
{message.isPinned ? 'Открепить' : 'Закрепить'}
</ContextMenuItem>
) : null}
{deletable ? (
<ContextMenuItem
className="text-red-600 data-[highlighted]:bg-red-50 data-[highlighted]:text-red-700"
@@ -161,6 +174,108 @@ export function ChatMessageContextMenu({
);
}
interface ChatSelectionContextMenuProps {
count: number;
canPin?: boolean;
pinned?: boolean;
children: React.ReactNode;
onReply?: () => void;
onCopy?: () => void;
onForward?: () => void;
onDelete?: () => void;
onTogglePin?: () => void;
onCancel?: () => void;
}
export function ChatSelectionContextMenu({
count,
canPin,
pinned,
children,
onReply,
onCopy,
onForward,
onDelete,
onTogglePin,
onCancel
}: ChatSelectionContextMenuProps) {
function runMenuAction(action?: () => void) {
suppressChatDragSelection();
action?.();
}
return (
<ContextMenu
onOpenChange={(open) => {
if (open) suppressChatDragSelection(800);
}}
>
<ContextMenuTrigger asChild>{children}</ContextMenuTrigger>
<ContextMenuContent className="min-w-[260px]">
<ContextMenuItem
onSelect={(event) => {
event.preventDefault();
runMenuAction(onReply);
}}
>
<Reply className="h-4 w-4" />
Ответить
</ContextMenuItem>
{canPin && onTogglePin ? (
<ContextMenuItem
onSelect={(event) => {
event.preventDefault();
runMenuAction(onTogglePin);
}}
>
{pinned ? <PinOff className="h-4 w-4" /> : <Pin className="h-4 w-4" />}
{pinned ? 'Открепить' : 'Закрепить'}
</ContextMenuItem>
) : null}
<ContextMenuItem
onSelect={(event) => {
event.preventDefault();
runMenuAction(onCopy);
}}
>
<Copy className="h-4 w-4" />
Копировать выбранное как текст
</ContextMenuItem>
<ContextMenuItem
onSelect={(event) => {
event.preventDefault();
runMenuAction(onForward);
}}
>
<Forward className="h-4 w-4" />
Переслать выбранное
</ContextMenuItem>
<ContextMenuItem
className="text-red-600 data-[highlighted]:bg-red-50 data-[highlighted]:text-red-700"
onSelect={(event) => {
event.preventDefault();
runMenuAction(onDelete);
}}
>
<Trash2 className="h-4 w-4" />
Удалить выбранное
</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem
onSelect={(event) => {
event.preventDefault();
runMenuAction(onCancel);
}}
>
<XCircle className="h-4 w-4" />
Отменить выбор
</ContextMenuItem>
<span className="sr-only">Выбрано сообщений: {count}</span>
</ContextMenuContent>
</ContextMenu>
);
}
interface SelectableMessageWrapperProps {
selected?: boolean;
selectionMode?: boolean;