Files
cobble/src/pages/admin/bots/[bot_id]/(partials)/user-message-reply.tsx
T
tbenandClaude Opus 5.5 51fd4d5538 Give each user message its own copy, reply and time
Two prompts sent close together (as while a bot is still answering)
shared one row under their group: every copy button bunched beside the
last message's time. Each user message now has its own row, with its
copy button, a new Reply button (once it is saved) and its own time.
copyableMessages is gone with the shared row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 07:40:22 +01:00

31 lines
965 B
TypeScript

import { useContext } from "react";
import { Reply } from "lucide-react";
import type { BotMessageWithAttachments } from "@/src/types";
import { BotMessageActionsContext } from "../(data)/message-actions-context";
import MessageActionButton from "./message-action-button";
type Props = {
message: BotMessageWithAttachments;
};
/**
* Reply to one of the user's own messages, beside its copy button. A
* message still on its way has only a temporary (negative) id, so it gets
* no button until the saved one replaces it.
*/
export default function UserMessageReply({ message }: Props) {
const { onReply } = useContext(BotMessageActionsContext);
if (!(Number(message.id) > 0)) return null;
return (
<MessageActionButton
title="Reply"
aria_label="Reply to this message"
onClick={() => onReply({ message })}
>
<Reply size={14} aria-hidden />
</MessageActionButton>
);
}