fix: added dialog confirmation when delete thread
This commit is contained in:
parent
7a148ea025
commit
6efc52f3bd
@ -1,6 +1,6 @@
|
|||||||
.btn {
|
.btn {
|
||||||
@apply inline-flex items-center justify-center whitespace-nowrap rounded-lg font-semibold transition-colors;
|
@apply inline-flex items-center justify-center whitespace-nowrap rounded-lg font-semibold transition-colors;
|
||||||
@apply focus-visible:ring-ring cursor-pointer focus-visible:outline-none focus-visible:ring-1;
|
@apply cursor-pointer focus:outline-none focus-visible:outline-none focus-visible:ring-0;
|
||||||
@apply disabled:pointer-events-none disabled:opacity-50;
|
@apply disabled:pointer-events-none disabled:opacity-50;
|
||||||
|
|
||||||
&-primary {
|
&-primary {
|
||||||
@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-ghost {
|
&-ghost {
|
||||||
@apply hover:bg-primary hover:text-primary-foreground;
|
@apply hover:bg-secondary hover:text-secondary-foreground;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-sm {
|
&-sm {
|
||||||
|
|||||||
@ -1,5 +1,16 @@
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
import {
|
||||||
|
Modal,
|
||||||
|
ModalTrigger,
|
||||||
|
ModalClose,
|
||||||
|
ModalFooter,
|
||||||
|
ModalContent,
|
||||||
|
ModalHeader,
|
||||||
|
ModalTitle,
|
||||||
|
Button,
|
||||||
|
} from '@janhq/uikit'
|
||||||
|
|
||||||
import { motion as m } from 'framer-motion'
|
import { motion as m } from 'framer-motion'
|
||||||
import { useAtomValue } from 'jotai'
|
import { useAtomValue } from 'jotai'
|
||||||
import {
|
import {
|
||||||
@ -107,15 +118,40 @@ export default function ThreadList() {
|
|||||||
Clean thread
|
Clean thread
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<Modal>
|
||||||
className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary"
|
<ModalTrigger asChild>
|
||||||
onClick={() => deleteThread(thread.id)}
|
<div className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary">
|
||||||
>
|
<Trash2Icon
|
||||||
<Trash2Icon size={16} className="text-muted-foreground" />
|
size={16}
|
||||||
<span className="text-bold text-black dark:text-muted-foreground">
|
className="text-muted-foreground"
|
||||||
Delete thread
|
/>
|
||||||
</span>
|
<span className="text-bold text-black dark:text-muted-foreground">
|
||||||
</div>
|
Delete thread
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</ModalTrigger>
|
||||||
|
<ModalContent>
|
||||||
|
<ModalHeader>
|
||||||
|
<ModalTitle>Delete Thread</ModalTitle>
|
||||||
|
</ModalHeader>
|
||||||
|
<p>Are you sure you want to delete Thread?</p>
|
||||||
|
<ModalFooter>
|
||||||
|
<div className="flex gap-x-2">
|
||||||
|
<ModalClose asChild>
|
||||||
|
<Button themes="ghost">No</Button>
|
||||||
|
</ModalClose>
|
||||||
|
<ModalClose asChild>
|
||||||
|
<Button
|
||||||
|
themes="danger"
|
||||||
|
onClick={() => deleteThread(thread.id)}
|
||||||
|
>
|
||||||
|
Yes
|
||||||
|
</Button>
|
||||||
|
</ModalClose>
|
||||||
|
</div>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* {messages.length > 0 && (
|
{/* {messages.length > 0 && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user