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/GroupedTable.tsx | |
| parent | 67c1dd5cb0025235c29ebd1f1706e5c17392dbff (diff) | |
Implement new Santiago region (WIP)
Diffstat (limited to 'src/frontend/app/components/GroupedTable.tsx')
| -rw-r--r-- | src/frontend/app/components/GroupedTable.tsx | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/frontend/app/components/GroupedTable.tsx b/src/frontend/app/components/GroupedTable.tsx index 47c2d31..fd97d5b 100644 --- a/src/frontend/app/components/GroupedTable.tsx +++ b/src/frontend/app/components/GroupedTable.tsx @@ -1,12 +1,14 @@ import { type StopDetails } from "../routes/estimates-$id"; import LineIcon from "./LineIcon"; +import { type RegionConfig } from "../data/RegionConfig"; interface GroupedTable { data: StopDetails; dataDate: Date | null; + regionConfig: RegionConfig; } -export const GroupedTable: React.FC<GroupedTable> = ({ data, dataDate }) => { +export const GroupedTable: React.FC<GroupedTable> = ({ data, dataDate, regionConfig }) => { const formatDistance = (meters: number) => { if (meters > 1024) { return `${(meters / 1000).toFixed(1)} km`; @@ -43,7 +45,7 @@ export const GroupedTable: React.FC<GroupedTable> = ({ data, dataDate }) => { <th>LĂnea</th> <th>Ruta</th> <th>Llegada</th> - <th>Distancia</th> + {regionConfig.showMeters && <th>Distancia</th>} </tr> </thead> @@ -53,16 +55,18 @@ export const GroupedTable: React.FC<GroupedTable> = ({ data, dataDate }) => { <tr key={`${line}-${idx}`}> {idx === 0 && ( <td rowSpan={groupedEstimates[line].length}> - <LineIcon line={line} /> + <LineIcon line={line} region={regionConfig.id} /> </td> )} <td>{estimate.route}</td> <td>{`${estimate.minutes} min`}</td> - <td> - {estimate.meters > -1 - ? formatDistance(estimate.meters) - : "No disponible"} - </td> + {regionConfig.showMeters && ( + <td> + {estimate.meters > -1 + ? formatDistance(estimate.meters) + : "No disponible"} + </td> + )} </tr> )), )} @@ -71,7 +75,9 @@ export const GroupedTable: React.FC<GroupedTable> = ({ data, dataDate }) => { {data?.estimates.length === 0 && ( <tfoot> <tr> - <td colSpan={4}>No hay estimaciones disponibles</td> + <td colSpan={regionConfig.showMeters ? 4 : 3}> + No hay estimaciones disponibles + </td> </tr> </tfoot> )} |
