aboutsummaryrefslogtreecommitdiff
path: root/src/components/RegularTable.tsx
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-05-26 10:48:43 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-05-26 10:48:43 +0200
commit5ced7f916d94e86e9a7ec164bee56f9a8e3a2a3a (patch)
treeb1ef5afa17b4a2f9fb2cbd683afc2fb6d905b5e1 /src/components/RegularTable.tsx
parent4637373b50636e78dc2c7b6f99be879edb4ff7dc (diff)
Replace Azure SWA with custom server
Diffstat (limited to 'src/components/RegularTable.tsx')
-rw-r--r--src/components/RegularTable.tsx70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/components/RegularTable.tsx b/src/components/RegularTable.tsx
deleted file mode 100644
index 8f0605f..0000000
--- a/src/components/RegularTable.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { StopDetails } from "../pages/Estimates";
-import LineIcon from "./LineIcon";
-
-interface RegularTableProps {
- data: StopDetails;
- dataDate: Date | null;
-}
-
-export const RegularTable: React.FC<RegularTableProps> = ({ data, dataDate }) => {
-
- const absoluteArrivalTime = (minutes: number) => {
- const now = new Date()
- const arrival = new Date(now.getTime() + minutes * 60000)
- return Intl.DateTimeFormat(navigator.language, {
- hour: '2-digit',
- minute: '2-digit'
- }).format(arrival)
- }
-
- const formatDistance = (meters: number) => {
- if (meters > 1024) {
- return `${(meters / 1000).toFixed(1)} km`;
- } else {
- return `${meters} m`;
- }
- }
-
- return <table className="table">
- <caption>Estimaciones de llegadas a las {dataDate?.toLocaleTimeString()}</caption>
-
- <thead>
- <tr>
- <th>LĂ­nea</th>
- <th>Ruta</th>
- <th>Llegada</th>
- <th>Distancia</th>
- </tr>
- </thead>
-
- <tbody>
- {data.estimates
- .sort((a, b) => a.minutes - b.minutes)
- .map((estimate, idx) => (
- <tr key={idx}>
- <td><LineIcon line={estimate.line} /></td>
- <td>{estimate.route}</td>
- <td>
- {estimate.minutes > 15
- ? absoluteArrivalTime(estimate.minutes)
- : `${estimate.minutes} min`}
- </td>
- <td>
- {estimate.meters > -1
- ? formatDistance(estimate.meters)
- : "No disponible"
- }
- </td>
- </tr>
- ))}
- </tbody>
-
- {data?.estimates.length === 0 && (
- <tfoot>
- <tr>
- <td colSpan={4}>No hay estimaciones disponibles</td>
- </tr>
- </tfoot>
- )}
- </table>
-} \ No newline at end of file