import { useState, useEffect } from 'react' import { Link, useNavigate } from 'react-router-dom' import { Clock, ArrowRight, Route, MessageCircle } from 'lucide-react' import { aiSessionsApi } from '@/api/aiSessions' import type { AISessionSummary } from '@/types/ai-session' import { cn } from '@/lib/utils' import { timeAgo } from '@/lib/timeAgo' export function ActiveFlowPilotSessions({ hideHeader = false }: { hideHeader?: boolean }) { const [sessions, setSessions] = useState([]) const [loading, setLoading] = useState(true) const navigate = useNavigate() useEffect(() => { aiSessionsApi.listSessions({ status: 'active', limit: 6 }) .then(setSessions) .catch(() => {}) .finally(() => setLoading(false)) }, []) if (loading || sessions.length === 0) return null return (
{!hideHeader && (

Active Sessions

{sessions.length > 0 && ( {sessions.length} )}
View all
)}
{sessions.map((session) => ( ))}
) }