{
if (isSearchActive) return;
if (!isCollapsed) return;
e.preventDefault();
setIsFocused(true);
requestAnimationFrame(() => inputRef.current?.focus());
}}
>
{loading ? (
) : (
)}
{scope && (
)}
{ghostScope && (
)}
handleQueryChange(e.target.value)}
onFocus={() => {
setIsFocused(true);
if (!isLiveSearchDropdownBlocked(scope) && results) setOpen(true);
}}
onBlur={() => setIsFocused(false)}
onKeyDown={handleKeyDown}
aria-autocomplete="list"
aria-controls="search-results"
aria-expanded={open && !isLiveSearchDropdownBlocked(scope)}
autoComplete="off"
/>
{searchSource && !share.shareMatch && (
{searchSource === 'local' ? (
) : (
)}
{t(
searchSource === 'local'
? 'search.localIndexBadge'
: 'search.networkSearchBadge',
)}
)}
{!hasResults && !loading && (
{t('search.noResults', { query })}
)}
{share.shareMatch && (
void share.enqueueShareMatch()}
onOpenAlbum={share.openShareAlbum}
onOpenArtist={share.openShareArtist}
onOpenComposer={share.openShareComposer}
onContextMenu={(e, item, type) => openContextMenu(e.clientX, e.clientY, item, type)}
shareTrackSong={share.shareTrackSong}
shareTrackResolving={share.shareTrackResolving}
shareTrackUnavailable={share.shareTrackUnavailable}
shareAlbum={share.shareAlbum}
shareAlbumResolving={share.shareAlbumResolving}
shareAlbumUnavailable={share.shareAlbumUnavailable}
shareArtist={share.shareArtist}
shareArtistResolving={share.shareArtistResolving}
shareArtistUnavailable={share.shareArtistUnavailable}
shareComposer={share.shareComposer}
shareComposerResolving={share.shareComposerResolving}
shareComposerUnavailable={share.shareComposerUnavailable}
/>
)}
{(() => {
if (share.shareMatch) return null;
let idx = 0;
return <>
{results?.artists.length ? (
{t('search.artists')}
{results.artists.map(a => {
const i = idx++;
const isCtxActive = ctxIsOpen && ctxType === 'artist' && ctxItemId === a.id;
return (
);
})}
) : null}
{results?.albums.length ? (
{t('search.albums')}
{results.albums.map(a => {
const i = idx++;
const isCtxActive = ctxIsOpen && ctxType === 'album' && ctxItemId === a.id;
return (
);
})}
) : null}
{results?.songs.length ? (
{t('search.songs')}
{results.songs.map(s => {
const i = idx++;
const isCtxActive = ctxIsOpen && ctxType === 'song' && ctxItemId === s.id;
return (
);
})}
) : null}
>;
})()}