{% extends 'base.html' %}

{% block content %}
    {% if user.is_authenticated and urls|length > 0 %}
        {% for url in urls %}
            <!-- Post preview-->
            <div class="post-preview">
                <div class="d-flex justify-content-between">
                    <div class="p-2">
                        <a href="{% url 'reader' url.id %}">
                            <h2 class="post-title">{{ url.title }}</h2>
                        </a>
                    </div>
                    <div class="p-2">
                        <a href="{% url 'archive_url' url.id %}"><span class="fa-regular fa-square-check"></span></a>
                    </div>
                </div>
                {% if url.content %}
                <p class="post-meta">
                    {{ url.content }}
                </p>
                {% endif %}
                <p class="post-meta">
                    <a href="{{ url.url }}">
                        {{ url.url }}
                    </a>
                </p>
            </div>
            <!-- Divider-->
            <hr class="my-4" />
        {% endfor %}
    {% elif user.is_authenticated %}
        <div class="post-preview">
            <h2 class="post-title">У вас нет сохраненных ссылок</h2>
        </div>
    {% elif not user.is_authenticated %}
        {% include 'about_include.html' %}
        {% include 'faq_include.html' %}
    {% endif %}
{% endblock %}
