In-feed Back button + clickable source on the article page
* Back button on feed views: drilling into a tag or source from a card now remembers where you came from (a small history stack), and a "← Back" appears in the view header to return there — chains of drill-ins included. Top-level nav (rail/bottom bar) resets the history. * Article page: the source name is now a link into that source's in-app feed (/?source=<id>); the SPA reads the param on load and opens the source view (label falls back to the loaded feed's source name). Completes the "cards-only v1" — source is clickable on /a/ too now. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -720,7 +720,7 @@ def create_app() -> FastAPI:
|
||||
with get_conn() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT a.id, a.title, a.description, a.image_url, a.canonical_url, "
|
||||
"a.duplicate_of, src.name AS source_name, s.reason_text, s.accepted, "
|
||||
"a.duplicate_of, a.source_id, src.name AS source_name, s.reason_text, s.accepted, "
|
||||
"(SELECT group_concat(t.tag) FROM article_tags t WHERE t.article_id = a.id) AS tags "
|
||||
"FROM articles a JOIN sources src ON src.id = a.source_id "
|
||||
"LEFT JOIN article_scores s ON s.article_id = a.id WHERE a.id = ?",
|
||||
|
||||
+9
-1
@@ -23,6 +23,12 @@ def render_share_page(article: dict, base_url: str, summary: str | None = None)
|
||||
why = (article.get("reason_text") or article.get("description")
|
||||
or "A calm, constructive story worth your attention.").strip()
|
||||
source = (article.get("source_name") or "the source").strip()
|
||||
source_id = article.get("source_id")
|
||||
# Link the source name into the app's publication feed for that source.
|
||||
source_html = (
|
||||
f'<a class="src srclink" href="/?source={source_id}">{escape(source)}</a>'
|
||||
if source_id else f'<div class="src">{escape(source)}</div>'
|
||||
)
|
||||
src_url = article.get("canonical_url") or base_url
|
||||
image = article.get("image_url")
|
||||
page_url = f"{base_url}/a/{aid}"
|
||||
@@ -128,6 +134,8 @@ def render_share_page(article: dict, base_url: str, summary: str | None = None)
|
||||
.media {{ width:100%; height:auto; display:block; max-height:380px; object-fit:cover; }}
|
||||
.body {{ padding:24px 26px 28px; }}
|
||||
.src {{ color:var(--muted); font-size:.82rem; text-transform:uppercase; letter-spacing:.08em; }}
|
||||
a.srclink {{ text-decoration:none; cursor:pointer; border-bottom:1px dotted transparent; }}
|
||||
a.srclink:hover {{ color:var(--accent-deep); border-bottom-color:var(--line); }}
|
||||
h1 {{ font-family:"Iowan Old Style",Palatino,Georgia,serif; font-weight:600;
|
||||
font-size:1.7rem; line-height:1.2; margin:6px 0 14px; }}
|
||||
.summary {{ font-size:1.05rem; color:var(--ink); margin:0 0 18px; }}
|
||||
@@ -154,7 +162,7 @@ def render_share_page(article: dict, base_url: str, summary: str | None = None)
|
||||
<article class="card">
|
||||
{media}
|
||||
<div class="body">
|
||||
<div class="src">{escape(source)}</div>
|
||||
{source_html}
|
||||
<h1>{escape(title)}</h1>
|
||||
{summary_block}
|
||||
<p class="why"><span class="lbl">Why it's here</span>{escape(why)}</p>
|
||||
|
||||
Reference in New Issue
Block a user