digitransit-ui/app/util/shapes.js
2023-05-09 16:27:14 +03:00

86 lines
2.5 KiB
JavaScript

/* eslint-disable import/prefer-default-export */
import PropTypes from 'prop-types';
export const dtLocationShape = PropTypes.shape({
lat: PropTypes.number,
lon: PropTypes.number,
address: PropTypes.string,
type: PropTypes.string,
name: PropTypes.string,
});
const mapLayerOptionShape = PropTypes.shape({
isLocked: PropTypes.bool,
isSelected: PropTypes.bool,
});
const mapLayerOptionStopOrTerminalShape = PropTypes.shape({
bus: PropTypes.shape(mapLayerOptionShape),
rail: PropTypes.shape(mapLayerOptionShape),
tram: PropTypes.shape(mapLayerOptionShape),
subway: PropTypes.shape(mapLayerOptionShape),
ferry: PropTypes.shape(mapLayerOptionShape),
funicular: PropTypes.shape(mapLayerOptionShape),
});
export const mapLayerOptionsShape = PropTypes.shape({
parkAndRide: PropTypes.shape(mapLayerOptionShape),
stop: PropTypes.shape(mapLayerOptionStopOrTerminalShape),
terminal: PropTypes.shape(mapLayerOptionStopOrTerminalShape),
vehicles: PropTypes.shape(mapLayerOptionShape),
citybike: PropTypes.shape(mapLayerOptionShape),
});
export const FareShape = PropTypes.shape({
agency: PropTypes.shape({
fareUrl: PropTypes.string,
name: PropTypes.string,
}),
fareId: PropTypes.string,
cents: PropTypes.number,
isUnknown: PropTypes.bool,
routeName: PropTypes.string,
ticketName: PropTypes.string,
});
export const AlertShape = PropTypes.shape({
alertDescriptionText: PropTypes.string,
effectiveEndDate: PropTypes.number,
effectiveStartDate: PropTypes.number,
alertHash: PropTypes.number,
alertHeaderText: PropTypes.string,
alertSeverityLevel: PropTypes.string,
alertUrl: PropTypes.string,
entities: PropTypes.arrayOf(
PropTypes.shape({
__typename: PropTypes.string.isRequired,
}),
),
});
export const RouteShape = PropTypes.shape({
gtfsId: PropTypes.string,
mode: PropTypes.string,
shortName: PropTypes.string,
longName: PropTypes.string,
color: PropTypes.string,
type: PropTypes.number,
alerts: PropTypes.arrayOf(AlertShape),
});
export const VehicleShape = PropTypes.shape({
id: PropTypes.string.isRequired,
route: PropTypes.string.isRequired,
direction: PropTypes.number.isRequired,
tripStartTime: PropTypes.string.isRequired,
operatingDay: PropTypes.string.isRequired,
mode: PropTypes.string.isRequired,
next_stop: PropTypes.string.isRequired,
timestamp: PropTypes.number.isRequired,
lat: PropTypes.number,
lon: PropTypes.number,
shortName: PropTypes.string.isRequired,
color: PropTypes.string,
heading: PropTypes.number,
headsign: PropTypes.string,
});