From c7ab736debbc43c1eef472a970398627fdcb91ae Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Thu, 6 Nov 2025 16:11:48 +0100 Subject: Add stop_report.py for generating stop-based JSON reports --- src/frontend/app/components/SchedulesTable.tsx | 52 ++++++++++++++------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'src/frontend/app/components/SchedulesTable.tsx') diff --git a/src/frontend/app/components/SchedulesTable.tsx b/src/frontend/app/components/SchedulesTable.tsx index afa6f8e..a3bbd9f 100644 --- a/src/frontend/app/components/SchedulesTable.tsx +++ b/src/frontend/app/components/SchedulesTable.tsx @@ -3,23 +3,27 @@ import LineIcon from "./LineIcon"; import "./SchedulesTable.css"; import { useApp } from "~/AppContext"; -export interface ScheduledTable { - line: { - name: string; - colour: string; - }; - trip: { - id: string; - service_id: string; - headsign: string; - direction_id: number; - }; - route_id: string; - departure_time: string; - arrival_time: string; +export type ScheduledTable = { + trip_id: string; + service_id: string; + + line: string; + route: string; + stop_sequence: number; shape_dist_traveled: number; next_streets: string[]; + + starting_code: string; + starting_name: string; + starting_time: string; + + calling_time: string; + calling_ssm: number; + + terminus_code: string; + terminus_name: string; + terminus_time: string; } interface TimetableTableProps { @@ -74,11 +78,11 @@ const findNearbyEntries = (entries: ScheduledTable[], currentTime: string, befor const currentMinutes = timeToMinutes(currentTime); const sortedEntries = [...entries].sort((a, b) => - timeToMinutes(a.departure_time) - timeToMinutes(b.departure_time) + timeToMinutes(a.calling_time) - timeToMinutes(b.calling_time) ); let currentIndex = sortedEntries.findIndex(entry => - timeToMinutes(entry.departure_time) >= currentMinutes + timeToMinutes(entry.calling_time) >= currentMinutes ); if (currentIndex === -1) { @@ -114,11 +118,11 @@ export const SchedulesTable: React.FC = ({
{displayData.map((entry, index) => { - const entryMinutes = timeToMinutes(entry.departure_time); + const entryMinutes = timeToMinutes(entry.calling_time); const isPast = entryMinutes < nowMinutes; return (
= ({ >
- +
- {entry.trip.headsign && entry.trip.headsign.trim() ? ( - {entry.trip.headsign} + {entry.route && entry.route.trim() ? ( + {entry.route} ) : ( - {t("timetable.noDestination", "Línea")} {entry.line.name} + {t("timetable.noDestination", "Línea")} {entry.line} )}
- {entry.departure_time.slice(0, 5)} + {entry.calling_time.slice(0, 5)}
- {parseServiceId(entry.trip.service_id)} + {parseServiceId(entry.service_id)} {entry.next_streets.length > 0 && ( — {entry.next_streets.join(' — ')} -- cgit v1.3