aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/routes/timetable-$id.tsx
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-11-17 23:39:08 +0100
committerGitHub <noreply@github.com>2025-11-17 23:39:08 +0100
commit276e73412abef28c222c52a84334d49f5e414f3c (patch)
tree8b7ae07eafa53f9efc5884e4f0696e6077266f48 /src/frontend/app/routes/timetable-$id.tsx
parent36d982fb3b01fd8181b216b57fba2c42e9404d1f (diff)
Use consolidated data API in map sheet with shared card component (#100)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com> Co-authored-by: Ariel Costas Guerrero <ariel@costas.dev>
Diffstat (limited to 'src/frontend/app/routes/timetable-$id.tsx')
-rw-r--r--src/frontend/app/routes/timetable-$id.tsx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/frontend/app/routes/timetable-$id.tsx b/src/frontend/app/routes/timetable-$id.tsx
index da7a2e7..af5e42a 100644
--- a/src/frontend/app/routes/timetable-$id.tsx
+++ b/src/frontend/app/routes/timetable-$id.tsx
@@ -26,7 +26,7 @@ interface ErrorInfo {
const loadTimetableData = async (
region: RegionId,
- stopId: string,
+ stopId: string
): Promise<ScheduledTable[]> => {
const regionConfig = getRegionConfig(region);
@@ -45,7 +45,7 @@ const loadTimetableData = async (
headers: {
Accept: "application/json",
},
- },
+ }
);
if (!resp.ok) {
@@ -65,18 +65,18 @@ const timeToMinutes = (time: string): number => {
const filterTimetableData = (
data: ScheduledTable[],
currentTime: string,
- showPast: boolean = false,
+ showPast: boolean = false
): ScheduledTable[] => {
if (showPast) return data;
const currentMinutes = timeToMinutes(currentTime);
const sortedData = [...data].sort(
- (a, b) => timeToMinutes(a.calling_time) - timeToMinutes(b.calling_time),
+ (a, b) => timeToMinutes(a.calling_time) - timeToMinutes(b.calling_time)
);
// Find the current position
const currentIndex = sortedData.findIndex(
- (entry) => timeToMinutes(entry.calling_time) >= currentMinutes,
+ (entry) => timeToMinutes(entry.calling_time) >= currentMinutes
);
if (currentIndex === -1) {
@@ -161,7 +161,7 @@ export default function Timetable() {
const filteredData = filterTimetableData(
timetableData,
currentTime,
- showPastEntries,
+ showPastEntries
);
const parseError = (error: any): ErrorInfo => {
@@ -210,11 +210,11 @@ export default function Timetable() {
const currentMinutes = timeToMinutes(currentTime);
const sortedData = [...timetableBody].sort(
(a, b) =>
- timeToMinutes(a.calling_time) - timeToMinutes(b.calling_time),
+ timeToMinutes(a.calling_time) - timeToMinutes(b.calling_time)
);
const nextIndex = sortedData.findIndex(
- (entry) => timeToMinutes(entry.calling_time) >= currentMinutes,
+ (entry) => timeToMinutes(entry.calling_time) >= currentMinutes
);
if (nextIndex !== -1 && nextEntryRef.current) {
@@ -293,13 +293,13 @@ export default function Timetable() {
<p>
{t(
"timetable.noDataAvailable",
- "No hay datos de horarios disponibles para hoy",
+ "No hay datos de horarios disponibles para hoy"
)}
</p>
<p className="error-detail">
{t(
"timetable.errorDetail",
- "Los horarios teóricos se actualizan diariamente. Inténtalo más tarde.",
+ "Los horarios teóricos se actualizan diariamente. Inténtalo más tarde."
)}
</p>
</div>