{% extends "base.html" %}
{% block title %}Tableau de bord{% endblock %}

{% block content %}

<div class="stat-row">
  <div class="stat-box">
    <div class="label">Fichiers CDN</div>
    <div class="value">{{ total_files }}</div>
  </div>
  <div class="stat-box">
    <div class="label">Taille totale</div>
    <div class="value">{{ humansize(total_size) }}</div>
  </div>
  <div class="stat-box">
    <div class="label">Dossiers</div>
    <div class="value">{{ folders | length }}</div>
  </div>
  <a href="{{ url_for('trash_list') }}" class="stat-box stat-box--trash">
    <div class="label">Corbeille</div>
    <div class="value">{{ trash.files }}</div>
    <div class="stat-sub">{{ humansize(trash.size) }}
      {% if trash.oldest %}
        · depuis le {{ trash.oldest.strftime('%d/%m/%Y') }}
      {% endif %}
    </div>
  </a>
</div>

<section class="card">
  <h2>Contenu du CDN</h2>
  <div class="folder-grid">
    {% for name, info in folders.items() %}
    <a href="{{ url_for('browse', subpath=name) }}" class="folder-card">
      <div class="icon">📁</div>
      <div class="name">{{ name }}/</div>
      <div class="meta">
        {{ info.files }} fichier{% if info.files != 1 %}s{% endif %}
        &nbsp;·&nbsp; {{ humansize(info.size) }}
      </div>
    </a>
    {% else %}
    <p class="empty">Aucun dossier trouvé dans <code>ASSETS_ROOT</code>.</p>
    {% endfor %}
  </div>
</section>

{% endblock %}
