From 75da83d6e1d856176efdfe68eea0c292f602ba8c Mon Sep 17 00:00:00 2001 From: Mischa Date: Sat, 27 Jun 2026 21:03:26 +0200 Subject: [PATCH] refactor(theme): extract home-predeparture partial; trip-feed-col single-purpose Addresses code-review finding: the pre_departure branch made trip-feed-col dual-purpose. Pre-departure landing now lives in its own partial; home picks it via {% if all_items|length == 0 %}, and trip-feed-col drops the pre_departure param to be shared 1:1 by both callers. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01BftDn9vu9SonFAY4vxu4uk --- themes/intotheeast/templates/home.html.twig | 29 +++++++++++-------- .../partials/home-predeparture.html.twig | 16 ++++++++++ .../partials/trip-feed-col.html.twig | 18 ------------ themes/intotheeast/templates/trip.html.twig | 3 +- 4 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 themes/intotheeast/templates/partials/home-predeparture.html.twig diff --git a/themes/intotheeast/templates/home.html.twig b/themes/intotheeast/templates/home.html.twig index e85aba9..401d097 100644 --- a/themes/intotheeast/templates/home.html.twig +++ b/themes/intotheeast/templates/home.html.twig @@ -64,18 +64,23 @@
- {% include 'partials/trip-feed-col.html.twig' with { - trip_page: trip, - all_items: all_items, - journal_entries: journal_entries, - journal_count: journal_count, - story_count: story_count, - has_gpx: home_gpx_urls|length > 0, - gpx_urls: home_gpx_urls, - gps_points: gps_points, - show_sort: false, - pre_departure: all_items|length == 0 - } only %} + {% if all_items|length == 0 %} + {% include 'partials/home-predeparture.html.twig' with { + trip_page: trip + } only %} + {% else %} + {% include 'partials/trip-feed-col.html.twig' with { + trip_page: trip, + all_items: all_items, + journal_entries: journal_entries, + journal_count: journal_count, + story_count: story_count, + has_gpx: home_gpx_urls|length > 0, + gpx_urls: home_gpx_urls, + gps_points: gps_points, + show_sort: false + } only %} + {% endif %} {% if map_entries|length > 0 %} diff --git a/themes/intotheeast/templates/partials/home-predeparture.html.twig b/themes/intotheeast/templates/partials/home-predeparture.html.twig new file mode 100644 index 0000000..ed95b75 --- /dev/null +++ b/themes/intotheeast/templates/partials/home-predeparture.html.twig @@ -0,0 +1,16 @@ +
+
+

{{ trip_page.title }}

+ {% if trip_page.header.date_start %} +

Departing {{ trip_page.header.date_start|date('d M Y') }}

+ {% endif %} + Coming soon +
+
+
+

The journey hasn't begun yet — check back once we're on the road.

+ +
+
diff --git a/themes/intotheeast/templates/partials/trip-feed-col.html.twig b/themes/intotheeast/templates/partials/trip-feed-col.html.twig index aea4ab6..8c024ef 100644 --- a/themes/intotheeast/templates/partials/trip-feed-col.html.twig +++ b/themes/intotheeast/templates/partials/trip-feed-col.html.twig @@ -1,23 +1,6 @@ {% import 'macros/stats.html.twig' as stats_m %} {% import 'macros/cycling.html.twig' as cycling_m %}
-{% if pre_departure %} - {# ── Pre-departure landing state (home-active only) ──────────── #} -
-

{{ trip_page.title }}

- {% if trip_page.header.date_start %} -

Departing {{ trip_page.header.date_start|date('d M Y') }}

- {% endif %} - Coming soon -
-
-
-

The journey hasn't begun yet — check back once we're on the road.

- -
-{% else %}

{{ trip_page.title }}

{% if trip_page.header.date_start %} @@ -79,5 +62,4 @@ }); }); -{% endif %}
diff --git a/themes/intotheeast/templates/trip.html.twig b/themes/intotheeast/templates/trip.html.twig index c3bf358..9dca73e 100644 --- a/themes/intotheeast/templates/trip.html.twig +++ b/themes/intotheeast/templates/trip.html.twig @@ -76,8 +76,7 @@ has_gpx: has_gpx, gpx_urls: gpx_urls, gps_points: gps_points, - show_sort: true, - pre_departure: false + show_sort: true } only %}