Add the reading UI: stream, article detail, htmx actions

Implements the main reader surface: a filterable stream (Unread/All/
Starred/Saved) built on the lazy UserArticleState query pattern, an
article detail view that marks articles read on open, and htmx-backed
read/star/save-for-later toggles that update in place without a full
page reload. Rule-hidden articles are excluded from every filter.

Vendors htmx locally rather than loading it from a CDN, and adds
mobile-first responsive CSS (verified at 375px width in-browser, plus
dark mode via prefers-color-scheme).

Verified live against the real Hacker News feed subscribed in the
previous milestone: ingestion, filter switching, read/star/save
toggles, and article detail all confirmed working in the browser, with
two UI bugs fixed along the way (low-contrast message banners in dark
mode, horizontal overflow from long URLs in article content).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-30 16:08:44 -06:00
1 parent d200ab80f7
commit 69e3520e3b
11 files changed
+478 -9

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
<div id="article-actions-{{ article.pk }}" class="article-actions">
<button
hx-post="{% url 'reader:toggle_read' article.pk %}"
hx-target="#article-actions-{{ article.pk }}"
hx-swap="outerHTML"
class="icon-btn{% if article.is_read %} active{% endif %}"
title="Toggle read">{% if article.is_read %}Read{% else %}Unread{% endif %}</button>
<button
hx-post="{% url 'reader:toggle_star' article.pk %}"
hx-target="#article-actions-{{ article.pk }}"
hx-swap="outerHTML"
class="icon-btn{% if article.is_starred %} active{% endif %}"
title="Toggle star">&#9733;</button>
<button
hx-post="{% url 'reader:toggle_saved' article.pk %}"
hx-target="#article-actions-{{ article.pk }}"
hx-swap="outerHTML"
class="icon-btn{% if article.is_saved_for_later %} active{% endif %}"
title="Save for later">&#128278;</button>
</div>
+16
View File
@@ -0,0 +1,16 @@
<ul class="article-list">
{% for article in articles %}
{% include "reader/_article_row.html" %}
{% empty %}
<li class="empty-state">Nothing here.</li>
{% endfor %}
</ul>
<nav class="pagination">
{% if has_previous_page %}
<a href="?filter={{ active_filter }}&page={{ page|add:"-1" }}">&larr; Newer</a>
{% endif %}
{% if has_next_page %}
<a href="?filter={{ active_filter }}&page={{ page|add:"1" }}">Older &rarr;</a>
{% endif %}
</nav>
+7
View File
@@ -0,0 +1,7 @@
<li id="article-{{ article.pk }}" class="article-row{% if article.is_read %} is-read{% endif %}">
<div class="article-row-main">
<a class="article-title" href="{% url 'reader:article_detail' article.pk %}">{{ article.title|default:"(untitled)" }}</a>
<span class="article-meta">{{ article.feed.title }} &middot; {{ article.published_at|date:"M j, Y" }}</span>
</div>
{% include "reader/_article_actions.html" %}
</li>
+20
View File
@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block title %}{{ article.title|default:"Article" }} — Evection{% endblock %}
{% block content %}
<p><a href="{% url 'reader:stream' %}">&larr; Back to stream</a></p>
<article>
<h1>{{ article.title|default:"(untitled)" }}</h1>
<p class="article-meta">
{{ article.feed.title }} &middot; {{ article.published_at|date:"M j, Y H:i" }}
{% if article.author %} &middot; {{ article.author }}{% endif %}
{% if article.link %} &middot; <a href="{{ article.link }}" target="_blank" rel="noopener noreferrer">Original</a>{% endif %}
</p>
{% include "reader/_article_actions.html" %}
<div class="article-content">
{{ article.content_html|safe }}
</div>
</article>
{% endblock %}
+15 -3
View File
@@ -1,7 +1,19 @@
{% extends "base.html" %}
{% block title %}Stream — Evection{% endblock %}
{% block content %}
<h1>Your stream</h1>
<p>No feeds yet. The reading UI lands in a later milestone.</p>
<p><a href="{% url 'feeds:add_feed' %}">Add a feed</a> &middot; <a href="{% url 'accounts:logout' %}">Log out</a></p>
<header class="stream-header">
<h1>Evection</h1>
<nav class="top-nav">
<a href="{% url 'feeds:add_feed' %}">Add feed</a>
<a href="{% url 'accounts:logout' %}">Log out</a>
</nav>
</header>
<nav class="filter-tabs">
{% for key, label in filters %}
<a href="?filter={{ key }}" class="{% if active_filter == key %}active{% endif %}">{{ label }}</a>
{% endfor %}
</nav>
{% include "reader/_article_list.html" %}
{% endblock %}