|
@@ -18,6 +18,7 @@ import { MaskAvatar } from "./mask";
|
|
import { Mask } from "../store/mask";
|
|
import { Mask } from "../store/mask";
|
|
import { useRef, useEffect } from "react";
|
|
import { useRef, useEffect } from "react";
|
|
import { showConfirm } from "./ui-lib";
|
|
import { showConfirm } from "./ui-lib";
|
|
|
|
+import { useMobileScreen } from "../utils";
|
|
|
|
|
|
export function ChatItem(props: {
|
|
export function ChatItem(props: {
|
|
onClick?: () => void;
|
|
onClick?: () => void;
|
|
@@ -80,7 +81,11 @@ export function ChatItem(props: {
|
|
|
|
|
|
<div
|
|
<div
|
|
className={styles["chat-item-delete"]}
|
|
className={styles["chat-item-delete"]}
|
|
- onClickCapture={props.onDelete}
|
|
|
|
|
|
+ onClickCapture={(e) => {
|
|
|
|
+ props.onDelete?.();
|
|
|
|
+ e.preventDefault();
|
|
|
|
+ e.stopPropagation();
|
|
|
|
+ }}
|
|
>
|
|
>
|
|
<DeleteIcon />
|
|
<DeleteIcon />
|
|
</div>
|
|
</div>
|
|
@@ -101,6 +106,7 @@ export function ChatList(props: { narrow?: boolean }) {
|
|
);
|
|
);
|
|
const chatStore = useChatStore();
|
|
const chatStore = useChatStore();
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
|
|
+ const isMobileScreen = useMobileScreen();
|
|
|
|
|
|
const onDragEnd: OnDragEndResponder = (result) => {
|
|
const onDragEnd: OnDragEndResponder = (result) => {
|
|
const { destination, source } = result;
|
|
const { destination, source } = result;
|
|
@@ -142,7 +148,7 @@ export function ChatList(props: { narrow?: boolean }) {
|
|
}}
|
|
}}
|
|
onDelete={async () => {
|
|
onDelete={async () => {
|
|
if (
|
|
if (
|
|
- !props.narrow ||
|
|
|
|
|
|
+ (!props.narrow && !isMobileScreen) ||
|
|
(await showConfirm(Locale.Home.DeleteChat))
|
|
(await showConfirm(Locale.Home.DeleteChat))
|
|
) {
|
|
) {
|
|
chatStore.deleteSession(i);
|
|
chatStore.deleteSession(i);
|