Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/editor/components/EntityDetailsHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -129,11 +129,10 @@ export default class EntityDetailsHeader extends Component<Props> {
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'
Expand Down Expand Up @@ -199,8 +198,7 @@ export default class EntityDetailsHeader extends Component<Props> {
<Icon type='square' className='fa-stack-2x' />
<Icon type={iconName} className='fa-inverse fa-stack-1x' />
</span>
// 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
: <span className='fa-stack'>
<Icon type='calendar' className='fa-stack-1x' />
<Icon type='ban' className='text-danger fa-stack-2x' />
Expand Down
21 changes: 21 additions & 0 deletions lib/editor/util/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading