Spaces:
Sleeping
Sleeping
| {% extends "base.html" %} | |
| {% block content %} | |
| <div class="card"> | |
| <h2>History</h2> | |
| <p class="subtitle"> | |
| View and export your past tone analyses. Data is private to your account. | |
| </p> | |
| <!-- Search --> | |
| <div class="history-search"> | |
| <form method="GET"> | |
| <input type="text" name="q" value="{{ search or '' }}" | |
| placeholder="Search text..." | |
| style="max-width: 260px; padding: 8px;"> | |
| <button type="submit" class="btn-secondary">Search</button> | |
| </form> | |
| </div> | |
| <!-- Filter buttons --> | |
| <div class="filter-buttons"> | |
| <a href="{{ url_for('history_view') }}" | |
| class="filter-btn {% if not active_filter %}active{% endif %}"> | |
| All | |
| </a> | |
| <a href="{{ url_for('history_view', label='Aggressive', q=search) }}" | |
| class="filter-btn {% if active_filter|lower == 'aggressive' %}active{% endif %}"> | |
| Aggressive | |
| </a> | |
| <a href="{{ url_for('history_view', label='Neutral', q=search) }}" | |
| class="filter-btn {% if active_filter|lower == 'neutral' %}active{% endif %}"> | |
| Neutral | |
| </a> | |
| <a href="{{ url_for('history_view', label='Polite', q=search) }}" | |
| class="filter-btn {% if active_filter|lower == 'polite' %}active{% endif %}"> | |
| Polite | |
| </a> | |
| <a href="{{ url_for('history_view', label='Friendly', q=search) }}" | |
| class="filter-btn {% if active_filter|lower == 'friendly' %}active{% endif %}"> | |
| Friendly | |
| </a> | |
| </div> | |
| <!-- Actions --> | |
| <div class="history-actions"> | |
| <a href="{{ url_for('export_csv') }}"> | |
| <button type="button" class="btn-secondary">Export CSV</button> | |
| </a> | |
| <a href="{{ url_for('export_pdf') }}"> | |
| <button type="button" class="btn-secondary">Export PDF</button> | |
| </a> | |
| <form method="POST" action="{{ url_for('clear_history') }}" | |
| onsubmit="return confirm('Clear all history for your account?');"> | |
| <input type="hidden" name="csrf_token" value="{{ csrf_token }}"> | |
| <button type="submit" class="btn-danger">Clear History</button> | |
| </form> | |
| </div> | |
| <!-- Table --> | |
| {% if history %} | |
| <div class="table-wrapper"> | |
| <table class="table"> | |
| <thead> | |
| <tr> | |
| <th>Time (UTC)</th> | |
| <th>Label</th> | |
| <th>Severity</th> | |
| <th>Threat</th> | |
| <th>Polite</th> | |
| <th>Friendly</th> | |
| <th>Text</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {% for e in history %} | |
| <tr> | |
| <td>{{ e.created_at.isoformat() }}</td> | |
| <td>{{ e.label }}</td> | |
| <td>{{ e.severity }}</td> | |
| <td>{{ e.threat_score }}</td> | |
| <td>{{ e.politeness_score }}</td> | |
| <td>{{ e.friendly_score }}</td> | |
| <td>{{ e.text[:120] }}{% if e.text|length > 120 %}...{% endif %}</td> | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> | |
| </div> | |
| {% else %} | |
| <p class="empty">No entries yet. Analyze some text to see your history here.</p> | |
| {% endif %} | |
| </div> | |
| {% endblock %} | |