{% load park_tags %}

{% if user.is_authenticated %}
<div class="flex justify-end gap-2 mb-2">
    <a href="{% url 'parks:park_update' park.slug %}" 
       class="transition-transform btn-secondary hover:scale-105">
        <i class="mr-1 fas fa-pencil-alt"></i>Edit
    </a>
    {% include "rides/partials/add_ride_modal.html" %}
    {% if perms.media.add_photo %}
    <button class="transition-transform btn-secondary hover:scale-105" 
            @click="$dispatch('show-photo-upload')">
        <i class="mr-1 fas fa-camera"></i>Upload Photo
    </button>
    {% endif %}

    <!-- Add/Edit Review Button -->
    {% if not park.reviews.exists %}
    <a href="{% url 'reviews:add_review' park.slug %}" 
       class="transition-transform btn-secondary hover:scale-105">
        <i class="mr-1 fas fa-star"></i>Add Review
    </a>
    {% else %}
        {% if user|has_reviewed_park:park %}
        <a href="{% url 'reviews:edit_review' park.slug %}" 
           class="transition-transform btn-secondary hover:scale-105">
            <i class="mr-1 fas fa-star"></i>Edit Review
        </a>
        {% else %}
        <a href="{% url 'reviews:add_review' park.slug %}" 
           class="transition-transform btn-secondary hover:scale-105">
            <i class="mr-1 fas fa-star"></i>Add Review
        </a>
        {% endif %}
    {% endif %}
</div>
{% endif %}
