diff --git a/web/src/controllers/map.rs b/web/src/controllers/map.rs index 322ae86..ec49bd4 100644 --- a/web/src/controllers/map.rs +++ b/web/src/controllers/map.rs @@ -36,7 +36,12 @@ async fn get_map_element_html(state: Data>, resp: SessionResponse) for other in trips { if let libseptastic::stop_schedule::TripTracking::Tracked(td) = other.tracking_data { if let Some(lat) = td.latitude && let Some(lng) = td.longitude { - locations.push((lat, lng, td.route_id)); + locations.push(crate::templates::MapItem { + lat, + lng, + route_id: td.route_id, + headsign: other.direction.direction_destination + }); } } } diff --git a/web/src/templates.rs b/web/src/templates.rs index f08fbca..5d550c0 100644 --- a/web/src/templates.rs +++ b/web/src/templates.rs @@ -99,10 +99,17 @@ pub struct StopSearchResults { pub results: Vec } +pub struct MapItem { + pub lat: f64, + pub lng: f64, + pub route_id: String, + pub headsign: String, +} + #[derive(askama::Template)] #[template(path = "map.html")] pub struct MapTemplate { - pub locations: Vec<(f64,f64, String)> + pub locations: Vec } pub fn build_timetables(directions: Vec, trips: Vec) -> Vec { diff --git a/web/templates/map.html b/web/templates/map.html index 003580b..8e0e688 100644 --- a/web/templates/map.html +++ b/web/templates/map.html @@ -3,7 +3,7 @@ crossorigin="">