Skip to content

Commit 23f5fa3

Browse files
add dropdown menu and todos
1 parent 27baa89 commit 23f5fa3

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

lib/editor/components/pattern/EditSettings.js

+24-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {Alert, Checkbox, Form, FormControl, ControlLabel} from 'react-bootstrap'
55
import Rcslider from 'rc-slider'
66

77
import {updateEditSetting} from '../../actions/active'
8-
import {CLICK_OPTIONS} from '../../util'
9-
import toSentenceCase from '../../../common/util/to-sentence-case'
8+
import {CLICK_OPTIONS, SNAP_TO_OPTIONS} from '../../util'
9+
import toSentenceCase from '../../../common/util/text'
1010
import type {EditSettingsState} from '../../../types/reducers'
1111

1212
type Props = {
@@ -64,6 +64,7 @@ export default class EditSettings extends Component<Props, State> {
6464
stopInterval
6565
} = editSettings
6666
const SETTINGS = [
67+
// RAIL-TODO remove snap to streets
6768
{type: 'followStreets', label: 'Snap to streets'},
6869
{type: 'avoidMotorways', label: 'Avoid highways in routing'},
6970
{type: 'hideStopHandles', label: 'Hide stop handles'},
@@ -75,6 +76,27 @@ export default class EditSettings extends Component<Props, State> {
7576
const noSegmentIsActive = !patternSegment && patternSegment !== 0
7677
return (
7778
<div>
79+
<ControlLabel><small>Snap to options</small></ControlLabel>
80+
<FormControl
81+
componentClass='select'
82+
value={onMapClick}
83+
name={'onMapClick'}
84+
onChange={this._onSelectChange}>
85+
{SNAP_TO_OPTIONS.map(v => {
86+
// ADD_STOPS_AT_INTERSECTIONS only enabled for nysdot extenstion
87+
// (due to custom r5 deployment)
88+
// FIXME: Temporarily disable add stops at intersection entirely
89+
// (needs to be fixed for sql editor).
90+
const disabled = v === 'ADD_STOPS_AT_INTERSECTIONS' // && !isExtensionEnabled('nysdot')
91+
return (
92+
<option
93+
key={v}
94+
disabled={disabled}
95+
value={v}>{toSentenceCase(v.replace(/_/g, ' '))}
96+
</option>
97+
)
98+
})}
99+
</FormControl>
78100
{SETTINGS.map((s, i) => (
79101
<Checkbox
80102
checked={editSettings[s.type]}

lib/editor/util/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export const CLICK_OPTIONS: Array<string> = [
1919
'ADD_STOPS_AT_INTERVAL',
2020
'ADD_STOPS_AT_INTERSECTIONS'
2121
]
22+
export const SNAP_TO_OPTIONS: Array<string> = [
23+
'NONE',
24+
'STREET',
25+
'RAIL'
26+
]
2227
export const YEAR_FORMAT: string = 'YYYY-MM-DD'
2328
export const EXCEPTION_EXEMPLARS = {
2429
MONDAY: 0,

lib/types/reducers.js

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export type DataState = {
207207
}
208208

209209
export type EditSettingsState = {
210+
// RAIL-TODO add any types that are missing
210211
addStops: boolean,
211212
afterIntersection: boolean,
212213
avoidMotorways: boolean,

0 commit comments

Comments
 (0)