From c0566f3105eadb601a0f5be391228ab37cece923 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Fri, 7 Jul 2023 19:11:01 +0800 Subject: [PATCH] better way to edit message content --- src/message.tsx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/message.tsx b/src/message.tsx index 67fdbfc..8c99740 100644 --- a/src/message.tsx +++ b/src/message.tsx @@ -1,3 +1,4 @@ +import { useState } from "preact/hooks"; import { ChatStore } from "./app"; import { calculate_token_length } from "./chatgpt"; @@ -9,6 +10,7 @@ interface Props { export default function Message(props: Props) { const { chatStore, messageIndex, setChatStore } = props; const chat = chatStore.history[messageIndex]; + const [showEdit, setShowEdit] = useState(false); const DeleteIcon = () => ( + + {showEdit && ( +
+ +
+ +
+
+ )} )}