All files / presentation/ui/src/transit ArrivalsTable.tsx

75% Statements 3/4
50% Branches 1/2
100% Functions 1/1
75% Lines 3/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57                                                    6x   6x       6x                                                
import { Table } from "@wintermuted/ui-react";
import React from "react";
import type { Arrival, StopLocation } from "@overworld/trimet-client";
import type { ArrivalRowProps } from "./ArrivalRow";
import ArrivalRows from "./ArrivalRows";
import "./Arrivals.css";
 
export interface ArrivalsTableProps {
  arrivals: Arrival[];
  loading: boolean;
  now: number;
  renderRouteIndicator: ArrivalRowProps["renderRouteIndicator"];
  formatDistance: ArrivalRowProps["formatDistance"];
  stopLocation: StopLocation;
  showMore: boolean;
}
 
export default class ArrivalsTable extends React.Component<ArrivalsTableProps> {
  public render() {
    const {
      arrivals,
      now,
      renderRouteIndicator,
      formatDistance,
      stopLocation,
      showMore
    } = this.props;
 
    Iif (!arrivals) {
      return null;
    }
 
    return (
      <Table responsive={true}>
        <thead>
          <tr>
            <th />
            <th>Name</th>
            <th>Arrival</th>
            <th>On Time</th>
            <th>Estimated / Scheduled</th>
            <th>Distance</th>
          </tr>
        </thead>
        <ArrivalRows
          arrivals={arrivals}
          renderRouteIndicator={renderRouteIndicator}
          formatDistance={formatDistance}
          stopLocation={stopLocation}
          now={now}
          showAllArrivals={showMore}
        />
      </Table>
    );
  }
}