From ee77f38cdb324cbcf12518490df77fc9e6b89282 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 22:52:02 +0000 Subject: Improve gallery scroll indicators and format code Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com> --- src/frontend/app/components/StopSheet.tsx | 52 +++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'src/frontend/app/components/StopSheet.tsx') diff --git a/src/frontend/app/components/StopSheet.tsx b/src/frontend/app/components/StopSheet.tsx index 695b18e..422558b 100644 --- a/src/frontend/app/components/StopSheet.tsx +++ b/src/frontend/app/components/StopSheet.tsx @@ -20,12 +20,15 @@ interface StopSheetProps { } interface ErrorInfo { - type: 'network' | 'server' | 'unknown'; + type: "network" | "server" | "unknown"; status?: number; message?: string; } -const loadStopData = async (region: RegionId, stopId: number): Promise => { +const loadStopData = async ( + region: RegionId, + stopId: number, +): Promise => { const regionConfig = getRegionConfig(region); const resp = await fetch(`${regionConfig.estimatesEndpoint}?id=${stopId}`, { headers: { @@ -43,7 +46,7 @@ const loadStopData = async (region: RegionId, stopId: number): Promise = ({ isOpen, onClose, - stop + stop, }) => { const { t } = useTranslation(); const { region } = useApp(); @@ -55,20 +58,23 @@ export const StopSheet: React.FC = ({ const parseError = (error: any): ErrorInfo => { if (!navigator.onLine) { - return { type: 'network', message: 'No internet connection' }; + return { type: "network", message: "No internet connection" }; } - if (error.message?.includes('Failed to fetch') || error.message?.includes('NetworkError')) { - return { type: 'network' }; + if ( + error.message?.includes("Failed to fetch") || + error.message?.includes("NetworkError") + ) { + return { type: "network" }; } - if (error.message?.includes('HTTP')) { + if (error.message?.includes("HTTP")) { const statusMatch = error.message.match(/HTTP (\d+):/); const status = statusMatch ? parseInt(statusMatch[1]) : undefined; - return { type: 'server', status }; + return { type: "server", status }; } - return { type: 'unknown', message: error.message }; + return { type: "unknown", message: error.message }; }; const loadData = async () => { @@ -103,7 +109,7 @@ export const StopSheet: React.FC = ({ { hour: "2-digit", minute: "2-digit", - } + }, ).format(arrival); } else { return `${minutes} ${t("estimates.minutes", "min")}`; @@ -123,11 +129,7 @@ export const StopSheet: React.FC = ({ data?.sort((a, b) => a.minutes - b.minutes).slice(0, 4) || []; return ( - + @@ -153,7 +155,10 @@ export const StopSheet: React.FC = ({ ) : data ? ( @@ -180,7 +185,9 @@ export const StopSheet: React.FC = ({
-
+
{formatTime(estimate.minutes)}
@@ -203,7 +210,7 @@ export const StopSheet: React.FC = ({ {lastUpdated.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit", - second: "2-digit" + second: "2-digit", })}
)} @@ -215,7 +222,9 @@ export const StopSheet: React.FC = ({ disabled={loading} title={t("estimates.reload", "Recargar estimaciones")} > - + {t("estimates.reload", "Recargar")} @@ -224,7 +233,10 @@ export const StopSheet: React.FC = ({ className="stop-sheet-view-all" onClick={onClose} > - {t("map.view_all_estimates", "Ver todas las estimaciones")} + {t( + "map.view_all_estimates", + "Ver todas las estimaciones", + )}
-- cgit v1.3