update
This commit is contained in:
@@ -49,6 +49,10 @@ function StopSelector({ stops, onChange, placeholder, inputId }) {
|
||||
|
||||
const fetcher = (url) => fetch(url).then(res => res.ok ? res.json() : Promise.reject(res.statusText));
|
||||
|
||||
const JsonView = ({ data }) => { (
|
||||
<pre className="json-view">{JSON.stringify(data, null, 2)}</pre>
|
||||
); };
|
||||
|
||||
function App() {
|
||||
const { data: stops = [], error: stopsError } = useSWR('/api/stops', fetcher);
|
||||
const [from, setFrom] = useState({
|
||||
@@ -133,7 +137,7 @@ function App() {
|
||||
<h2 className="route-title">
|
||||
Routes from {from.name} to {to.name}
|
||||
</h2>
|
||||
{routes.length > 1 && (
|
||||
{/* {routes.length > 1 && (
|
||||
<div className="route-selector">
|
||||
{routes.map((_, index) => (
|
||||
<button
|
||||
@@ -146,8 +150,9 @@ function App() {
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{routes[selectedRouteIndex]?.legs &&
|
||||
)} */}
|
||||
<JsonView data={routes} />
|
||||
{/* {routes[selectedRouteIndex]?.legs &&
|
||||
routes[selectedRouteIndex].legs.length > 0 && (
|
||||
<div className="route">
|
||||
{routes[selectedRouteIndex].legs.map((leg, index) => {
|
||||
@@ -187,12 +192,12 @@ function App() {
|
||||
{stops.find((s) => s.stop_id === leg.to)?.stop_name ||
|
||||
leg.to}
|
||||
</p>
|
||||
)} */}
|
||||
)} }
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
)}*/}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user