{% extends 'base.html.twig' %} {% block body_class %}page-wide{% endblock %} {% set authors_list = [] %} {% for author in work.authors %}{% set authors_list = authors_list|merge([author.name]) %}{% endfor %} {% block title %}{{ work.title }}{% if authors_list|length > 0 %} · {{ authors_list|join(', ') }}{% endif %} · LivreComment{% endblock %} {% block og %} {% set og_cover = work_cover(work) %} {% if og_cover %}{% endif %} {% endblock %} {% block app_header %} {% include 'components/_detail_header.html.twig' with { back_fallback: path('app_search'), title: 'Retour' } only %} {% endblock %} {% block body %} {# SVG sprite : symbol unique pour l'étoile, réutilisé via #}
{% for label, messages in app.flashes(['error']) %} {% endfor %}
{# turbo-frame : changer de statut de lecture se joue dans le frame, sans créer d'entrée d'historique ni recharger la page. Résultat : le bouton « Retour » revient à la vraie origine (recherche), pas à un état intermédiaire, et le scroll est préservé. #}
{% if user_shelf == 'want_to_read' %} {% elseif user_shelf == 'reading' %} {% elseif user_shelf == 'read' %} {% endif %}
Ajouter à une liste
{# /.page-toolbar #}

{{ work.title }}

{% if work.originalTitle and work.originalTitle != work.title %}

{{ work.originalTitle }}

{% endif %}
{% if work.genres|length > 0 or work.awards|length > 0 %}
{% if work.genres|length > 0 %}
{{ work.genres|length }}
{% for genre in work.genres %} {{ genre.name }} {% endfor %}
{% endif %} {% if work.awards|length > 0 %}
{{ work.awards|length }}
{% for award in work.awards %} {{ award }} {% endfor %}
{% endif %}
{% endif %}
{% if authors_list|length > 0 %}

{{ authors_list|join(', ') }}

{% endif %}
{% set meta_parts = [] %} {% if work.firstPublishedYear %}{% set meta_parts = meta_parts|merge([work.firstPublishedYear]) %}{% endif %} {% if work.originalLanguage %}{% set meta_parts = meta_parts|merge([work.originalLanguage|upper]) %}{% endif %} {# Méta éditions : on prend l'édition canonique élue (publisher whitelist FR + cover + plus récente). Fallback editions|first si pas encore élue. #} {% set canonical_edition = work.canonicalEdition ?? (work.editions|first) %} {% if canonical_edition and canonical_edition.pageCount %}{% set meta_parts = meta_parts|merge([canonical_edition.pageCount ~ ' p.']) %}{% endif %} {% if canonical_edition and canonical_edition.publisher %}{% set meta_parts = meta_parts|merge([canonical_edition.publisher]) %}{% endif %} {% for part in meta_parts %} {{ part }} {% if not loop.last %}·{% endif %} {% endfor %}
{# Note moyenne — réponse directe à "ce livre est-il bien ?" #} {% if work.ratingsCount > 0 %}
{{ work.ratingsAvg }} · {{ work.ratingsCount }} lecteur{{ work.ratingsCount > 1 ? 's' : '' }}
{% else %}
Pas encore de note
{% endif %}
{# Synopsis dépliable, CHARGÉ EN DIFFÉRÉ. L'enrichissement de la description (GB/OL, lent : jusqu'à ~10s) se fait dans le frame APRÈS le rendu de la fiche. Contenu initial = displayDescription (fallback méta), remplacé par la vraie description une fois enrichie. #}
{% include 'works/_synopsis_inner.html.twig' with { work: work } only %}
{# Widget de notation — centré, compact. Glisser à 0 = retirer la note. #}
{{ user_rating ? 'Glisse à gauche pour retirer' : 'Note ce livre' }}
{# Histogramme compact des notes des lecteurs #} {% if work.ratingsCount > 0 %}
{% for i in 1..10 %} {% set score = (i * 0.5)|number_format(1, '.', '') %} {% set count = ratings_distribution[score] ?? 0 %} {% set pct = work.ratingsCount > 0 ? (count / work.ratingsCount * 100) : 0 %}
{% endfor %}
0.55.0
{% endif %} {# Critique — 2 modes : - pas encore de critique → bloc discret ouvert (heading + textarea visible) - critique présente → lien repliable (clic pour modifier) #}
{% if user_review %} Modifier ma critique {% else %} Écris ta critique {% endif %} {% if user_rating is null %}

Note ce livre d'abord, ensuite tu pourras y associer une critique.

{% endif %}
{% if user_review %} {% endif %}
{% if user_review %}
{% endif %}
{# Critiques d'autres lecteurs. Section masquée si aucune (au lieu d'afficher un message qui semble dire "le livre n'a aucune critique" alors que le current user en a peut-être posté une — visible plus haut dans le bloc "Ma critique"). #} {% if other_reviews|length > 0 %}

Critiques d'autres lecteurs

{% for review in other_reviews %} {% include 'works/_book_review_card.html.twig' with { review: review } only %} {% endfor %}
{# Lien vers la page dédiée si plus de critiques que l'aperçu. #} {% if other_reviews_count > other_reviews|length %} Voir les {{ other_reviews_count }} critiques {% endif %}
{% endif %} {# Pub : entre la critique et les éditions #} {% include 'components/_ad_slot.html.twig' with { slot: 'book-detail' } only %} {# Éditions : section repliable, discrète, CHARGÉE EN DIFFÉRÉ (Turbo frame). L'appel Open Library (lent, 20-44s) ne bloque plus le rendu de la fiche : il se fait en arrière-plan après affichage. #}
Voir les éditions

Chargement des éditions…

{# Adaptations — disclosure juste après Éditions (même style, même rythme) #} {% if work.adaptations|length > 0 %}
{{ work.adaptations|length }} adaptation{{ work.adaptations|length > 1 ? 's' : '' }} à l'écran
    {% for adapt in work.adaptations|slice(0, 8) %}
  • {{ adapt.type ?? 'film' }} {{ adapt.title }} {% if adapt.year ?? false %}{{ adapt.year }}{% endif %}
  • {% endfor %}
{% endif %} {# Bloc auteur — imposant, style « profil d'artiste » avec photo en bandeau #} {% if main_author %} {% set author_works_count = main_author.works|length %} {% set author_bio_clean = main_author.bio|strip_markdown %}

L'auteur

{% if author_photo(main_author) %}
{% else %} {% endif %}
{{ main_author.name }}

{% set meta_bits = ['Auteur'] %} {% if author_works_count > 0 %} {% set meta_bits = meta_bits|merge([author_works_count ~ ' livre' ~ (author_works_count > 1 ? 's' : '') ~ ' dans LivreComment']) %} {% endif %} {% if main_author.birthYear %} {% set meta_bits = meta_bits|merge([main_author.birthYear ~ (main_author.deathYear ? ' – ' ~ main_author.deathYear : '')]) %} {% endif %} {{ meta_bits|join(' · ') }}

{% if author_bio_clean %}

{{ author_bio_clean|length > 320 ? author_bio_clean|slice(0, 320) ~ '…' : author_bio_clean }}

{% endif %}
{% endif %} {# Du même auteur — vignettes scrollables sur mobile, grille sur desktop #} {% if other_works_by_author|length > 0 %}

Du même auteur{% if main_author %} · {{ main_author.name }}{% endif %}

{% endif %}
{# /book-grid__main #}
{# /book-grid #}
{% endblock %}