import { Button } from 'ui' import { MessageSquare, Send, X } from 'lucide-react' import { motion, AnimatePresence } from 'framer-motion' import { useState, useEffect } from 'react' import Link from 'next/link' import { useProjectsQuery } from 'data/projects/projects-query' interface AIAssistantOptionProps { projectRef: string organizationSlug: string } export const AIAssistantOption = ({ projectRef, organizationSlug }: AIAssistantOptionProps) => { const [isVisible, setIsVisible] = useState(false) const { data: projects } = useProjectsQuery() useEffect(() => { const timer = setTimeout(() => setIsVisible(true), 800) return () => clearTimeout(timer) }, []) if (!organizationSlug || organizationSlug === 'no-org') { return null } const getProjectRef = () => { if (projectRef !== 'no-project') { return projectRef } // If no specific project selected, use first project from the org const orgProjects = projects?.filter((p) => p.organization_slug === organizationSlug) return orgProjects?.[0]?.ref || '_' } const aiLink = `/project/${getProjectRef()}?aiAssistantPanelOpen=true` return ( {isVisible && (

Hi! I'm your AI assistant. How can I help you today?

I can help you with database queries, API endpoints, or any other technical questions you might have.

)}
) }