{% extends "base.html" %}

{% block content %}
    <div class="blue ui centered card">
        <div class="content">
            <div class="center aligned author">
                <img alt="Profile picture" class="ui avatar image" src="{{user.profilePic}}">
            </div>
            <div class="center aligned header"><a href="https://nitter.net/{{ user.profileUsername.replace('@','') }}">
                {%if user.profileFullName%}
                    {{user.profileFullName}}
                {%else%}
                    {{user.profileUsername}}
                {%endif%}
            </a></div>
            <div class="center aligned description">
                    <div class="statistic">
                        <div class="value">
                            <i class="users icon"></i>{{user.followers}}
                        </div>
                        <div class="label">
                        Followers
                        </div>
                    </div>   
            </div>
        </div>
        <div class="center aligned extra content">
            {% if not current_user.is_following_tw(user.profileUsername.replace('@','')) %}
                <p>
                    <form action="{{ url_for('follow', username=user.profileUsername.replace('@','')) }}" method="post">
                        {{ form.hidden_tag() }}
                        {{ form.submit(value='Follow') }}
                    </form>
                </p>
            {% else %}
                <p>
                    <form action="{{ url_for('unfollow', username=user.profileUsername.replace('@','')) }}" method="post">
                        {{ form.hidden_tag() }}
                        {{ form.submit(value='Unfollow') }}
                    </form>
                </p>
            {% endif %}        
        </div>
    </div>

    <div class="text container" id="card-container">
        {% if not posts %}
            {% include '_empty_feed.html' %}
        {% else %}
            {% for post in posts %}
                    {% include '_twitter_post.html' %}
            {% endfor %}
        {% endif %}
        <div class="scroller">
            <a href="#top" class="ui button">
                <i style="margin: 0;" class="chevron up icon"></i>
            </a>
        </div>
    </div>
{% endblock %}