Skip to content

Commit

Permalink
fix: added dialog confirmation when delete thread
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur committed Dec 19, 2023
1 parent 7a148ea commit 6efc52f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 11 deletions.
4 changes: 2 additions & 2 deletions uikit/src/button/styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.btn {
@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;

&-primary {
Expand Down Expand Up @@ -28,7 +28,7 @@
}

&-ghost {
@apply hover:bg-primary hover:text-primary-foreground;
@apply hover:bg-secondary hover:text-secondary-foreground;
}

&-sm {
Expand Down
54 changes: 45 additions & 9 deletions web/screens/Chat/ThreadList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { useEffect } from 'react'

import {
Modal,
ModalTrigger,
ModalClose,
ModalFooter,
ModalContent,
ModalHeader,
ModalTitle,
Button,
} from '@janhq/uikit'

import { motion as m } from 'framer-motion'
import { useAtomValue } from 'jotai'
import {
Expand Down Expand Up @@ -107,15 +118,40 @@ export default function ThreadList() {
Clean thread
</span>
</div>
<div
className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary"
onClick={() => deleteThread(thread.id)}
>
<Trash2Icon size={16} className="text-muted-foreground" />
<span className="text-bold text-black dark:text-muted-foreground">
Delete thread
</span>
</div>
<Modal>
<ModalTrigger asChild>
<div className="flex cursor-pointer items-center space-x-2 px-4 py-2 hover:bg-secondary">
<Trash2Icon
size={16}
className="text-muted-foreground"
/>
<span className="text-bold text-black dark:text-muted-foreground">
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>
{/* {messages.length > 0 && (
Expand Down

0 comments on commit 6efc52f

Please sign in to comment.