{% extends "base.html" %}
{% block title %}rssume Dashboard{% endblock %}
{% block content %}
<h1>Dashboard</h1>
<p class="subtitle">Monitor your RSS feeds and AI processing status</p>

<div hx-get="/api/stats" hx-trigger="every 5s" hx-target="#stats-content" hx-swap="innerHTML" aria-hidden="true"></div>
<div id="stats-content">
    {% include "partials/stats_bar.html" %}
</div>

<h2>Feeds</h2>
<table>
    <thead><tr><th>Name</th><th>Status</th><th>Articles</th><th>Translated</th><th>Summarized</th><th>Last Fetch</th><th>RSS</th></tr></thead>
    <tbody>
        {% for f in feed_rows %}
        <tr>
            <td><a href="/panel/feed/{{ f.name }}" style="color:var(--link);text-decoration:none;">{{ f.name }}</a></td>
            <td><span class="status-dot" id="status-{{ f.name }}" style="color: {% if f.status == 'Fetching' %}#0070f3{% elif f.status is starting_with('Translating') %}#0070f3{% elif f.status == 'Done' %}#50e3c2{% elif f.status == 'Error' %}#ee0000{% else %}#888888{% endif %};" title="{{ f.status }}">●</span></td>
            <td>{{ f.article_count }}</td>
            <td><span class="badge {% if f.translated_count > 0 %}badge-success{% endif %}">{{ f.translated_count }}</span></td>
            <td><span class="badge {% if f.with_summary_count > 0 %}badge-success{% endif %}">{{ f.with_summary_count }}</span></td>
            <td style="font-size:12px;color:var(--mute);">{% if f.last_fetch_at %}{{ f.last_fetch_at | truncate(length=19) }}{% else %}--{% endif %}</td>
            <td><code style="font-size:12px;">/feeds/{{ f.name }}</code></td>
        </tr>
        {% endfor %}
    </tbody>
</table>

{% if feed_rows | length == 0 %}
<div class="empty-state"><h3>No feeds configured</h3><p>Add RSS feeds to your config.toml to get started.</p></div>
{% endif %}
{% endblock %}
