0) {
diff --git a/src/components/fields/ZoomSpecField.jsx b/src/components/fields/ZoomSpecField.jsx
index 45e9d01e..13611c43 100644
--- a/src/components/fields/ZoomSpecField.jsx
+++ b/src/components/fields/ZoomSpecField.jsx
@@ -1,5 +1,4 @@
import React from 'react'
-import Immutable from 'immutable'
import Color from 'color'
import NumberField from './NumberField'
@@ -14,7 +13,7 @@ import colors from '../../config/colors.js'
import { margins } from '../../config/scales.js'
function isZoomField(value) {
- return Immutable.Map.isMap(value)
+ return typeof value === 'object' && value.stops
}
const specFieldProps = {
@@ -46,9 +45,9 @@ export default class ZoomSpecField extends React.Component {
if(isZoomField(this.props.value)) {
- const zoomFields = this.props.value.get('stops').map(stop => {
- const zoomLevel = stop.get(0)
- const value = stop.get(1)
+ const zoomFields = this.props.value.stops.map(stop => {
+ const zoomLevel = stop[0]
+ const value = stop[1]
return
{label}
@@ -71,7 +70,7 @@ export default class ZoomSpecField extends React.Component {
max={22}
/>
- }).toSeq()
+ })
return
this.onFilterPartChanged(filterOp, newPropertyName, filterArgs)}
>
- {this.props.properties.keySeq().map(propName => {
+ {Object.keys(this.props.properties).map(propName => {
return
- }).toIndexedSeq()}
+ })}
})
@@ -119,19 +118,20 @@ export default class LayerEditor extends React.Component {
{propertyGroups}
+ {this.props.layer.type !== 'background' &&
this.onFilterChange(Immutable.fromJS(f))}
+ properties={this.props.vectorLayers[this.props.layer['source-layer']]}
+ onChange={f => this.onFilterChange(f)}
/>
- {this.props.layer.type !== 'background'
- && }
+
+
}
}
}
diff --git a/src/components/layers/LayerList.jsx b/src/components/layers/LayerList.jsx
index 854a62dd..55a36517 100644
--- a/src/components/layers/LayerList.jsx
+++ b/src/components/layers/LayerList.jsx
@@ -1,6 +1,5 @@
import React from 'react'
import PureRenderMixin from 'react-addons-pure-render-mixin';
-import Immutable from 'immutable'
import Heading from 'rebass/dist/Heading'
import Toolbar from 'rebass/dist/Toolbar'
@@ -15,7 +14,7 @@ import { margins } from '../../config/scales.js'
import {SortableContainer, SortableHandle, arrayMove} from 'react-sortable-hoc';
const layerListPropTypes = {
- layers: React.PropTypes.instanceOf(Immutable.OrderedMap),
+ layers: React.PropTypes.array.isRequired,
onLayersChanged: React.PropTypes.func.isRequired,
onLayerSelected: React.PropTypes.func,
}
@@ -34,23 +33,18 @@ class LayerListContainer extends React.Component {
}
onLayerDestroyed(deletedLayer) {
- const remainingLayers = this.props.layers.delete(deletedLayer.get('id'))
+ const remainingLayers = this.props.layers.delete(deletedLayer.id)
this.props.onLayersChanged(remainingLayers)
}
- onLayerChanged(layer) {
- const changedLayers = this.props.layers.set(layer.get('id'), layer)
- this.props.onLayersChanged(changedLayers)
- }
-
render() {
- const layerPanels = this.props.layers.toIndexedSeq().map((layer, index) => {
- const layerId = layer.get('id')
+ const layerPanels = this.props.layers.map((layer, index) => {
+ const layerId = layer.id
return
})
@@ -73,13 +67,8 @@ export default class LayerList extends React.Component {
onSortEnd(move) {
const { oldIndex, newIndex } = move
if(oldIndex === newIndex) return
-
- //TODO: Implement this more performant for immutable collections
- // instead of converting back and forth
- let layers = this.props.layers.toArray()
+ let layers = this.props.layers.slice(0)
layers = arrayMove(layers, oldIndex, newIndex)
- layers = Immutable.OrderedMap(layers.map(l => [l.get('id'), l]))
-
this.props.onLayersChanged(layers)
}
diff --git a/src/components/layers/LayerListItem.jsx b/src/components/layers/LayerListItem.jsx
index 782b1043..f23b4429 100644
--- a/src/components/layers/LayerListItem.jsx
+++ b/src/components/layers/LayerListItem.jsx
@@ -1,7 +1,5 @@
import React from 'react'
-import PureRenderMixin from 'react-addons-pure-render-mixin'
import Radium from 'radium'
-import Immutable from 'immutable'
import Color from 'color'
import Heading from 'rebass/dist/Heading'
@@ -38,11 +36,6 @@ class LayerListItem extends React.Component {
onLayerSelected: React.PropTypes.func.isRequired,
}
- constructor(props) {
- super(props)
- this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
- }
-
render() {
return
{
+ const options = Object.keys(this.props.sources).map(sourceId => {
return
- }).toIndexedSeq()
+ })
- const layerOptions = this.props.sources.get(this.props.source, Immutable.Set()).map(vectorLayerId => {
+ const layerOptions = this.props.sources[this.props.source].map(vectorLayerId => {
const id = vectorLayerId
return
- }).toIndexedSeq()
+ })
return
diff --git a/src/components/map/Map.jsx b/src/components/map/Map.jsx
index 71382ed0..83387d47 100644
--- a/src/components/map/Map.jsx
+++ b/src/components/map/Map.jsx
@@ -1,17 +1,11 @@
import React from 'react'
-import Immutable from 'immutable'
export default class Map extends React.Component {
static propTypes = {
- mapStyle: React.PropTypes.instanceOf(Immutable.Map).isRequired,
+ mapStyle: React.PropTypes.object.isRequired,
accessToken: React.PropTypes.string,
}
- shouldComponentUpdate(nextProps, nextState) {
- //TODO: If we enable this React mixin for immutable comparison we can remove this?
- return nextProps.mapStyle !== this.props.mapStyle
- }
-
render() {
return
this.container = x}
diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx
index ec85a898..5eaf3f48 100644
--- a/src/components/map/MapboxGlMap.jsx
+++ b/src/components/map/MapboxGlMap.jsx
@@ -23,7 +23,7 @@ export default class MapboxGlMap extends Map {
//Mapbox GL now does diffing natively so we don't need to calculate
//the necessary operations ourselves!
- this.state.map.setStyle(style.toJSON(nextProps.mapStyle), { diff: true})
+ this.state.map.setStyle(nextProps.mapStyle, { diff: true})
}
componentDidMount() {
@@ -31,7 +31,7 @@ export default class MapboxGlMap extends Map {
const map = new MapboxGl.Map({
container: this.container,
- style: style.toJSON(this.props.mapStyle),
+ style: this.props.mapStyle,
});
map.on("style.load", (...args) => {
diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx
index ac3c29a3..3c4cc1b1 100644
--- a/src/components/modals/SettingsModal.jsx
+++ b/src/components/modals/SettingsModal.jsx
@@ -1,5 +1,4 @@
import React from 'react'
-import Immutable from 'immutable'
import Select from 'rebass/dist/Select'
import Overlay from 'rebass/dist/Overlay'
@@ -15,7 +14,7 @@ import Input from 'rebass/dist/Input'
class SettingsModal extends React.Component {
static propTypes = {
- mapStyle: React.PropTypes.instanceOf(Immutable.Map).isRequired,
+ mapStyle: React.PropTypes.object.isRequired,
onStyleChanged: React.PropTypes.func.isRequired,
open: React.PropTypes.bool.isRequired,
toggle: React.PropTypes.func.isRequired,
@@ -47,31 +46,31 @@ class SettingsModal extends React.Component {