opt: remove redundant code

This commit is contained in:
RugerMc 2023-04-02 00:25:14 +08:00
parent 556e3ce935
commit 1022c3ef06

View File

@ -288,18 +288,6 @@ export function Chat(props: {
} }
}; };
const confirmEdit = (index: number) => {
chatStore.onConfirmEdit(index);
}
const cancelEdit = (message: Message) => {
chatStore.onCancelEdit(message);
}
const onEdit = (message: Message) => {
chatStore.onUserEdit(message);
}
// for auto-scroll // for auto-scroll
const latestMessageRef = useRef<HTMLDivElement>(null); const latestMessageRef = useRef<HTMLDivElement>(null);
const [autoScroll, setAutoScroll] = useState(true); const [autoScroll, setAutoScroll] = useState(true);
@ -490,7 +478,7 @@ export function Chat(props: {
<div className={styles["chat-message-bottom-actions"]}> <div className={styles["chat-message-bottom-actions"]}>
<div <div
className={styles["chat-message-bottom-action"]} className={styles["chat-message-bottom-action"]}
onClick={() => onEdit(message)}> onClick={() => chatStore.onUserEdit(message)}>
{Locale.Chat.Actions.Edit} {Locale.Chat.Actions.Edit}
</div> </div>
</div> </div>
@ -507,13 +495,13 @@ export function Chat(props: {
<div style={{display: "flex"}}> <div style={{display: "flex"}}>
<div <div
className={styles["chat-message-action-edit"]} className={styles["chat-message-action-edit"]}
onClick={() => confirmEdit(i)}> onClick={() => chatStore.onConfirmEdit(i)}>
{Locale.Chat.Actions.Confirm} {Locale.Chat.Actions.Confirm}
</div> </div>
<div <div
className={styles["chat-message-action-edit"]} className={styles["chat-message-action-edit"]}
onClick={() => cancelEdit(message)}> onClick={() => chatStore.onCancelEdit(message)}>
{Locale.Chat.Actions.Cancel} {Locale.Chat.Actions.Cancel}
</div> </div>
</div> </div>