{# Suggestions live d'autocomplétion. type = books|authors|users.
Lignes compactes role="option", lien DIRECT vers la fiche. Vide -> rien
(le contrĂ´leur Stimulus masque le menu). #}
{% if type == 'books' %}
{% for hit in books %}
{% if hit.workPublicId %}
{% set href = path('app_work_show', { publicId: hit.workPublicId }) %}
{% else %}
{% set href = path('app_work_lookup', { source: hit.source, id: hit.source == 'openlibrary' ? hit.openLibraryId : hit.googleBooksId }) %}
{% endif %}
{% set tparts = book_title_parts(hit.title, hit.subtitle|default('')) %}
{% if hit.coverUrl %}
{% else %}
{% endif %}
{{ tparts.main }}
{% if hit.authors|length %}{{ hit.authors|join(', ') }}{% endif %}
{% endfor %}
{% elseif type == 'authors' %}
{% for a in author_hits %}
{% set href = a.publicId
? path('app_author_show', { publicId: a.publicId })
: path('app_author_lookup', { name: a.name }) %}
{% if a.photoUrl %}
{% else %}
{{ a.name|first|upper }}
{% endif %}
{{ a.name }}
{% endfor %}
{% elseif type == 'users' %}
{% for u in user_hits %}
{% if user_avatar(u) %}
{% else %}
{{ (u.displayName ?: u.username)|first|upper }}
{% endif %}
{{ u.displayName ?: u.username }}
@{{ u.username }}
{% endfor %}
{% endif %}