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 | 2x 2x 1x 1x 1x 2x 1x 1x 1x | import { isEmpty } from "lodash";
import React, { useEffect, useState } from "react";
import { RouteDataResultSet } from "../../../api/trimet/interfaces/routes";
import { getAllRoutes } from "../../../api/trimet/routeConfig";
import { createRoutesDictionary } from "../routeDictionary";
import CollapsiblePane from "../../lineDetail/component/CollapsiblePane";
import { getBusLines, getRoutes } from "./AllLines";
export function BusLines() {
const [routes, setRoutes] = useState({});
useEffect(() => {
getAllRoutes().then((data: RouteDataResultSet) => {
const routesDictionary = createRoutesDictionary(data.route);
setRoutes(routesDictionary);
});
}, []);
if (isEmpty(routes)) {
return null;
}
const busLines = getBusLines(routes);
return (
<div className="transit-container">
<CollapsiblePane
title="Schedule"
open={true}
className="route-detail-information-pane"
>
<p>
Some lines offer <strong>Frequent Service</strong>, others provide{" "}
<strong>24-hour Service</strong> all days of the week.
</p>
</CollapsiblePane>
<br />
<div className="transit-grid transit-grid-4">{getRoutes(busLines)}</div>
</div>
);
}
|