aboutsummaryrefslogtreecommitdiff
path: root/src/pages/StopList.tsx
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-04-20 19:07:29 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-04-20 19:07:29 +0200
commit340865ad234f974ec4c0afcbfb6ff06f50a11b2f (patch)
tree06b6a76b6dfc535f9091990eaaec82b50d5f851e /src/pages/StopList.tsx
parent32bc4914759845516de2b7592b05afb3c3cc5c42 (diff)
Load stops from local data files
Diffstat (limited to 'src/pages/StopList.tsx')
-rw-r--r--src/pages/StopList.tsx8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/pages/StopList.tsx b/src/pages/StopList.tsx
index 72cccda..449ae84 100644
--- a/src/pages/StopList.tsx
+++ b/src/pages/StopList.tsx
@@ -1,10 +1,8 @@
import { useEffect, useMemo, useState } from "react";
-import { Stop, StopDataProvider } from "../data/StopDataProvider";
+import StopDataProvider, { Stop } from "../data/StopDataProvider";
import StopItem from "../components/StopItem";
import Fuse from "fuse.js";
-const sdp = new StopDataProvider();
-
const placeholders = [
"Urzaiz",
"Gran Vía",
@@ -22,7 +20,7 @@ export function StopList() {
const [searchResults, setSearchResults] = useState<Stop[] | null>(null);
useEffect(() => {
- sdp.getStops().then((stops: Stop[]) => setData(stops))
+ StopDataProvider.getStops().then((stops: Stop[]) => setData(stops))
}, []);
const handleStopSearch = (event: React.ChangeEvent<HTMLInputElement>) => {
@@ -39,7 +37,7 @@ export function StopList() {
}, [data])
const recentStops = useMemo(() => {
- const recent = sdp.getRecent();
+ const recent = StopDataProvider.getRecent();
if (recent.length === 0) return null;