aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/components/StopSheet.tsx
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-11-03 10:51:47 +0100
committerGitHub <noreply@github.com>2025-11-03 10:51:47 +0100
commit60f8d79d9e8ccedcd95610a88dd7dc8ec5521aca (patch)
tree4fa59e85859ea94a579970fb38ecd32232e2425c /src/frontend/app/components/StopSheet.tsx
parent73b975b7cff87d1e90ad4d0abadc1f65d62ae2e6 (diff)
Simplify estimates endpoint to return only arrival data (#57)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com>
Diffstat (limited to 'src/frontend/app/components/StopSheet.tsx')
-rw-r--r--src/frontend/app/components/StopSheet.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/frontend/app/components/StopSheet.tsx b/src/frontend/app/components/StopSheet.tsx
index 0084c14..4bd75a8 100644
--- a/src/frontend/app/components/StopSheet.tsx
+++ b/src/frontend/app/components/StopSheet.tsx
@@ -6,7 +6,7 @@ import { Clock, ClockFading, Hourglass, RefreshCw } from "lucide-react";
import LineIcon from "./LineIcon";
import { StopSheetSkeleton } from "./StopSheetSkeleton";
import { ErrorDisplay } from "./ErrorDisplay";
-import { type StopDetails } from "../routes/estimates-$id";
+import { type Estimate } from "../routes/estimates-$id";
import { type RegionId, getRegionConfig } from "../data/RegionConfig";
import { useApp } from "../AppContext";
import "./StopSheet.css";
@@ -24,7 +24,7 @@ interface ErrorInfo {
message?: string;
}
-const loadStopData = async (region: RegionId, stopId: number): Promise<StopDetails> => {
+const loadStopData = async (region: RegionId, stopId: number): Promise<Estimate[]> => {
const regionConfig = getRegionConfig(region);
const resp = await fetch(`${regionConfig.estimatesEndpoint}?id=${stopId}`, {
headers: {
@@ -48,7 +48,7 @@ export const StopSheet: React.FC<StopSheetProps> = ({
const { t } = useTranslation();
const { region } = useApp();
const regionConfig = getRegionConfig(region);
- const [data, setData] = useState<StopDetails | null>(null);
+ const [data, setData] = useState<Estimate[] | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<ErrorInfo | null>(null);
const [lastUpdated, setLastUpdated] = useState<Date | null>(null);
@@ -120,7 +120,7 @@ export const StopSheet: React.FC<StopSheetProps> = ({
// Show only the next 4 arrivals
const limitedEstimates =
- data?.estimates.sort((a, b) => a.minutes - b.minutes).slice(0, 4) || [];
+ data?.sort((a, b) => a.minutes - b.minutes).slice(0, 4) || [];
return (
<Sheet