Various improvements

This commit is contained in:
Edward Betts 2026-03-31 10:42:30 +01:00
parent 2090268754
commit 876eb6a759
5 changed files with 98 additions and 72 deletions

View file

@ -38,18 +38,33 @@
<table style="width:100%;border-collapse:collapse;font-size:0.95rem">
<thead>
<tr style="border-bottom:2px solid #e2e8f0;text-align:left">
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Depart Bristol</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Arrive Paddington</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Bristol</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Paddington</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Transfer</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Depart St&nbsp;Pancras</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Arrive {{ destination }}</th>
<th style="padding:0.6rem 0.8rem">{{ destination }}
</th>
<th style="padding:0.6rem 0.8rem;white-space:nowrap">Total</th>
</tr>
</thead>
<tbody>
{% set best_mins = trips | map(attribute='total_minutes') | min %}
{% set worst_mins = trips | map(attribute='total_minutes') | max %}
{% for trip in trips %}
<tr style="border-bottom:1px solid #e2e8f0{% if loop.index is odd %};background:#f7fafc{% endif %}">
<td style="padding:0.6rem 0.8rem;font-weight:600">{{ trip.depart_bristol }}</td>
{% if trip.total_minutes == best_mins and trips | length > 1 %}
{% set row_bg = 'background:#f0fff4' %}
{% elif trip.total_minutes == worst_mins and trips | length > 1 %}
{% set row_bg = 'background:#fff5f5' %}
{% elif loop.index is odd %}
{% set row_bg = 'background:#f7fafc' %}
{% else %}
{% set row_bg = '' %}
{% endif %}
<tr style="border-bottom:1px solid #e2e8f0;{{ row_bg }}">
<td style="padding:0.6rem 0.8rem;font-weight:600">
{{ trip.depart_bristol }}
{% if trip.headcode %}<br><span style="font-size:0.75rem;font-weight:400;color:#718096">{{ trip.headcode }}</span>{% endif %}
</td>
<td style="padding:0.6rem 0.8rem">
{{ trip.arrive_paddington }}
<span style="font-size:0.8rem;color:#718096">({{ trip.gwr_duration }})</span>
@ -57,9 +72,23 @@
<td style="padding:0.6rem 0.8rem;color:#4a5568">
{{ trip.connection_duration }}
</td>
<td style="padding:0.6rem 0.8rem;font-weight:600">{{ trip.depart_st_pancras }}</td>
<td style="padding:0.6rem 0.8rem">{{ trip.arrive_destination }}</td>
<td style="padding:0.6rem 0.8rem;font-weight:600;color:#00539f">{{ trip.total_duration }}</td>
<td style="padding:0.6rem 0.8rem;font-weight:600">
{{ trip.depart_st_pancras }}
{% if trip.train_number %}<br><span style="font-size:0.75rem;font-weight:400;color:#718096">{{ trip.train_number }}</span>{% endif %}
</td>
<td style="padding:0.6rem 0.8rem">
{{ trip.arrive_destination }}
<span style="font-weight:400;color:#718096;font-size:0.85em">(CET)</span>
</td>
<td style="padding:0.6rem 0.8rem;font-weight:600">
{% if trip.total_minutes == best_mins and trips | length > 1 %}
<span style="color:#276749" title="Fastest option">{{ trip.total_duration }} ⚡</span>
{% elif trip.total_minutes == worst_mins and trips | length > 1 %}
<span style="color:#c53030" title="Slowest option">{{ trip.total_duration }} 🐢</span>
{% else %}
<span style="color:#00539f">{{ trip.total_duration }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
@ -67,9 +96,11 @@
</div>
<p style="margin-top:1rem;font-size:0.82rem;color:#718096">
Paddington &rarr; St&nbsp;Pancras connection: 75&nbsp;min minimum, 2h&nbsp;20m maximum.
Paddington &rarr; St&nbsp;Pancras connection: 60&nbsp;min minimum, 2h maximum.
Eurostar times are from the general timetable and may vary; always check
<a href="https://www.eurostar.com" target="_blank" rel="noopener">eurostar.com</a> to book.
<a href="{{ eurostar_url }}" target="_blank" rel="noopener">eurostar.com</a> to book.
&nbsp;&middot;&nbsp;
<a href="{{ rtt_url }}" target="_blank" rel="noopener">Paddington arrivals on RTT</a>
</p>
{% else %}