An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Remove ClearHistory component
Yoshiki Miurac7b80e8b7423
diff --git a/components/clear-history.tsx b/components/clear-history.tsxdeleted file mode 100644index 19a4c605..00000000--- a/components/clear-history.tsx+++ /dev/null@@ -1,65 +0,0 @@-'use client'--import {- AlertDialog,- AlertDialogAction,- AlertDialogCancel,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogHeader,- AlertDialogTitle,- AlertDialogTrigger-} from '@/components/ui/alert-dialog'-import { Button } from '@/components/ui/button'-import { clearChats } from '@/lib/actions/chat'-import { useState, useTransition } from 'react'-import { toast } from 'sonner'-import { Spinner } from './ui/spinner'--type ClearHistoryProps = {- empty: boolean-}--export function ClearHistory({ empty }: ClearHistoryProps) {- const [open, setOpen] = useState(false)- const [isPending, startTransition] = useTransition()- return (- <AlertDialog open={open} onOpenChange={setOpen}>- <AlertDialogTrigger asChild>- <Button variant="outline" className="w-full" disabled={empty}>- Clear History- </Button>- </AlertDialogTrigger>- <AlertDialogContent>- <AlertDialogHeader>- <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>- <AlertDialogDescription>- This action cannot be undone. This will permanently delete your- history and remove your data from our servers.- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel disabled={isPending}>Cancel</AlertDialogCancel>- <AlertDialogAction- disabled={isPending}- onClick={event => {- event.preventDefault()- startTransition(async () => {- const result = await clearChats()- if (result?.error) {- toast.error(result.error)- } else {- toast.success('History cleared')- }- setOpen(false)- })- }}- >- {isPending ? <Spinner /> : 'Clear'}- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>- )-}