{% extends "base.html" %}

{% block content %}
    <div class="blue ui centered card">
        <div class="content">
            <div class="center aligned author">
                {%if config.nginxVideoStream%}
                    <img alt="Thumbnail" src="{{channel.avatar}}">
                {%else%}
                    <img alt="Thumbnail" src="/img/{{channel.avatar.replace('/', '~')}}">
                {%endif%}
            </div>
            <div class="center aligned header"><a href="">{{channel.name}}</a></div>
            <div class="center aligned description">
                    <div class="statistic">
                        <div class="value">
                            <i class="users icon"></i>{{channel.subCount}}
                        </div>
                        <div class="label">
                        Followers
                        </div>
                    </div>   
            </div>
        </div>
        {% if restricted or current_user.is_authenticated %}
        <div class="center aligned extra content">
            {% if not current_user.is_following_yt(channel.id) %}
                <p>
                    <form action="{{ url_for('ytfollow', channelId=channel.id) }}" method="post">
                        {{ btform.hidden_tag() }}
                        {{ btform.submit(value='Follow') }}
                    </form>
                </p>
            {% else %}
                <p>
                    <form action="{{ url_for('ytunfollow', channelId=channel.id) }}" method="post">
                        {{ btform.hidden_tag() }}
                        {{ btform.submit(value='Unfollow') }}
                    </form>
                </p>
            {% endif %}           
        </div>
        {% endif %}
        </div>
    </div>

    <br>
    <br> 
    {% if not videos %}
        {% include '_empty_feed.html' %}
    {% else %}
    <div class="ui centered cards">
        {% for video in videos %}
            {% include '_video_item.html' %}
        {% endfor %}
    </div>
    {% endif %}
{% endblock %}