Build the SvelteKit frontend: calm home with mood modes
- New frontend/ SvelteKit static SPA (Svelte 5), served by FastAPI from frontend/build (falls back to the legacy page if unbuilt). - Calm design system: cream/sage palette, serif headlines, generous space, no urgency colors, gentle motion (respects prefers-reduced-motion). - Home screen: mood-mode nav (Today/Wonder/People Helping/Solutions/Light Only/Grounded), the daily brief as a hero + remaining four, browsable mood lanes, an explicit calm end-state, inline Not today / Less like this / Hide affordances, and device-local Calm Filters mirroring goodnews/filters.py. - Backend: moods.py + GET /api/moods (single source of truth for the modes); FilterPrefs gains max_cortisol/max_ragebait ceilings (for Light Only). - Push categorical filters (include/mute topics+flavors, ceilings) into SQL in queries.feed so low-ranked-but-matching items (e.g. discovery for Wonder) are not truncated by ranking; only avoid-terms stay a Python pass. - PWA manifest + icon (installable; offline deferred per plan). - Multi-stage Dockerfile builds the site then serves it from the API. - Tests: queries.feed categorical filters (63 total). README updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,7 @@ Endpoints:
|
||||
- `GET /` — the static site (daily five + topic/flavor browsing)
|
||||
- `GET /healthz` — liveness + scored-article count
|
||||
- `GET /api/categories` — the topic/flavor taxonomy
|
||||
- `GET /api/moods` — mood modes (the humane front door: Today, Wonder, People Helping, Solutions, Light Only, Grounded)
|
||||
- `GET /api/category-counts` — article counts per topic/flavor
|
||||
- `GET /api/feed?topic=&flavor=&limit=&offset=` — ranked, filtered articles
|
||||
- `GET /api/brief?date=&limit=` — a daily brief (latest if no date)
|
||||
@@ -112,6 +113,22 @@ Endpoints:
|
||||
The ingestion CLI stays pure-stdlib; only the `web` extra pulls in FastAPI/uvicorn,
|
||||
so the two halves can be deployed and upgraded independently.
|
||||
|
||||
### Frontend
|
||||
|
||||
The site is a SvelteKit static SPA in `frontend/` (calm editorial design, mood-mode
|
||||
navigation, the daily brief as a hero, browsable lanes, inline Calm Filters, PWA
|
||||
manifest). It consumes the JSON API above, so the website and a future companion
|
||||
app share one contract. Build it once and FastAPI serves the output:
|
||||
|
||||
```bash
|
||||
cd frontend && npm install && npm run build # -> frontend/build
|
||||
cd .. && python3 -m goodnews serve # serves frontend/build at /
|
||||
```
|
||||
|
||||
If `frontend/build` is absent, the server falls back to the legacy single-page
|
||||
harness in `goodnews/static/`. The Docker image builds the frontend automatically
|
||||
(multi-stage), so deployment is just `docker build`.
|
||||
|
||||
## Calm Filters
|
||||
|
||||
Personal, device-local controls so a reader can stay informed without subjects
|
||||
|
||||
Reference in New Issue
Block a user