diff --git a/lib/editor/components/EntityDetailsHeader.js b/lib/editor/components/EntityDetailsHeader.js index 0ad9aa39e..6b6d9bfa3 100644 --- a/lib/editor/components/EntityDetailsHeader.js +++ b/lib/editor/components/EntityDetailsHeader.js @@ -9,7 +9,7 @@ import * as activeActions from '../actions/active' import * as mapActions from '../actions/map' import {getEntityBounds, getEntityName} from '../util/gtfs' import {entityIsNew} from '../util/objects' -import {GTFS_ICONS} from '../util/ui' +import {getGtfsIconName} from '../util/ui' import type {Entity, Feed, GtfsRoute, GtfsStop, Pattern} from '../../types' import type {MapState} from '../../types/reducers' import type {EditorValidationIssue} from '../util/validation' @@ -129,11 +129,10 @@ export default class EntityDetailsHeader extends Component { const entityName = activeComponent === 'feedinfo' ? this.messages('feedInfo') : getEntityName(activeEntity) - const icon = GTFS_ICONS.find(i => i.id === activeComponent) const zoomDisabled = activeEntity && !subComponent ? mapState.target === activeEntity.id : mapState.target === subEntity - const iconName = icon ? icon.icon : null + const iconName = getGtfsIconName(activeComponent) const nameWidth = activeComponent === 'stop' || activeComponent === 'route' ? '176px' : '210px' @@ -199,8 +198,7 @@ export default class EntityDetailsHeader extends Component { - // schedule exception icon if no icon found - // FARE-TODO: Replace with appropriate FARES v2 icon. Address constant GTFS_ICONS in lib/editor/util.js? + // fallback icon for an unregistered component : diff --git a/lib/editor/util/ui.js b/lib/editor/util/ui.js index a539df801..47e30f1b1 100644 --- a/lib/editor/util/ui.js +++ b/lib/editor/util/ui.js @@ -84,6 +84,27 @@ export const GTFS_ICONS = [ } ] +// Fares v2 tables are selected through the Fares v2 table selector rather +// than individual sidebar entries, so keep their icons separate from the +// navigation metadata above. +export const FARES_V2_ICONS = [ + {id: 'fareproduct', icon: 'ticket'}, + {id: 'faremedia', icon: 'credit-card'}, + {id: 'faretransferrule', icon: 'exchange'}, + {id: 'farelegrule', icon: 'road'}, + {id: 'farelegjoinrule', icon: 'link'}, + {id: 'ridercategory', icon: 'users'}, + {id: 'area', icon: 'map'}, + {id: 'network', icon: 'sitemap'}, + {id: 'timeframe', icon: 'clock-o'} +] + +export function getGtfsIconName (component: string): ?string { + const icon = FARES_V2_ICONS.find(i => i.id === component) || + GTFS_ICONS.find(i => i.id === component) + return icon ? icon.icon : null +} + /** * Returns the editor status * @param {*} feedSource