From 340865ad234f974ec4c0afcbfb6ff06f50a11b2f Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <ariel@costas.dev>
Date: Sun, 20 Apr 2025 19:07:29 +0200
Subject: Load stops from local data files

---
 src/pages/Estimates.tsx | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

(limited to 'src/pages/Estimates.tsx')

diff --git a/src/pages/Estimates.tsx b/src/pages/Estimates.tsx
index 900ffc5..90745da 100644
--- a/src/pages/Estimates.tsx
+++ b/src/pages/Estimates.tsx
@@ -1,6 +1,6 @@
 import { JSX, useEffect, useState } from "react";
 import { useParams } from "react-router";
-import { StopDataProvider } from "../data/StopDataProvider";
+import StopDataProvider from "../data/StopDataProvider";
 import { Star } from 'lucide-react';
 import "../styles/Estimates.css";
 import { RegularTable } from "../components/RegularTable";
@@ -22,8 +22,6 @@ export interface StopDetails {
 	}[]
 }
 
-const sdp = new StopDataProvider();
-
 const loadData = async (stopId: string) => {
 	const resp = await fetch(`/api/GetStopEstimates?id=${stopId}`);
 	return await resp.json();
@@ -44,20 +42,20 @@ export function Estimates(): JSX.Element {
 			})
 
 
-		sdp.pushRecent(parseInt(params.stopId ?? ""));
+		StopDataProvider.pushRecent(parseInt(params.stopId ?? ""));
 
 		setFavourited(
-			sdp.isFavourite(parseInt(params.stopId ?? ""))
+			StopDataProvider.isFavourite(parseInt(params.stopId ?? ""))
 		);
 	}, [params.stopId]);
 
 
 	const toggleFavourite = () => {
 		if (favourited) {
-			sdp.removeFavourite(parseInt(params.stopId ?? ""));
+			StopDataProvider.removeFavourite(parseInt(params.stopId ?? ""));
 			setFavourited(false);
 		} else {
-			sdp.addFavourite(parseInt(params.stopId ?? ""));
+			StopDataProvider.addFavourite(parseInt(params.stopId ?? ""));
 			setFavourited(true);
 		}
 	}
-- 
cgit v1.3

