{% extends 'base.html.twig' %} {% block title %}{{ album.name }} — Reviews{% endblock %} {% block body %}
{% set image = (album.images[1] ?? album.images[0] ?? null) %} {% if image %} {{ album.name }} cover {% endif %}
{{ album.name }}
{{ album.artists|map(a => a.name)|join(', ') }}
{% set release_text = album.release_date is defined and album.release_date ? album.release_date : 'Not provided' %} {% set track_count = album.total_tracks is defined and album.total_tracks ? album.total_tracks : 0 %} {% set track_text = track_count > 0 ? track_count ~ ' tracks' : 'Track count unknown' %}

Released {{ release_text }} • {{ track_text }} {% if album.source is defined and album.source == 'user' %}
Added{{ albumOwner ? ' by ' ~ (albumOwner.displayName ?? albumOwner.userIdentifier) : '' }} {% if albumCreatedAt %}on {{ albumCreatedAt|date('Y-m-d') }}{% endif %} {% endif %}

{% if album.genres is defined and album.genres is not empty %}

Genres: {{ album.genres|join(', ') }}

{% endif %}

User score: {{ avg }}/10 ({{ count }})

{% if album.external_urls.spotify %} Open in Spotify {% endif %} {% if album.source is defined and album.source == 'user' %} User album {% endif %} {% if app.user and (album.source is not defined or album.source != 'user') and (isSaved is defined) and (not isSaved) %}
{% endif %} {% if allowedEdit %} Edit {% endif %} {% if allowedDelete %}
{% endif %}
{% if tracks is defined and tracks is not empty %}

Tracklist

{{ tracks|length }} tracks
{% for track in tracks %} {% endfor %}
# Title Duration
{{ track.disc > 1 ? track.disc ~ '.' : '' }}{{ track.track }}
{{ track.name }}
{% if track.preview_url %} {% endif %}
{{ track.duration_label }}
{% endif %}

Reviews

{% for r in reviews %} {% set avatar = r.author.profileImagePath ?? null %}
{% if avatar %} Avatar for {{ r.author.displayName ?? r.author.userIdentifier }} {% else %}
{{ (r.author.displayName ?? r.author.userIdentifier)|slice(0,1)|upper }}
{% endif %}
{{ r.title }} (Rating {{ r.rating }}/10)
by {{ r.author.displayName ?? r.author.userIdentifier }} • {{ r.createdAt|date('Y-m-d H:i') }}

{{ r.content|u.truncate(300, '…', false) }}

Read more
{% else %}

No reviews yet for this album.

{% endfor %}
{% if app.user %}

Leave a review

{{ form_start(form, {attr: {class: 'vstack gap-3', novalidate: 'novalidate'}}) }}
{{ form_label(form.title) }}{{ form_widget(form.title, {attr: {class: 'form-control'}}) }}{{ form_errors(form.title) }}
{{ form_label(form.content) }}{{ form_widget(form.content, {attr: {class: 'form-control', rows: 6}}) }}{{ form_errors(form.content) }}
{{ form_label(form.rating) }}
{{ form_widget(form.rating, {attr: {class: 'form-range', min:1, max:10, step:1, list:'rating-ticks', oninput:'document.getElementById("rating-value").textContent=this.value;'}}) }} {{ form.rating.vars.value ?? 5 }}
{% for i in 1..10 %}{% endfor %} {{ form_errors(form.rating) }}
{{ form_end(form) }}
{% else %}
Sign in to leave a review.
{% endif %}
{% endblock %}