Files
Evection/templates/reader/stream.html
T
ksmithandClaude Sonnet 5 03dd37e69d Notify the open stream when new articles arrive
The stream had no way to learn about articles the background poll
ingested while the page was open — only a manual reload or navigation
ever picked them up.

Adds a lightweight "N new articles — click to show" banner: the stream
records the highest article id in its current scope (filter/tag/feed)
when rendered, and an htmx poll every 30s checks reader:check_new for
anything newer in that same scope. It never swaps the list out from
under you mid-read — clicking the banner is what actually reloads it.
id, not published_at, is the cursor, since a feed can backdate an
entry's published date below everything currently on screen while it's
still genuinely new to this stream.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-31 15:04:55 -06:00

34 lines
1.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Stream — Evection{% endblock %}
{% block content %}
<div class="stream-toolbar">
<h1 class="stream-scope-title">
{% if active_feed %}{{ active_feed.title|default:active_feed.feed_url }}
{% elif active_tag %}{{ active_tag.name }}
{% else %}All articles{% endif %}
</h1>
<nav class="filter-tabs">
{% for key, label in filters %}
<a href="?filter={{ key }}{% if active_tag %}&tag={{ active_tag.pk }}{% endif %}{% if active_feed %}&feed={{ active_feed.pk }}{% endif %}"
class="{% if active_filter == key %}active{% endif %}">{{ label }}</a>
{% endfor %}
</nav>
<form method="post"
action="{% url 'reader:mark_all_read' %}?filter={{ active_filter }}{% if active_tag %}&tag={{ active_tag.pk }}{% endif %}{% if active_feed %}&feed={{ active_feed.pk }}{% endif %}"
class="inline-form">
{% csrf_token %}
<button type="submit">Mark all as read</button>
</form>
</div>
<div id="new-articles-banner"
hx-get="{% url 'reader:check_new' %}?since={{ latest_article_id }}&{{ new_check_qs }}"
hx-trigger="every 30s"
hx-target="this"
hx-swap="innerHTML"></div>
{% include "reader/_article_list.html" %}
{% endblock %}