From 567ea7bb8993e4bc17c6a765da456f3e1073be13 Mon Sep 17 00:00:00 2001 From: Mischa Date: Sat, 27 Jun 2026 22:35:43 +0200 Subject: [PATCH] docs: add home/trip convergence plan (complete) and update design spec Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BftDn9vu9SonFAY4vxu4uk --- .../2026-06-27-home-trip-view-convergence.md | 440 ++++++++++++++++++ ...06-27-home-trip-view-convergence-design.md | 21 +- 2 files changed, 459 insertions(+), 2 deletions(-) create mode 100644 docs/working/plans/2026-06-27-home-trip-view-convergence.md diff --git a/docs/working/plans/2026-06-27-home-trip-view-convergence.md b/docs/working/plans/2026-06-27-home-trip-view-convergence.md new file mode 100644 index 0000000..b778251 --- /dev/null +++ b/docs/working/plans/2026-06-27-home-trip-view-convergence.md @@ -0,0 +1,440 @@ +# Home / Trip View Convergence Implementation Plan + +**Status:** ✅ Complete (2026-06-27) + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make the home page's active-trip view present the same feed-col chrome (date range, filter bar, stats/cycling panels) as the trip page, by extracting the chrome into one shared Twig partial and the stats computation into one shared JS function. + +**Architecture:** A new partial `templates/partials/trip-feed-col.html.twig` holds the entire `.home-feed-col` markup (header, filter bar, panel toggles, stats/cycling macro calls, feed loop) and is included by both `trip.html.twig` and `home.html.twig` (active branch). The inline stats/cycling computation currently in `trip.html.twig` becomes a window-exposed `initTripStats(config)` in `js/src/main.js`; the partial emits a small `DOMContentLoaded` inline script that calls it with page-specific data. The two intended differences (home has no sort button and keeps its own feed order) are driven by partial params, not separate markup. + +**Tech Stack:** Grav 2.0 / Twig templates, esbuild-bundled vanilla JS (`js/src/main.js` → `js/main.js`), MapLibre via `map.js` (`window.MapUtils`). + +## Global Constraints + +- **Only ever write changes inside `travel-blog-intotheeast/` or subfolders.** The `user/` tree is a standalone git repo synced via `make content-push`; commit there as instructed by the execution skill. +- **Dev mode stays dev** — `twig.cache: false` is already set. Do NOT toggle any dev/prod config flag to work around caching; theme edits take effect on reload. +- **No map convergence.** Both inline map ` +{% endif %} + +``` + +Notes baked into this markup: +- The non-pre-departure feed keeps the `{% else %}` "No entries yet" fallback so the trip page's empty-case output is unchanged (trip always passes `pre_departure: false`). Home never reaches this fallback because home-empty sets `pre_departure: true`. +- The `initTripStats` call is wrapped in `DOMContentLoaded` so `window.initTripStats` and `window.MapUtils` (both in the `bottom` asset group rendered at the end of ``) are defined when it runs. +- The call is **not** nested inside any map-entries condition, so a trip with GPX but zero geocoded journal entries still populates the panels. +- The partial is included with `only`, so it imports the `stats`/`cycling` macros itself. + +- [ ] **Step 2: Verify Twig syntax compiles (no include yet, so render via a temporary check)** + +The partial isn't referenced anywhere yet, so it can't render on its own. Verify there are no obvious Twig errors by confirming the file is well-formed: + +Run: `grep -c "endif\|endfor\|endmacro" /home/mischa/Nextcloud/Projects/travel-blog-intotheeast/user/themes/intotheeast/templates/partials/trip-feed-col.html.twig` +Expected: non-zero (sanity check the file saved). Real verification happens in Task 3 when the trip page includes it. + +- [ ] **Step 3: Commit** + +```bash +cd /home/mischa/Nextcloud/Projects/travel-blog-intotheeast/user/themes/intotheeast +git add templates/partials/trip-feed-col.html.twig +git commit -m "feat(theme): add shared trip-feed-col partial" +``` + +--- + +## Task 3: Refactor `trip.html.twig` to use the partial + +**Files:** +- Modify: `user/themes/intotheeast/templates/trip.html.twig` (replace `:70-120`; remove `:213-249`) + +**Interfaces:** +- Consumes: the partial from Task 2, `window.initTripStats` from Task 1. +- Produces: visually and functionally identical trip-page output (regression-critical) — exact bytes may differ (re-indented markup, relocated stats `