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:
@@ -64,18 +64,23 @@
|
||||
<div class="home-map" id="home-map"></div>
|
||||
</div>
|
||||
|
||||
{% 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 %}
|
||||
</div>
|
||||
|
||||
{% 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/cycling.html.twig' as cycling_m %}
|
||||
<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">
|
||||
<h1 class="home-trip-name">{{ trip_page.title }}</h1>
|
||||
{% if trip_page.header.date_start %}
|
||||
@@ -79,5 +62,4 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -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 %}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user