diff --git a/CLAUDE.md b/CLAUDE.md index ed72162..7048c42 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -30,7 +30,7 @@ The site is structured around Trip entities. Key facts: - Each trip has: `01.dailies/`, `02.map/`, `03.stats/`, `04.stories/` - Site nav in `base.html.twig` has Home + Past Trips only — does not link to trip sub-sections - Post form parent (`post-form.md` → `pageconfig.parent`) **must be kept in sync** with `active_trip` -- The trip page (`trip.html.twig`) uses a **client-side filter bar** (All content / Journal / Stories) — do NOT add nav links back to `/dailies`, `/stats`, `/stories` on the trip page +- The trip page (`trip.html.twig`) uses a **client-side filter bar** (All content / Journal / Stories) — do NOT add nav links back to `/dailies`, `/stats`, `/stories` on the trip page. This filter bar + stats chrome is shared with the home active-trip view via the `trip-feed-col` partial (see "Shared trip-feed-col partial" below) - Stats are shown inline on the trip page via a toggle; the standalone `/stats` sub-page still exists as a URL but is not linked from the trip page - GPX route files live as media on the trip page itself, served via leaflet-gpx CDN - Manage GPX files (view/upload/delete) at `/gpx-manager` — requires admin login; filenames are auto-slugified on upload @@ -57,6 +57,31 @@ The mini-map above the feed is shared across two pages via a Twig partial: The partial always: starts attribution collapsed, shows the fullscreen button (mobile-only, CSS `display:none` ≥769px), and on marker click scrolls to `#` + flashes `.is-highlighted`. +### Shared trip-feed-col partial + +The home page's active-trip view and the trip page render the **same feed-col chrome** (date-range header, filter bar, stats/cycling panels, feed loop) via one shared Twig partial. This is separate from the feed-map partial above — it is the column **beside** the map, not the map. + +- **Partial:** `user/themes/intotheeast/templates/partials/trip-feed-col.html.twig` +- **Used by:** `trip.html.twig` and the active branch of `home.html.twig` (both via `{% include ... with {...} only %}`) +- **Sibling:** `partials/home-predeparture.html.twig` — the home-only "Coming soon" landing state. `home.html.twig` picks it with `{% if all_items|length == 0 %}` → `home-predeparture` `{% else %}` → `trip-feed-col`. Keep `trip-feed-col` single-purpose — do NOT fold the pre-departure branch back into it. + +**Parameters (`trip-feed-col`):** + +| Parameter | Type | Trip passes | Home-active passes | +|---|---|---|---| +| `trip_page` | Page | `page` | `trip` | +| `all_items` | array | sorted by date, flag 4 (oldest→newest) | sorted by date, flag 3 (newest→oldest) | +| `journal_entries` | array | dailies children | dailies children | +| `journal_count` / `story_count` | int | counts | counts | +| `has_gpx` | bool | `has_gpx` | `home_gpx_urls\|length > 0` | +| `gpx_urls` | array | `gpx_urls` | `home_gpx_urls` | +| `gps_points` | array | `gps_points` | `gps_points` | +| `show_sort` | bool | `true` | `false` (home keeps its own feed order, no sort button) | + +`home-predeparture` takes only `trip_page`. + +**Stats/cycling JS glue:** the partial emits an inline `DOMContentLoaded` script calling `window.initTripStats({ gpxUrls, gpsPoints, hasGpx })` — one shared function in `js/src/main.js` (rebuild with `make build-assets`; never hand-edit `js/main.js`). It no-ops when `#stat-distance` is absent, populates exact distance + cycling stats from GPX, and falls back to a `~`-prefixed haversine estimate (or `—` for `<2` points) when there is no GPX. It depends on `window.MapUtils` from `map.js` (loaded in the `bottom` asset group on both pages). + ### GPX file management GPX files are stored as page media on the trip page (`user/pages/01.trips//`). They are picked up automatically by `map.html.twig` via `trip_page.media.all`.