Refine homepage journey form layout

This commit is contained in:
Edward Betts 2026-05-26 12:55:23 +01:00
parent 13c4341f3a
commit ed8a5626a4
4 changed files with 74 additions and 38 deletions

31
app.py
View file

@ -32,6 +32,8 @@ from trip_planner import (
find_unreachable_inbound_eurostars,
find_unreachable_morning_eurostars,
)
import cache
import circle_line
RTT_PADDINGTON_URL = (
"https://www.realtimetrains.co.uk/search/detailed/"
@ -51,9 +53,6 @@ _local = os.path.join(os.path.dirname(__file__), "config", "local.py")
if os.path.exists(_local):
app.config.from_pyfile(_local)
import cache
import circle_line
cache.CACHE_DIR = app.config["CACHE_DIR"] # type: ignore[attr-defined]
circle_line._TXC_XML = app.config["CIRCLE_LINE_XML"] # type: ignore[attr-defined]
@ -72,13 +71,25 @@ def _load_stations() -> list[tuple[str, str]]:
STATIONS = _load_stations()
STATION_BY_CRS = {crs: name for name, crs in STATIONS}
DESTINATION_OPTIONS = [
{"slug": "paris", "city": "Paris", "destination": "Paris Gare du Nord"},
{"slug": "brussels", "city": "Brussels", "destination": "Brussels Midi"},
{"slug": "lille", "city": "Lille", "destination": "Lille Europe"},
{
"slug": "amsterdam",
"city": "Amsterdam",
"destination": "Amsterdam Centraal",
},
{
"slug": "rotterdam",
"city": "Rotterdam",
"destination": "Rotterdam Centraal",
},
{"slug": "cologne", "city": "Cologne Hbf", "destination": "Cologne Hbf"},
]
DESTINATIONS = {
"paris": "Paris Gare du Nord",
"brussels": "Brussels Midi",
"lille": "Lille Europe",
"amsterdam": "Amsterdam Centraal",
"rotterdam": "Rotterdam Centraal",
"cologne": "Cologne Hbf",
option["slug"]: option["destination"] for option in DESTINATION_OPTIONS
}
@ -88,7 +99,7 @@ def index() -> ResponseReturnValue:
default_min, default_max = _get_defaults()
return render_template(
"index.html",
destinations=DESTINATIONS,
destination_options=DESTINATION_OPTIONS,
today=today,
stations=STATIONS,
default_min_connection=default_min,