forked from sqlchat/sqlchat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClearConversationConfirmModal.tsx
More file actions
43 lines (38 loc) · 1.28 KB
/
ClearConversationConfirmModal.tsx
File metadata and controls
43 lines (38 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { useTranslation } from "react-i18next";
import { useConversationStore, useMessageStore } from "@/store";
import Modal from "./kit/Modal";
interface Props {
close: () => void;
}
const ClearConversationConfirmModal = (props: Props) => {
const { close } = props;
const { t } = useTranslation();
const conversationStore = useConversationStore();
const messageStore = useMessageStore();
const handleClearMessages = () => {
messageStore.clearMessage(
(item) => item.conversationId !== conversationStore.currentConversationId
);
close();
};
return (
<Modal title="Clear messages" className="!w-96" onClose={close}>
<div>
<div className="w-full flex flex-col justify-start items-start mt-2">
<p className="text-gray-500">
Are you sure to clear the messages in current conversation?
</p>
</div>
<div className="w-full flex flex-row justify-end items-center mt-4 space-x-2">
<button className="btn btn-outline" onClick={close}>
{t("common.close")}
</button>
<button className="btn btn-error" onClick={handleClearMessages}>
{t("common.clear")}
</button>
</div>
</div>
</Modal>
);
};
export default ClearConversationConfirmModal;