diff --git a/README.md b/README.md index d851184..415ad3c 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,9 @@ Tracking all the trains & buses in Salt Lake City. - `GET https://uta.clb.li/api.json`: List all vehicles currently in service (JSON) - `GET https://uta.clb.li/api`: Same as above, but Protobuf (see ) - `GET https://uta.clb.li/api/shapes/{shape_id}`: Get the geographic route "shape" for a given vehicle's `shape_id` +- `GET https://uta.clb.li/api/upcoming-departures?stationIds=...`: Show upcoming scheduled departures for a given station (or stations) + - `?stationIds=` comma-separated list of GTFS stop IDs + - `?from=` UNIX timestamp, show upcoming departures as of this time (defaults to current time) + - `?to=` number of seconds in the future to show departures (defaults to 3600, 1 hour)  diff --git a/TODO.md b/TODO.md index bbe9527..546b275 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,3 @@ -- mobile - advanced filtering -- show stops for trip \ No newline at end of file +- show stops for trip +- `/upcoming-departures` should NOT show arrivals, only departures diff --git a/cmd/main.go b/cmd/main.go index a794800..9fac3af 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -358,20 +358,20 @@ type DbDeparture struct { // format: "NORTH (passing)", "SOUTH (passing)", "NORTH", "SOUTH" // "1" is the western track, "2" is the eastern track, "0" is unknown track var predictionData map[string][4]int = map[string][4]int{ - "21760": {1, 2, 1, 1}, // Roy Station - "21757": {0, 0, 1, 1}, // Clearfield Station - "21772": {1, 2, 0, 0}, // Layton Station - "21758": {0, 0, 1, 1}, // Farmington Station - "21759": {0, 0, 1, 1}, // Woods Cross Station - "23113": {1, 2, 1, 2}, // North Temple Station - "21771": {1, 2, 1, 2}, // Salt Lake Central Station - "23080": {2, 1, 1, 1}, // Murray Central Station - "23082": {0, 0, 2, 2}, // South Jordan Station - "23081": {1, 2, 0, 0}, // Draper Station - "23074": {1, 2, 1, 1}, // Lehi Station - "23071": {0, 0, 2, 2}, // American Fork Station - "25330": {2, 1, 2, 2}, // Vineyard Station - "23076": {0, 0, 2, 2}, // Orem Central Station + "21760": {1, 2, 1, 1}, // Roy + "21757": {0, 0, 1, 1}, // Clearfield + "21772": {1, 2, 0, 0}, // Layton + "21758": {0, 0, 1, 1}, // Farmington + "21759": {0, 0, 1, 1}, // Woods Cross + "23113": {1, 2, 1, 2}, // North Temple + "21771": {1, 2, 1, 2}, // Salt Lake Central + "23080": {2, 1, 1, 1}, // Murray Central + "23082": {0, 0, 2, 2}, // South Jordan + "23081": {1, 2, 0, 0}, // Draper + "23074": {1, 2, 1, 1}, // Lehi + "23071": {0, 0, 2, 2}, // American Fork + "25330": {2, 1, 2, 2}, // Vineyard + "23076": {0, 0, 2, 2}, // Orem Central } func predictPlatform(d DbDeparture) int { diff --git a/static/index.html b/static/index.html index 42986c5..9c04729 100644 --- a/static/index.html +++ b/static/index.html @@ -117,6 +117,10 @@ display: none; } + #map { + position: relative; + } + #map, #sidebar { grid-row: 3 / 4; @@ -178,6 +182,42 @@ display: flex; } } + + #loader { + position: absolute; + inset: 0; + background-color: rgba(0, 0, 0, 0.6); + z-index: 1000; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + transition-property: visibility, opacity; + transition-duration: 500ms; + } + + #loader.loader--hidden { + visibility: hidden; + opacity: 0; + } + + @keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } + } + + .spin { + animation: spin 2s linear infinite; + } + + #loader p { + color: white; + font-size: 20px; + } @@ -198,7 +238,19 @@ 🚲 -
+loading...
+