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 | 10x 10x | import React from "react";
import { Arrival } from "../../../api/trimet/interfaces/arrivals";
import {
StopLocation,
TrimetRoute,
} from "../../../api/trimet/interfaces/types";
import "../Arrivals.css";
import ArrivalsTableLoadMore from "./ArrivalsTableLoadMore";
interface Props {
loading: boolean;
locationId: number;
arrivals?: Arrival[];
error?: string;
showArrivals: boolean;
now: number;
stopLocation?: StopLocation;
onRouteIndicatorClick?: (route: TrimetRoute) => void;
}
export default class ArrivalsComponent extends React.Component<Props> {
public render() {
const {
arrivals,
loading = true,
showArrivals = true,
now,
onRouteIndicatorClick,
stopLocation,
} = this.props;
return (
<div className="arrivals-wrapper">
{loading && showArrivals && !arrivals && (
<p role="status">Loading arrivals...</p>
)}
{!loading &&
!this.props.error &&
showArrivals &&
arrivals?.length === 0 && (
<p className="no-arrivals">No arrivals available.</p>
)}
{showArrivals && arrivals && arrivals.length > 0 && (
<ArrivalsTableLoadMore
arrivals={arrivals}
loading={loading}
now={now}
onRouteIndicatorClick={onRouteIndicatorClick}
stopLocation={stopLocation}
/>
)}
</div>
);
}
}
|