|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useEffect, useMemo, useRef } from "react";
|
|
|
+import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
|
import {
|
|
|
PlusOutlined,
|
|
|
CloseOutlined,
|
|
@@ -261,6 +261,8 @@ export default function Chat(props: { onClose?: () => void }) {
|
|
|
}
|
|
|
}, [chatId]);
|
|
|
|
|
|
+ const [hoverId, setHoverId] = useState<string | null>(null);
|
|
|
+
|
|
|
const items = useMemo(() => {
|
|
|
const hasCurrentChat = history?.find((item) => item.id === chatId);
|
|
|
const groups = groupDataByDate(
|
|
@@ -304,12 +306,13 @@ export default function Chat(props: { onClose?: () => void }) {
|
|
|
</span>
|
|
|
) : null}
|
|
|
</div>
|
|
|
- <div className="h-full w-50px text-right absolute right-0 top-0 bg-#fff opacity-0 hover:opacity-100">
|
|
|
+ {/* TODO: 添加编辑删除按钮 */}
|
|
|
+ { hoverId === item.id && <div className="h-full w-50px text-right absolute right-0 top-0 bg-#fff">
|
|
|
<EditOutlined onClick={(e) => {
|
|
|
e.stopPropagation();
|
|
|
}}/>
|
|
|
<DeleteOutlined/>
|
|
|
- </div>
|
|
|
+ </div>}
|
|
|
</div>
|
|
|
),
|
|
|
onClick: () => {
|
|
@@ -317,6 +320,9 @@ export default function Chat(props: { onClose?: () => void }) {
|
|
|
|
|
|
setChatId(item.id);
|
|
|
},
|
|
|
+ onMouseOver: () => {
|
|
|
+ setHoverId(item.id);
|
|
|
+ }
|
|
|
};
|
|
|
});
|
|
|
};
|