gtfs-display/src/components/group-agency-per-day-table-...

42 lines
898 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
export default function GroupAgencyPerDayTableEntries({ array }) {
if (array !== undefined && array !== null && array.length > 0) {
// TODO Shall we switch from UTC to local time zone for item.timestamp_pgsql?
// iterate over array
return array.map((item, index) => (
<tr
key={index}
>
<td>
{item.agency_name}
&nbsp;|
</td>
<td>
{item.agency_id}
&nbsp;|
</td>
<td>
{item.rt_part}
&nbsp;|
</td>
<td>
{item.agency_id === 0 ? 0 : ((item.rt_part / item.agency_id) * 100).toFixed(2)}
&nbsp;|
</td>
<td>
{item.timestamp_pgsql}
&nbsp;|
</td>
</tr>
));
}
// data is empty
return null;
}
GroupAgencyPerDayTableEntries.propTypes = {
array: PropTypes.array,
};