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]>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user