move edit to the bottom of message

This commit is contained in:
2023-07-20 11:44:17 +08:00
parent dd6da3a55c
commit 1c34c123aa

View File

@@ -98,8 +98,37 @@ export default function Message(props: Props) {
chat.content chat.content
)} )}
</p> </p>
<hr className="mt-2" />
<div className="w-full flex justify-between"> <div className="w-full flex justify-between">
<DeleteIcon /> <DeleteIcon />
<button onClick={() => setShowEdit(true)}>🖋</button>
{showEdit && (
<div
className={
"absolute bg-black bg-opacity-50 w-full h-full top-0 left-0 pt-5 px-5 pb-20 rounded z-10"
}
>
<textarea
className={"relative w-full h-full"}
value={chat.content}
onChange={(event: any) => {
chat.content = event.target.value;
chat.token = calculate_token_length(chat.content);
setChatStore({ ...chatStore });
}}
></textarea>
<div className={"w-full flex justify-center"}>
<button
className={"m-2 p-1 rounded bg-green-500"}
onClick={() => {
setShowEdit(false);
}}
>
Close
</button>
</div>
</div>
)}
<CopyIcon /> <CopyIcon />
</div> </div>
</div> </div>
@@ -136,34 +165,6 @@ export default function Message(props: Props) {
> >
</button> </button>
<button onClick={() => setShowEdit(true)}>🖋</button>
{showEdit && (
<div
className={
"absolute bg-black bg-opacity-50 w-full h-full top-0 left-0 pt-5 px-5 pb-20 rounded z-10"
}
>
<textarea
className={"relative w-full h-full"}
value={chat.content}
onChange={(event: any) => {
chat.content = event.target.value;
chat.token = calculate_token_length(chat.content);
setChatStore({ ...chatStore });
}}
></textarea>
<div className={"w-full flex justify-center"}>
<button
className={"m-2 p-1 rounded bg-green-500"}
onClick={() => {
setShowEdit(false);
}}
>
Close
</button>
</div>
</div>
)}
<span <span
onClick={(event: any) => { onClick={(event: any) => {
chat.example = !chat.example; chat.example = !chat.example;