feat: adjust Trips page

This commit is contained in:
dancingCycle 2023-11-28 15:35:15 +01:00
parent cd71cda6e6
commit 304838d839
6 changed files with 2030 additions and 1780 deletions

View File

@ -19,5 +19,5 @@ export default function OverviewNextTableEntry ({ agencyName, routeCount, tripCo
OverviewNextTableEntry.propTypes = {
agencyName: PropTypes.string,
routeCount: PropTypes.string,
tripCount: PropTypes.strin
tripCount: PropTypes.string
};

View File

@ -9,7 +9,8 @@ import Head from './overview-next-table-head';
/*destructure props object*/
export default function OverviewNextTable ({ overview }) {
const handleOverview = () => {
if (overview) {
if ( overview !== null && overview !== undefined && overview.length !== 0 ) {
//iterate over array
return overview.map((item, index) => {
return (
@ -17,8 +18,7 @@ export default function OverviewNextTable ({ overview }) {
agencyName={item.agency_name}
routeCount={item.route_count}
tripCount={item.trip_count}
day={item.day}
key={item.agency_id}
key={item.agency_id}
/>
);
});

View File

@ -12,7 +12,7 @@ const Contact = () => {
<p>
Please feel <b>free</b> to <b>use</b>, <b>study</b>, <b>share</b> or <b>improve</b> the{' '}
<a
href="https://git.wtf-eg.de/dancesWithCycles/gtfs-display"
href="https://git.wtf-eg.de/dancingCycle/gtfs-display"
target="_blank"
>
sources

View File

@ -15,9 +15,6 @@ export default function OverviewNext() {
const res = await axios.get(`${config.API}number-of-trips`);
if ( res !== null && res !== undefined ) {
//TODO remove debugging
console.log('OverviewNext res: length: ' + res.data.length );
setTrips(res.data);
}
@ -27,13 +24,11 @@ export default function OverviewNext() {
};
useEffect(() => {
getTrips();
}, []);
if ( trips !== null && trips !== undefined && trips.length === 0 ) {
if ( trips === null || trips === undefined || trips.length === 0 ) {
return <p>loading...</p>;
} else {
return <OverviewTable overview={trips} />;

3787
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"private": true,
"name": "gtfs-display",
"description": "display data from GTFS files",
"version": "0.6.0",
"version": "0.7.0",
"main": "index.js",
"keywords": [
"public",
@ -12,9 +12,6 @@
"display"
],
"author": "Software Ingenieur Begerad <dialog@SwIngBe.de>",
"homepage": "https://github.com/Software-Ingenieur-Begerad/gtfs-display/tree/main",
"repository": "https://github.com/Software-Ingenieur-Begerad/gtfs-display",
"bugs": "https://github.com/Software-Ingenieur-Begerad/gtfs-display/issues",
"license": "GPL-3.0-or-later",
"scripts": {
"start": "webpack-dev-server --mode development",
@ -24,7 +21,6 @@
"dependencies": {
"axios": "0.27.2",
"bootstrap": "5.2.2",
"chart.js": "3.9.1",
"react": "18.2.0",
"react-bootstrap": "2.6.0",
"react-chartjs-2": "4.3.1",