import type { KeyboardEvent as ReactKeyboardEvent } from 'react' import type { Suggestion } from '@/hooks/useActiveSuggestions' import { Autocomplete } from '@/components/ChatInput/Autocomplete' import { FloatingOverlay } from '@/components/ChatInput/FloatingOverlay' import { useTranslation } from '@/lib/use-translation' export function DirectorySection(props: { directory: string suggestions: readonly Suggestion[] selectedIndex: number isDisabled: boolean recentPaths: string[] statusMessage?: string | null statusTone?: 'warning' | 'error' | null onDirectoryChange: (value: string) => void onDirectoryFocus: () => void onDirectoryBlur: () => void onDirectoryKeyDown: (event: ReactKeyboardEvent) => void onSuggestionSelect: (index: number) => void onPathClick: (path: string) => void }) { const { t } = useTranslation() return (
props.onDirectoryChange(event.target.value)} onKeyDown={props.onDirectoryKeyDown} onFocus={props.onDirectoryFocus} onBlur={props.onDirectoryBlur} disabled={props.isDisabled} className="w-full rounded-md border border-[var(--app-border)] bg-[var(--app-bg)] p-2 text-sm focus:outline-none focus:ring-2 focus:ring-[var(--app-link)] disabled:opacity-50" /> {props.suggestions.length > 0 && (
)}
{props.recentPaths.length > 0 && (
{t('newSession.recent')}:
{props.recentPaths.map((path) => ( ))}
)} {props.statusMessage ? (
{props.statusMessage}
) : null}
) }