import { ThreadPrimitive } from '@assistant-ui/react'; import { useTranslation } from '../../i18n'; import EmptyState from '../shared/EmptyState'; import AssistantHints, { MAX_VISIBLE_HINTS } from './AssistantHints'; import { useAssistantView } from './assistantViewContext'; import { useAssistantHints } from './useAssistantHints'; import type { ReadySuggestion } from './useAssistantSuggestions'; /** Suggestions left under a full list of hints, so both fit the smallest window. */ const SUGGESTIONS_UNDER_HINTS = 2; /** * The empty chat: the mascot, one question, and a few things to ask that fit * where the trip stands. A suggestion sends itself; there is nothing to edit * first. On the phone the suggestions sit by the composer instead, where the * thumb is, so this shows them only when `withSuggestions` asks for it. * Between the two sit the plan hints, when the trip has any. */ export default function AssistantWelcome({ suggestions, canEdit, withSuggestions, }: { suggestions: ReadySuggestion[]; canEdit: boolean; withSuggestions: boolean; }) { const { t } = useTranslation(); const { tripId, variant } = useAssistantView(); const hints = useAssistantHints(tripId, { withStays: true }); const crowded = Math.min(hints.hints.length, MAX_VISIBLE_HINTS) > SUGGESTIONS_UNDER_HINTS; const offered = crowded ? suggestions.slice(0, SUGGESTIONS_UNDER_HINTS) : suggestions; return (
{t('assistant.empty.readOnly')}
)}