add preliminary nta support

This commit is contained in:
Nicholas Orlowsky 2026-01-12 22:46:53 -05:00
parent a7d323056a
commit 1d66553398
No known key found for this signature in database
GPG key ID: A9F3BA4C0AA7A70B
21 changed files with 3318 additions and 257 deletions

View file

@ -3,7 +3,7 @@
<head>
{% if let Some(title) = page_title %}
<title>{{ title }}</title>
<title>{{ title }} | SEPTASTIC</title>
{% else %}
<title>SEPTASTIC</title>
{% endif %}
@ -58,6 +58,7 @@ window.onload = function () {
<div>
<a class="nav-link" href="/">[ Home ]</a>
<a class="nav-link" href="/routes">[ Routes ]</a>
<a class="nav-link" href="/stops">[ Stops ]</a>
</div>
<div>
</div>

View file

@ -3,7 +3,7 @@
.train-direction-table {
width: 100%;
border-collapse: collapse;
font-family: sans-serif;
font-family: mono;
font-size: 14px;
}
@ -148,11 +148,7 @@ document.addEventListener("DOMContentLoaded", () => {
{% let live_o = timetable.tracking_data[loop.index0] %}
{% if let Tracked(live) = live_o %}
{% let time = (t + (live.delay * 60.0) as i64) %}
{% if live.next_stop_id == Some(*row.stop_id) %}
<td style="background-color: #007700">
{% else %}
<td style="background-color: #003300">
{% endif %}
<span style="color: #22bb22"> {{ time | format_time }} </span>
</td>
{% elif let TripTracking::Cancelled = live_o %}

71
api/templates/stop.html Normal file
View file

@ -0,0 +1,71 @@
{%- import "route_symbol.html" as scope -%}
<style>
.trip-desc {
display: flex;
justify-content: start;
}
</style>
<div style="display: flex; align-items: center;">
<h1>{{ stop.name }}</h1>
</div>
<p>With service available on:</p>
<div style="display: flex; justify-content: start; padding-top: 5px; padding-bottom: 5px; flex-wrap: wrap; gap: 5px;">
{% for route in routes %}
<div style="margin-right: 5px">
{% call scope::route_symbol(route) %}
</div>
{% endfor %}
</div>
{#{% if let libseptastic::stop::StopType::MultiPlatform(platforms) = stop.platforms %}
<div>
<p>Platforms at this station:</p>
{% for platform in platforms %}
<p><a href="/stop/{{ platform.id }}">{{ platform.name }}</a></p>
{% endfor %}
</div>
{% endif %}#}
<table class="train-direction-table">
<tr>
<th>ROUTE</th>
<th>DESTINATION</th>
<th>BOARDING AREA</th>
<th>TIME</th>
<th>VEHICLE</th>
</tr>
{% for trip in trips %}
<tr>
<td>
{% call scope::route_symbol(trip.trip.route) %}
</td>
<td>
<p>{{ trip.trip.direction.direction_destination }}</p>
</td>
<td>
<p>{{ trip.perspective_stop.platform.name }}</p>
</td>
{% if trip.is_tracked %}
<td style="color: #008800">
{% else %}
<td>
{% endif %}
<p style="font-size: small;">{{ trip.perspective_stop.arrival_time | format_time }}</p>
<p style="font-size: x-small; font-style: italic;">{{ (trip.perspective_stop.arrival_time - current_time) / 60 }} mins</p>
</td>
{% if let Tracked(tracked_trip) = trip.trip.tracking_data %}
<td>
{{ tracked_trip.vehicle_ids.join(", ") }}
</td>
{% else %}
<td>
-
</td>
{% endif %}
</tr>
{% endfor %}
</table>

27
api/templates/stops.html Normal file
View file

@ -0,0 +1,27 @@
<h1>Stops</h1>
<p>Click on a route to see details and a schedule. Schedules in prevailing local time.</p>
<fieldset>
<legend><h2>Transit Centers</h2></legend>
<p style="margin-top: 10px; margin-bottom: 10px;">Hubs to connect between different modes of transit</p>
{% for stop in tc_stops %}
<a href="/stop/{{ stop.id }}" style="display: flex; justify-content: space-between;">
<p class="line-link">[ {{ stop.name }} </p><p>]</p>
</a>
{% endfor %}
</fieldset>
<style>
.line-link, .lines-label {
white-space: pre;
margin-top: 3px;
margin-bottom: 3px;
}
.lines-label {
color: #ffffff;
background-color: #000000;
width: max-content;
}
</style>