{% extends "PackagistWebBundle::layout.html.twig" %}

{% import "PackagistWebBundle::macros.html.twig" as macros %}

{% block content %}
    <div class="box clearfix">
        <h1>{{ user.username }} (that's you!)</h1>
        <p><a href="{{ path('fos_user_profile_edit') }}">Edit your information</a></p>
        <p><a href="{{ path('fos_user_change_password') }}">Change your password</a></p>
        <p><a href="{{ path('user_profile', {'name':app.user.username}) }}">View your public profile</a></p>

        {% if app.user.apiToken %}
            <h1>Your API Token</h1>
            <p><pre><code>{{ app.user.apiToken }}</code></pre></p>
            <p>You can use your API token to interact with the Packagist API.</p>
            <h1>GitHub Service Hook</h1>
            <p>Enabling the Packagist service hook ensures that your package will always be updated instantly when you push to GitHub. To do so you can go to your GitHub repository, click the "Admin" button, then "Service Hooks". Pick "Packagist" in the list, and add your API token (see above), plus your Packagist username if it is not the same as on GitHub. Check the "Active" box and submit the form.</p>
        {% endif %}

        <h1>Your packages</h1>
        {% if user.packages|length %}
            {{ macros.listPackages(user.packages, null, true) }}
        {% else %}
            <p>No packages found.</p>
        {% endif %}
    </div>
{% endblock %}
