opt: remove icon

This commit is contained in:
RugerMc
2023-04-01 21:13:07 +08:00
parent 568cd7d194
commit e1684b3014
7 changed files with 27 additions and 30 deletions

View File

@@ -375,24 +375,14 @@
}
.chat-message-action-edit {
font-size: 12px;
color: black;
opacity: 0.5;
color: var(--black);
white-space: nowrap;
cursor: pointer;
}
.chat-message-action-edit-button {
width: 24px;
height: 15px;
opacity: 1;
background: rgba(255, 255, 255, 1);
border: 1px solid rgba(29.044500000000014, 147.21574999999993, 170.85, 1);
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
&:not(:first-child) {
margin-right: 5px;
margin-left: 5px;
}
&:hover {
opacity: 1;
}
}

View File

@@ -20,8 +20,6 @@ import MenuIcon from "../icons/menu.svg";
import CloseIcon from "../icons/close.svg";
import CopyIcon from "../icons/copy.svg";
import DownloadIcon from "../icons/download.svg";
import OkIcon from "../icons/ok.svg";
import ErrorIcon from "../icons/error.svg";
import { Message, SubmitKey, useChatStore, ChatSession } from "../store";
import { showModal, showToast } from "./ui-lib";
@@ -192,11 +190,11 @@ export function Chat(props: {
const fontSize = useChatStore((state) => state.config.fontSize);
const inputRef = useRef<HTMLTextAreaElement>(null);
const MessageInputRefs = useRef<HTMLDivElement[]>([]);
const messageInputRefs = useRef<HTMLDivElement[]>([]);
// avoid rendered more hooks error
const setMessageInputRef = (element: HTMLDivElement | null, index: number) => {
if (element) {
MessageInputRefs.current[index] = element;
messageInputRefs.current[index] = element;
}
};
const [userInput, setUserInput] = useState("");
@@ -511,14 +509,19 @@ export function Chat(props: {
</div>
)}
{isUser && message.isEditing && (
<div className={styles["chat-message-actions"]}>
<div className={styles["chat-message-action-edit-button"]} onClick={()=>{confirmEdit(i, MessageInputRefs.current[i].innerText!!)}}>
<OkIcon />
</div>
<div className={styles["chat-message-action-edit-button"]} onClick={()=>{cancelEdit(message)}}>
<ErrorIcon />
</div>
<div style={{display: "flex"}}>
<div
className={styles["chat-message-action-edit"]}
onClick={() => confirmEdit(i, messageInputRefs.current[i].innerText)}>
{Locale.Chat.Actions.Confirm}
</div>
<div
className={styles["chat-message-action-edit"]}
onClick={() => cancelEdit(message)}>
{Locale.Chat.Actions.Cancel}
</div>
</div>
)}
</div>
</div>