feat: public overview of all topics + votes (index page) #2

Open
opened 2026-06-23 10:11:03 +00:00 by mAi · 1 comment
Collaborator

Goal

Add a public overview / index page to dasbes.de that lists all existing topics with their vote activity. It's for users to browse what's there — and doubles as a lightweight admin overview.

What to build

  • A new page (suggested route /alle, pick what reads best) listing every topic that has content, each row showing:
    • the topic name, linked to /<thema>
    • the current top answer ("Das beste <Thema> ist …") — truncated if long
    • number of suggestions and total votes in that topic
  • Sort by activity (most votes / most suggestions first). Show a total count ("N Themen") at the top.
  • Link it prominently: from the homepage and from each topic page (e.g. a "Alle Themen" link in the footer/header).
  • Admin mode (?admin=<token>, reuse the existing ADMIN_TOKEN): additionally show hidden/empty topics and per-row delete/hide controls. Without the token it's the clean public list.

Constraints

  • Same lean stack (Bun server, the dasbes schema on mRiver Supabase — extend with a query that aggregates per topic; no new dependencies).
  • Keep the existing dark/yellow, mobile-first style. noindex stays.
  • Don't break the existing topic pages / voting / suggestions.

Definition of Done

  • /alle (or chosen route) live: all topics with suggestion + vote counts, sorted by activity, each linking to its topic page; total count shown.
  • Linked from homepage + topic pages.
  • Admin token reveals hidden topics + delete controls.
  • Verified against the live domain. Commit to m/dasbes, comment live URL + commit link on this issue, set status:done (don't close).

Reference: the app built in #1 (server.ts + dasbes schema). Repo m/dasbes, deployed as a Dokploy compose on mLake serving dasbes.de.

## Goal Add a **public overview / index page** to dasbes.de that lists **all existing topics with their vote activity**. It's for users to browse what's there — and doubles as a lightweight admin overview. ## What to build - A new page (suggested route **`/alle`**, pick what reads best) listing **every topic that has content**, each row showing: - the topic name, linked to `/<thema>` - the current top answer ("Das beste &lt;Thema&gt; ist …") — truncated if long - **number of suggestions** and **total votes** in that topic - **Sort by activity** (most votes / most suggestions first). Show a total count ("N Themen") at the top. - **Link it prominently**: from the homepage and from each topic page (e.g. a "Alle Themen" link in the footer/header). - **Admin mode** (`?admin=<token>`, reuse the existing `ADMIN_TOKEN`): additionally show hidden/empty topics and per-row delete/hide controls. Without the token it's the clean public list. ## Constraints - Same lean stack (Bun server, the `dasbes` schema on mRiver Supabase — extend with a query that aggregates per topic; no new dependencies). - Keep the existing dark/yellow, mobile-first style. `noindex` stays. - Don't break the existing topic pages / voting / suggestions. ## Definition of Done - `/alle` (or chosen route) live: all topics with suggestion + vote counts, sorted by activity, each linking to its topic page; total count shown. - Linked from homepage + topic pages. - Admin token reveals hidden topics + delete controls. - Verified against the live domain. Commit to m/dasbes, comment live URL + commit link on this issue, set `status:done` (don't close). Reference: the app built in #1 (server.ts + dasbes schema). Repo m/dasbes, deployed as a Dokploy compose on mLake serving dasbes.de.
mAi self-assigned this 2026-06-23 10:11:03 +00:00
Author
Collaborator

Done — /alle overview live

Live: https://dasbes.de/alle
Commit: 30b683623d (branch mai/lovelace/issue-2-overview)

What shipped

  • GET /alle — public overview listing every topic that has content, each row showing:
    • topic name linked to /<thema>
    • current top answer (highest-voted suggestion), truncated to ~96 chars with a link arrow if the suggestion has one
    • N Vorschläge · M Stimmen per topic
    • sorted by activity (total votes desc → suggestion count desc → name), with a „N Themen" total at the top
  • Linked prominently — an „Alle Themen" link in the footer of every topic page (and the random-redirect homepage). The overview's own footer links back to a „Zufälliges Thema".
  • Admin mode (/alle?admin=<ADMIN_TOKEN>) — additionally lists hidden/empty topics (dashed, with a „K versteckt" badge) and reveals a per-row delete control. POST /api/delete-topic {topic, token} hard-deletes a whole topic + all its suggestions/votes (cascade), constant-time token check; without the token it's the clean public list.
  • Same lean stack: one new aggregate query topicsOverview() in db.ts (Postgres array_agg … filter for the top answer + counts in a single round-trip), no new dependencies. Dark/yellow mobile-first style kept, noindex stays.

Verified

  • DB query exercised against the real dasbes schema on mRiver (empty-topic path: excluded from public, shown to admin; deleteTopic round-trip create→delete; clean-up confirmed — no test data left).
  • Live domain: public list (13 Themen, noindex ✓), admin list (hidden/empty label + 13 delete controls), topic-page footer link, root redirect intact, and the delete endpoint's guards (403 wrong token, 404 unknown topic, 400 bad slug).
  • Existing voting / suggestions / single-suggestion hide untouched.

⚠️ Deploy note (tech debt to flag)

The Dokploy compose for dasbes tracks a feature branch, not main — it was left on mai/hopper/issue-1-dasbes-voting after #1. To deploy this without merging to main (gitster doesn't own main), I repointed the compose's Gitea branch to mai/lovelace/issue-2-overview and triggered the build. Recommend: after merging this branch to main, repoint the compose's source branch to main so production deploys from the canonical branch and isn't pinned to an ephemeral feature branch.

Leaving the issue open per policy; setting status:done.

## ✅ Done — `/alle` overview live **Live:** https://dasbes.de/alle **Commit:** https://mgit.msbls.de/m/dasbes/commit/30b683623d5dc4748bea4e49d2ea2f9f8fbed7df (branch `mai/lovelace/issue-2-overview`) ### What shipped - **`GET /alle`** — public overview listing every topic that has content, each row showing: - topic name linked to `/<thema>` - current top answer (highest-voted suggestion), truncated to ~96 chars with a link arrow if the suggestion has one - **N Vorschläge · M Stimmen** per topic - sorted by activity (total votes desc → suggestion count desc → name), with a **„N Themen"** total at the top - **Linked prominently** — an „Alle Themen" link in the footer of every topic page (and the random-redirect homepage). The overview's own footer links back to a „Zufälliges Thema". - **Admin mode** (`/alle?admin=<ADMIN_TOKEN>`) — additionally lists hidden/empty topics (dashed, with a „K versteckt" badge) and reveals a per-row **delete** control. `POST /api/delete-topic {topic, token}` hard-deletes a whole topic + all its suggestions/votes (cascade), constant-time token check; without the token it's the clean public list. - Same lean stack: one new aggregate query `topicsOverview()` in `db.ts` (Postgres `array_agg … filter` for the top answer + counts in a single round-trip), no new dependencies. Dark/yellow mobile-first style kept, **`noindex` stays**. ### Verified - DB query exercised against the real `dasbes` schema on mRiver (empty-topic path: excluded from public, shown to admin; `deleteTopic` round-trip create→delete; clean-up confirmed — no test data left). - Live domain: public list (13 Themen, noindex ✓), admin list (hidden/empty label + 13 delete controls), topic-page footer link, root redirect intact, and the delete endpoint's guards (`403` wrong token, `404` unknown topic, `400` bad slug). - Existing voting / suggestions / single-suggestion hide untouched. ### ⚠️ Deploy note (tech debt to flag) The Dokploy compose for dasbes tracks a **feature branch**, not `main` — it was left on `mai/hopper/issue-1-dasbes-voting` after #1. To deploy this without merging to `main` (gitster doesn't own `main`), I repointed the compose's Gitea branch to `mai/lovelace/issue-2-overview` and triggered the build. **Recommend:** after merging this branch to `main`, repoint the compose's source branch to `main` so production deploys from the canonical branch and isn't pinned to an ephemeral feature branch. Leaving the issue open per policy; setting `status:done`.
mAi added the
status:done
label 2026-06-23 10:19:56 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: m/dasbes#2
No description provided.