-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from MobilityData/indraneel/feed-page
feat: add single GTFS Feed and GTFS-RT Feed pages
- Loading branch information
Showing
26 changed files
with
1,192 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as React from 'react'; | ||
import { Box, Grid } from '@mui/material'; | ||
|
||
export interface ContentBoxProps { | ||
title: string; | ||
width: Record<string, string>; | ||
outlineColor: string; | ||
} | ||
|
||
export const ContentBox = ( | ||
props: React.PropsWithChildren<ContentBoxProps>, | ||
): JSX.Element => { | ||
return ( | ||
<Box | ||
width={props.width} | ||
sx={{ | ||
background: '#FFFFFF', | ||
borderRadius: '6px', | ||
border: `2px solid ${props.outlineColor}`, | ||
p: 5, | ||
fontSize: '18px', | ||
fontWeight: 700, | ||
mr: 0, | ||
}} | ||
> | ||
<Grid | ||
container | ||
sx={{ | ||
width: '100%', | ||
}} | ||
> | ||
<Grid item xs={12} fontSize={24}> | ||
{props.title} | ||
</Grid> | ||
{props.children} | ||
</Grid> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react'; | ||
import 'leaflet/dist/leaflet.css'; | ||
import { MapContainer, TileLayer, Polygon } from 'react-leaflet'; | ||
import { type LatLngBoundsExpression, type LatLngExpression } from 'leaflet'; | ||
|
||
export interface MapProps { | ||
polygon: LatLngExpression[]; | ||
} | ||
|
||
export const Map = (props: React.PropsWithChildren<MapProps>): JSX.Element => { | ||
return ( | ||
<MapContainer | ||
bounds={props.polygon as LatLngBoundsExpression} | ||
zoom={8} | ||
style={{ minHeight: '400px', height: '100%' }} | ||
> | ||
<TileLayer | ||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | ||
url='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' | ||
/> | ||
<Polygon positions={props.polygon}></Polygon> | ||
</MapContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as React from 'react'; | ||
import { ContentBox } from '../../components/ContentBox'; | ||
import { | ||
TableBody, | ||
TableCell, | ||
TableContainer, | ||
TableRow, | ||
colors, | ||
} from '@mui/material'; | ||
import { OpenInNewOutlined } from '@mui/icons-material'; | ||
import { type GTFSRTFeedType } from '../../services/feeds/utils'; | ||
|
||
export interface AssociatedGTFSFeedsProps { | ||
feed: GTFSRTFeedType | undefined; | ||
} | ||
|
||
export default function AssociatedGTFSFeeds({ | ||
feed, | ||
}: AssociatedGTFSFeedsProps): React.ReactElement { | ||
return ( | ||
<ContentBox | ||
width={{ xs: '100%', md: '50%' }} | ||
title={'Associated GTFS Schedule Feed'} | ||
outlineColor={colors.indigo[500]} | ||
> | ||
<TableContainer> | ||
<TableBody> | ||
{feed?.data_type === 'gtfs_rt' && | ||
feed?.feed_references?.map((feedRef) => { | ||
return ( | ||
<TableRow key={feedRef}> | ||
<TableCell> | ||
<span style={{ display: 'flex' }}> | ||
<a href={`/feeds/${feedRef}`} rel='noreferrer'> | ||
{feedRef} | ||
</a> | ||
<OpenInNewOutlined /> | ||
</span> | ||
</TableCell> | ||
</TableRow> | ||
); | ||
})} | ||
</TableBody> | ||
</TableContainer> | ||
</ContentBox> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import * as React from 'react'; | ||
import { ContentBox } from '../../components/ContentBox'; | ||
import { | ||
Chip, | ||
TableCell, | ||
TableContainer, | ||
TableRow, | ||
colors, | ||
} from '@mui/material'; | ||
|
||
import { | ||
ErrorOutlineOutlined, | ||
OpenInNewOutlined, | ||
ReportOutlined, | ||
ReportProblemOutlined, | ||
} from '@mui/icons-material'; | ||
import { type components } from '../../services/feeds/types'; | ||
|
||
export interface DataQualitySummaryProps { | ||
latestDataset: components['schemas']['GtfsDataset'] | undefined; | ||
} | ||
|
||
export default function DataQualitySummary({ | ||
latestDataset, | ||
}: DataQualitySummaryProps): React.ReactElement { | ||
return ( | ||
<ContentBox | ||
width={{ xs: '100%', md: '50%' }} | ||
title={'Data Quality Summary'} | ||
outlineColor={colors.indigo[500]} | ||
> | ||
<TableContainer> | ||
<TableRow> | ||
<TableCell> | ||
<Chip | ||
icon={<ReportOutlined />} | ||
label={`${ | ||
latestDataset?.validation_report?.total_error ?? '0' | ||
} Error`} | ||
color='error' | ||
variant='outlined' | ||
/> | ||
<Chip | ||
icon={<ReportProblemOutlined />} | ||
label={`${ | ||
latestDataset?.validation_report?.total_warning ?? '0' | ||
} Warning`} | ||
color='warning' | ||
variant='outlined' | ||
/> | ||
<Chip | ||
icon={<ErrorOutlineOutlined />} | ||
label={`${ | ||
latestDataset?.validation_report?.total_info ?? '0' | ||
} Info Notices`} | ||
color='primary' | ||
variant='outlined' | ||
/> | ||
</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
{latestDataset?.validation_report?.url_html !== undefined && ( | ||
<TableCell> | ||
<span style={{ display: 'flex' }}> | ||
<a | ||
href={`${latestDataset?.validation_report?.url_html}`} | ||
target='_blank' | ||
rel='noreferrer' | ||
> | ||
Open Full Report | ||
</a> | ||
<OpenInNewOutlined /> | ||
</span> | ||
</TableCell> | ||
)} | ||
{latestDataset?.validation_report?.url_json !== undefined && ( | ||
<TableCell> | ||
<span style={{ display: 'flex' }}> | ||
<a | ||
href={`${latestDataset?.validation_report?.url_json}`} | ||
target='_blank' | ||
rel='noreferrer' | ||
> | ||
Open JSON Report | ||
</a> | ||
<OpenInNewOutlined /> | ||
</span> | ||
</TableCell> | ||
)} | ||
</TableRow> | ||
</TableContainer> | ||
</ContentBox> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as React from 'react'; | ||
import { ContentBox } from '../../components/ContentBox'; | ||
import { | ||
TableBody, | ||
TableCell, | ||
TableContainer, | ||
TableRow, | ||
colors, | ||
} from '@mui/material'; | ||
import { type components } from '../../services/feeds/types'; | ||
|
||
export interface FeaturesListProps { | ||
latestDataset: components['schemas']['GtfsDataset'] | undefined; | ||
} | ||
|
||
export default function FeaturesList({ | ||
latestDataset, | ||
}: FeaturesListProps): React.ReactElement { | ||
return ( | ||
<ContentBox | ||
width={{ xs: '100%', md: '50%' }} | ||
title={'Features List'} | ||
outlineColor={colors.indigo[500]} | ||
> | ||
<TableContainer> | ||
<TableBody> | ||
{latestDataset?.validation_report?.features !== undefined && | ||
latestDataset?.validation_report?.features?.length > 0 && ( | ||
<TableRow> | ||
<TableCell> | ||
<b>Feature</b> | ||
</TableCell> | ||
</TableRow> | ||
)} | ||
{latestDataset?.validation_report?.features?.map((v) => ( | ||
<TableRow key={v}> | ||
<TableCell>{v}</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</TableContainer> | ||
</ContentBox> | ||
); | ||
} |
Oops, something went wrong.