diff --git a/themes/intotheeast/css/style.css b/themes/intotheeast/css/style.css index d1d3266..de53b08 100644 --- a/themes/intotheeast/css/style.css +++ b/themes/intotheeast/css/style.css @@ -956,3 +956,34 @@ body::after { .trip-sidebar-section {} +/* ── Trip page inline stats block ───────────────────────────────────────────── */ + +.trip-stats-block { + background: var(--color-canvas); + border: 1px solid var(--color-border); + border-radius: var(--radius-md); + padding: var(--space-6); + margin-bottom: var(--space-6); +} + +.trip-stats-grid { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: var(--space-4); + margin-bottom: var(--space-4); +} + +@media (max-width: 600px) { + .trip-stats-grid { grid-template-columns: repeat(2, 1fr); } +} + +.trip-stats-countries { + font-size: var(--text-sm); + color: var(--color-ink-2); + margin-bottom: var(--space-2); +} + +.trip-stats-note { + font-size: var(--text-xs); + color: var(--color-ink-muted); +} diff --git a/themes/intotheeast/templates/trip.html.twig b/themes/intotheeast/templates/trip.html.twig index 9bf0f10..96fe4fb 100644 --- a/themes/intotheeast/templates/trip.html.twig +++ b/themes/intotheeast/templates/trip.html.twig @@ -18,6 +18,41 @@ {% set journal_count = journal_entries|length %} {% set story_count = story_entries|length %} +{# Stats computation #} +{% set days_on_road = 0 %} +{% set first_ts = null %} +{% for entry in journal_entries %} + {% set ts = entry.date|date('U') %} + {% if first_ts is null or ts < first_ts %} + {% set first_ts = ts %} + {% endif %} +{% endfor %} +{% if first_ts is not null %} + {% set now_ts = "now"|date('U') %} + {% set diff_seconds = now_ts - first_ts %} + {% set days_raw = (diff_seconds / 86400)|round(0, 'floor') %} + {% set days_on_road = days_raw < 1 ? 1 : days_raw %} +{% endif %} + +{% set seen_lower = [] %} +{% set country_display = [] %} +{% for entry in journal_entries %} + {% if entry.header.location_country is not empty %} + {% set lower = entry.header.location_country|trim|lower %} + {% if lower not in seen_lower %} + {% set seen_lower = seen_lower|merge([lower]) %} + {% set country_display = country_display|merge([entry.header.location_country|trim]) %} + {% endif %} + {% endif %} +{% endfor %} + +{% set gps_points = [] %} +{% for entry in journal_entries %} + {% if entry.header.lat is not empty and entry.header.lng is not empty %} + {% set gps_points = gps_points|merge([[entry.header.lat, entry.header.lng]]) %} + {% endif %} +{% endfor %} + {% set gpx_urls = [] %} {% for name, media in page.media.all %} {% if name|split('.')|last == 'gpx' %} @@ -65,6 +100,31 @@ +
+