import { ChevronRight, Luggage } from 'lucide-react'; import { useEffect, useRef } from 'react'; import { useTranslation } from '../../i18n'; import EmptyState from '../shared/EmptyState'; import { Spinner } from '../shared/Spinner'; import { type PickerTrip, useAssistantTripPicker } from './useAssistantTripPicker'; /** * The user's trips to go on with in one trip's own chat, from the home chat's * head: that chat, its history and its changes belong to the trip. The * running and the next trip lead. The list opens before the trips are there, * so the focus goes onto the first one once they come. */ export default function AssistantTripPicker({ onPick }: { onPick: (trip: PickerTrip) => void }) { const { t } = useTranslation(); const trips = useAssistantTripPicker(); const first = useRef(null); useEffect(() => { first.current?.focus({ preventScroll: true }); }, [trips]); if (trips === null) { return (
); } if (trips.length === 0) { return (
); } return (
); }