@@ -29,12 +29,13 @@ import type { CardView, Quote, QuoteFormData, SortOption } from "@/model/index.m
2929import { cardViewOptions , useCardViewStore } from "@/store/use-card-view.store" ;
3030import { themeModes , type ThemeMode } from '@/hook/use-dark-or-light-theme.hook'
3131import { showInfo , useShowCardInfo , type ShowInfo } from "@/store/use-card-info.store" ;
32- import { ArrowLeftIcon , CircleArrowDown , CircleCheckBig , Copy , Images , LoaderCircle , Save , Share , Settings , Link2Icon , SquareArrowOutUpRight , ArrowUpRight , TrashIcon , CircleArrowLeft , RotateCcw } from "lucide-react" ;
32+ import { ArrowLeftIcon , CircleArrowDown , CircleCheckBig , Copy , Images , LoaderCircle , Save , Share , Settings , Link2Icon , SquareArrowOutUpRight , ArrowUpRight , TrashIcon , CircleArrowLeft , RotateCcw , Trash2Icon } from "lucide-react" ;
3333import { Link } from "@tanstack/react-router" ;
3434import { cn } from "@/lib/utils" ;
3535import { useGetAllDeletedQuoteDetails } from "@/api-hook/use-get-all-delete-quote-details.hook" ;
3636import { sanitizeHTML } from "@/helper/sanitize-html" ;
3737import { useUpdateQuoteDetails } from "@/api-hook/use-update-quote-details.hook" ;
38+ import { deleteQuoteWithLinks } from "@/db/quote_tags.db" ;
3839
3940interface Props {
4041
@@ -56,6 +57,13 @@ function RecycleBinComponent(props: Props) {
5657 refetch ( )
5758 }
5859
60+ const handleHardDelete = async ( quote : Quote ) => {
61+ if ( ! quote . id ) return
62+ await await deleteQuoteWithLinks ( quote . id )
63+ refetch ( )
64+ }
65+
66+
5967 return (
6068 < Dialog open = { open } onOpenChange = { setOpen }
6169
@@ -86,15 +94,16 @@ function RecycleBinComponent(props: Props) {
8694 < div
8795 className = " overflow-y-auto rounded-xl h-40 min-h-0 flex flex-col gap-1 border-2 p-2" >
8896 { data ?. map ( ( quote , i ) => (
89- < div className = "flex justify-between border-2 rounded-lg p-2" >
97+ < div key = { 'bin' + quote . id }
98+ className = "flex justify-between border-2 rounded-lg p-2" >
9099 < div
91- key = { 'bin' + quote . id }
100+
92101 className = " "
93102 dangerouslySetInnerHTML = { {
94103 __html : sanitizeHTML ( quote ?. text ! )
95104 } }
96105 />
97- < div >
106+ < div className = "flex items-center gap-2" >
98107 < Button
99108 className = { cn ( "hover:text-primary focus:text-primary active:text-primary" , ) }
100109 variant = { "outline" }
@@ -107,6 +116,18 @@ function RecycleBinComponent(props: Props) {
107116 >
108117 < RotateCcw />
109118 </ Button >
119+ < Button
120+ className = { cn ( "hover:text-primary focus:text-primary active:text-primary" , ) }
121+ variant = { "outline" }
122+ onClick = { ( e ) => {
123+ e . preventDefault ( )
124+ handleHardDelete ( quote )
125+ } }
126+ aria-label = { "Delete note" }
127+ size = { "sm" }
128+ >
129+ < Trash2Icon />
130+ </ Button >
110131 </ div >
111132 </ div >
112133
0 commit comments