mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 00:15:38 +08:00
fix: #3174 should prompt to confirm to delete chat
This commit is contained in:
@@ -18,6 +18,7 @@ import { MaskAvatar } from "./mask";
|
||||
import { Mask } from "../store/mask";
|
||||
import { useRef, useEffect } from "react";
|
||||
import { showConfirm } from "./ui-lib";
|
||||
import { useMobileScreen } from "../utils";
|
||||
|
||||
export function ChatItem(props: {
|
||||
onClick?: () => void;
|
||||
@@ -80,7 +81,11 @@ export function ChatItem(props: {
|
||||
|
||||
<div
|
||||
className={styles["chat-item-delete"]}
|
||||
onClickCapture={props.onDelete}
|
||||
onClickCapture={(e) => {
|
||||
props.onDelete?.();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<DeleteIcon />
|
||||
</div>
|
||||
@@ -101,6 +106,7 @@ export function ChatList(props: { narrow?: boolean }) {
|
||||
);
|
||||
const chatStore = useChatStore();
|
||||
const navigate = useNavigate();
|
||||
const isMobileScreen = useMobileScreen();
|
||||
|
||||
const onDragEnd: OnDragEndResponder = (result) => {
|
||||
const { destination, source } = result;
|
||||
@@ -142,7 +148,7 @@ export function ChatList(props: { narrow?: boolean }) {
|
||||
}}
|
||||
onDelete={async () => {
|
||||
if (
|
||||
!props.narrow ||
|
||||
(!props.narrow && !isMobileScreen) ||
|
||||
(await showConfirm(Locale.Home.DeleteChat))
|
||||
) {
|
||||
chatStore.deleteSession(i);
|
||||
|
Reference in New Issue
Block a user