import React from 'react'; import { Icon } from '@/components/icon/Icon'; import { cn } from '@/lib/utils'; import { useI18n } from '@/lib/i18n'; import { browserUrlLabel } from '@/lib/browser/url'; import type { BrowserHistoryEntry } from '@/lib/browser/history'; /** * Addresses already visited in this project, offered under the address bar. * * Kept deliberately plain: it is a short list of places, so it borrows the * app's dropdown surface rather than introducing a second look for the same * idea. Selection is driven from the address bar's own keyboard handling, which * is why the highlighted row arrives as a prop instead of being tracked here. */ export const BrowserAddressSuggestions: React.FC<{ entries: readonly BrowserHistoryEntry[]; activeIndex: number; onSelect: (url: string) => void; onForget: (url: string) => void; onHighlight: (index: number) => void; }> = ({ entries, activeIndex, onSelect, onForget, onHighlight }) => { const { t } = useI18n(); if (entries.length === 0) return null; return (
{entries.map((entry, index) => (
{ event.preventDefault(); onSelect(entry.url); }} onPointerEnter={() => onHighlight(index)} >
))}
); };