{% load mptt_tags %}
{# Htmx partial — returns only the project tree, no base layout. #}
{% if projects %}
<ul class="menu bg-base-200 rounded-box w-56">
    {% recursetree projects %}
    {% if node.is_leaf_node %}
    <li>
        <a href="{% url 'lara_django_projects:project-detail' node.project_id %}">{{ node.name_display }}</a>
    </li>
    {% else %}
    <li>
        <details open>
            <summary>
                <a href="{% url 'lara_django_projects:project-detail' node.project_id %}">{{ node.name_display }}</a>
            </summary>
            <ul>
                {{ children }}
            </ul>
        </details>
    </li>
    {% endif %}
    {% endrecursetree %}
</ul>
{% else %}
<p class="text-sm text-gray-500">No projects available</p>
{% endif %}
