Private
Public Access
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:
1 parent
d200ab80f7
commit
69e3520e3b
11 files changed
+478
-9
No files matched your search
+2
-1
@@ -6,8 +6,9 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Evection{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{% static 'css/base.css' %}">
|
||||
<script src="{% static 'js/htmx.min.js' %}" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
|
||||
@@ -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">★</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">🔖</button>
|
||||
</div>
|
||||
@@ -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" }}">← Newer</a>
|
||||
{% endif %}
|
||||
{% if has_next_page %}
|
||||
<a href="?filter={{ active_filter }}&page={{ page|add:"1" }}">Older →</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
@@ -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 }} · {{ article.published_at|date:"M j, Y" }}</span>
|
||||
</div>
|
||||
{% include "reader/_article_actions.html" %}
|
||||
</li>
|
||||
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}{{ article.title|default:"Article" }} — Evection{% endblock %}
|
||||
{% block content %}
|
||||
<p><a href="{% url 'reader:stream' %}">← Back to stream</a></p>
|
||||
|
||||
<article>
|
||||
<h1>{{ article.title|default:"(untitled)" }}</h1>
|
||||
<p class="article-meta">
|
||||
{{ article.feed.title }} · {{ article.published_at|date:"M j, Y H:i" }}
|
||||
{% if article.author %} · {{ article.author }}{% endif %}
|
||||
{% if article.link %} · <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 %}
|
||||
@@ -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> · <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 %}
|
||||
Reference in new issue
Block a user