{% extends "base.html" %}

{% block title %}dashboard - irc.now{% endblock %}

{% block banner %}{% include "partials/announcement.html" %}{% endblock %}
{% block flash %}{% include "partials/flash.html" %}{% endblock %}
{% block content %}
<div class="content">
  <h1>dashboard</h1>

  <div class="card">
    <h2>account</h2>
    <p>manage your display name, email, and password.</p>
    <a href="/profile" class="btn-fill">edit profile</a>
  </div>

  <div class="card">
    <h2>plan</h2>
    <p>{{ plan }}</p>
    {% if !is_pro %}
    <a href="/billing" class="btn-fill">upgrade to pro</a>
    {% endif %}
  </div>

  <div class="card">
    <h2>services</h2>
    <div class="stats-grid">
      <div class="stat">
        <span class="stat-value">{{ paste_count }}</span>
        <span class="stat-label">pastes ({{ paste_storage }})</span>
      </div>
      <div class="stat">
        <span class="stat-value">{{ pic_count }}</span>
        <span class="stat-label">images ({{ pic_storage }})</span>
      </div>
    </div>
    <div class="card-actions">
      <a href="https://chat.irc.now" class="btn-fill">chat.irc.now</a>
      <a href="https://txt.irc.now" class="btn-fill">txt.irc.now</a>
      <a href="https://irc.pics" class="btn-fill">irc.pics</a>
    </div>
  </div>

  <div class="card">
    <h2>bouncer</h2>
    {% if is_pro %}
    {% if has_bouncer %}
    {% if bouncer_ready %}
    <p>your bouncer is <span style="color: var(--g);">running</span></p>
    {% else %}
    <p>your bouncer is <span style="color: #E08080;">not ready</span></p>
    {% endif %}
    <div class="stats-grid">
      <div class="stat">
        <span class="stat-value">{{ bouncer_uptime }}</span>
        <span class="stat-label">uptime</span>
      </div>
      <div class="stat">
        <span class="stat-value">{{ networks }}</span>
        <span class="stat-label">networks</span>
      </div>
      <div class="stat">
        <span class="stat-value">{{ channels }}</span>
        <span class="stat-label">channels</span>
      </div>
      <div class="stat">
        <span class="stat-value">{{ messages_relayed }}</span>
        <span class="stat-label">messages</span>
      </div>
    </div>
    <a href="/bouncers" class="btn-fill">manage bouncers</a>
    {% else %}
    <p>no bouncer configured</p>
    <a href="/bouncers" class="btn-fill">create bouncer</a>
    {% endif %}
    {% else %}
    <h3>shared bouncer</h3>
    <p>your free plan includes access to the shared bouncer via web chat.</p>
    <div class="card-actions">
      <a href="https://chat.irc.now" class="btn-fill">chat.irc.now</a>
      <a href="/billing" class="btn-fill">upgrade to pro</a>
    </div>
    {% endif %}
  </div>

  {% if is_pro %}
  <div class="card">
    <h2>networks</h2>
    <p>host your own IRC network at net.irc.now.</p>
    <a href="/networks" class="btn-fill">manage networks</a>
  </div>
  {% endif %}

  <div class="card">
    <h2>bots</h2>
    {% if bot_count > 0 %}
    <div class="stats-grid">
      <div class="stat">
        <span class="stat-value">{{ bot_count }}</span>
        <span class="stat-label">bots</span>
      </div>
      <div class="stat">
        <span class="stat-value">{{ bots_running }}</span>
        <span class="stat-label">running</span>
      </div>
    </div>
    <a href="/bots" class="btn-fill">manage bots</a>
    {% else %}
    <p>no bots configured</p>
    <a href="/bots/create" class="btn-fill">create a bot</a>
    {% endif %}
  </div>
</div>
{% endblock %}
