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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BftDn9vu9SonFAY4vxu4uk
This commit is contained in:
2026-06-27 21:03:26 +02:00
co-authored by Claude Opus 4.8
parent fa1d77f444
commit 75da83d6e1
4 changed files with 34 additions and 32 deletions
+7 -2
View File
@@ -64,6 +64,11 @@
<div class="home-map" id="home-map"></div> <div class="home-map" id="home-map"></div>
</div> </div>
{% 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 { {% include 'partials/trip-feed-col.html.twig' with {
trip_page: trip, trip_page: trip,
all_items: all_items, all_items: all_items,
@@ -73,9 +78,9 @@
has_gpx: home_gpx_urls|length > 0, has_gpx: home_gpx_urls|length > 0,
gpx_urls: home_gpx_urls, gpx_urls: home_gpx_urls,
gps_points: gps_points, gps_points: gps_points,
show_sort: false, show_sort: false
pre_departure: all_items|length == 0
} only %} } only %}
{% endif %}
</div> </div>
{% if map_entries|length > 0 %} {% if map_entries|length > 0 %}
@@ -0,0 +1,16 @@
<div class="home-feed-col">
<div class="home-trip-header">
<h1 class="home-trip-name">{{ trip_page.title }}</h1>
{% if trip_page.header.date_start %}
<p class="trip-dates">Departing {{ trip_page.header.date_start|date('d M Y') }}</p>
{% endif %}
<span class="home-trip-counts">Coming soon</span>
</div>
<div class="feed">
<hr class="home-predeparture-divider">
<p class="feed-empty">The journey hasn't begun yet — check back once we're on the road.</p>
<div class="home-highlights-cta-wrap">
<a class="home-highlights-cta" href="/trips">In the meantime, explore my other trips →</a>
</div>
</div>
</div>
@@ -1,23 +1,6 @@
{% import 'macros/stats.html.twig' as stats_m %} {% import 'macros/stats.html.twig' as stats_m %}
{% import 'macros/cycling.html.twig' as cycling_m %} {% import 'macros/cycling.html.twig' as cycling_m %}
<div class="home-feed-col"> <div class="home-feed-col">
{% if pre_departure %}
{# ── Pre-departure landing state (home-active only) ──────────── #}
<div class="home-trip-header">
<h1 class="home-trip-name">{{ trip_page.title }}</h1>
{% if trip_page.header.date_start %}
<p class="trip-dates">Departing {{ trip_page.header.date_start|date('d M Y') }}</p>
{% endif %}
<span class="home-trip-counts">Coming soon</span>
</div>
<div class="feed">
<hr class="home-predeparture-divider">
<p class="feed-empty">The journey hasn't begun yet — check back once we're on the road.</p>
<div class="home-highlights-cta-wrap">
<a class="home-highlights-cta" href="/trips">In the meantime, explore my other trips →</a>
</div>
</div>
{% else %}
<div class="home-trip-header"> <div class="home-trip-header">
<h1 class="home-trip-name">{{ trip_page.title }}</h1> <h1 class="home-trip-name">{{ trip_page.title }}</h1>
{% if trip_page.header.date_start %} {% if trip_page.header.date_start %}
@@ -79,5 +62,4 @@
}); });
}); });
</script> </script>
{% endif %}
</div> </div>
+1 -2
View File
@@ -76,8 +76,7 @@
has_gpx: has_gpx, has_gpx: has_gpx,
gpx_urls: gpx_urls, gpx_urls: gpx_urls,
gps_points: gps_points, gps_points: gps_points,
show_sort: true, show_sort: true
pre_departure: false
} only %} } only %}
</div> </div>