diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-10-21 17:38:01 +0200 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-10-21 17:38:01 +0200 |
| commit | 12ecc97b07093f3cac6567c70ff75d57b429c674 (patch) | |
| tree | cf4ec0abe4e1d20c01c62e0fc04af5eaa885e881 /src/frontend/app/components/RegularTable.tsx | |
| parent | 67c1dd5cb0025235c29ebd1f1706e5c17392dbff (diff) | |
Implement new Santiago region (WIP)
Diffstat (limited to 'src/frontend/app/components/RegularTable.tsx')
| -rw-r--r-- | src/frontend/app/components/RegularTable.tsx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/frontend/app/components/RegularTable.tsx b/src/frontend/app/components/RegularTable.tsx index 8b01410..68b732a 100644 --- a/src/frontend/app/components/RegularTable.tsx +++ b/src/frontend/app/components/RegularTable.tsx @@ -1,15 +1,18 @@ import { useTranslation } from "react-i18next"; import { type StopDetails } from "../routes/estimates-$id"; import LineIcon from "./LineIcon"; +import { type RegionConfig } from "../data/RegionConfig"; interface RegularTableProps { data: StopDetails; dataDate: Date | null; + regionConfig: RegionConfig; } export const RegularTable: React.FC<RegularTableProps> = ({ data, dataDate, + regionConfig, }) => { const { t } = useTranslation(); @@ -46,7 +49,9 @@ export const RegularTable: React.FC<RegularTableProps> = ({ <th>{t("estimates.line", "LĂnea")}</th> <th>{t("estimates.route", "Ruta")}</th> <th>{t("estimates.arrival", "Llegada")}</th> - <th>{t("estimates.distance", "Distancia")}</th> + {regionConfig.showMeters && ( + <th>{t("estimates.distance", "Distancia")}</th> + )} </tr> </thead> @@ -56,7 +61,7 @@ export const RegularTable: React.FC<RegularTableProps> = ({ .map((estimate, idx) => ( <tr key={idx}> <td> - <LineIcon line={estimate.line} /> + <LineIcon line={estimate.line} region={regionConfig.id} /> </td> <td>{estimate.route}</td> <td> @@ -64,11 +69,13 @@ export const RegularTable: React.FC<RegularTableProps> = ({ ? absoluteArrivalTime(estimate.minutes) : `${estimate.minutes} ${t("estimates.minutes", "min")}`} </td> - <td> - {estimate.meters > -1 - ? formatDistance(estimate.meters) - : t("estimates.not_available", "No disponible")} - </td> + {regionConfig.showMeters && ( + <td> + {estimate.meters > -1 + ? formatDistance(estimate.meters) + : t("estimates.not_available", "No disponible")} + </td> + )} </tr> ))} </tbody> @@ -76,7 +83,7 @@ export const RegularTable: React.FC<RegularTableProps> = ({ {data?.estimates.length === 0 && ( <tfoot> <tr> - <td colSpan={4}> + <td colSpan={regionConfig.showMeters ? 4 : 3}> {t("estimates.none", "No hay estimaciones disponibles")} </td> </tr> |
