'use client'
import * as React from 'react'
import { useTransition } from 'react'
import { Loader2Icon, MessageSquare, Trash2Icon } from 'lucide-react'
import Link from 'next/link'
import { usePathname, useRouter } from 'next/navigation'
import { cn } from '@/lib/utils'
import { removeChat } from '@/app/actions'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle
} from '@/components/ui/alert-dialog'
import { Button, buttonVariants } from '@/components/ui/button'
export function SidebarItem({
title,
href,
id,
userId
}: {
title: string
href: string
id: string
userId: string
}) {
const [open, setIsOpen] = React.useState(false)
const pathname = usePathname()
const router = useRouter()
const isActive = pathname === href
const [isPending, startTransition] = useTransition()
if (!id) return null
return (
<>