From 044cdf5332ec065d9e52e9e1412e95f0d7b9f403 Mon Sep 17 00:00:00 2001 From: Lukas Martinelli Date: Wed, 21 Dec 2016 17:13:21 +0100 Subject: [PATCH] Support different source types --- src/components/Toolbar.jsx | 4 +- src/components/modals/SourcesModal.jsx | 54 +++++++----- src/components/sources/SourceTypeEditor.jsx | 94 +++++++++++++++++++++ 3 files changed, 130 insertions(+), 22 deletions(-) create mode 100644 src/components/sources/SourceTypeEditor.jsx diff --git a/src/components/Toolbar.jsx b/src/components/Toolbar.jsx index 20f902b..cccab74 100644 --- a/src/components/Toolbar.jsx +++ b/src/components/Toolbar.jsx @@ -113,8 +113,8 @@ export default class Toolbar extends React.Component { this.toggleSources.bind(this)} />
{this.props.title}
- {this.props.id} + #{this.props.id}
- - - - - - - - - +
+ #{this.props.sourceId} + + + Remove + +
+
+ +
} } @@ -94,10 +108,10 @@ class SourcesModal extends React.Component { render() { const activeSources = Object.keys(this.props.mapStyle.sources).map(sourceId => { const source = this.props.mapStyle.sources[sourceId] - return + return }) - const tilesetOptions = publicSources.map(tileset => { + const tilesetOptions = publicSources.filter(tileset => !(tileset.id in this.props.mapStyle.sources)).map(tileset => { return + + + } +} + +class TileURLSourceEditor extends React.Component { + static propTypes = { + tiles: React.PropTypes.array.isRequired, + minZoom: React.PropTypes.number.isRequired, + maxZoom: React.PropTypes.number.isRequired, + } + + renderTileUrls() { + return this.props.tiles.map((tileUrl, tileIndex) => { + + + + }) + } + + render() { + return
+ {this.renderTileUrls()} + + + + + + + + + +
+ + } +} + +class GeoJSONSourceEditor extends React.Component { + static propTypes = { + data: React.PropTypes.string.isRequired, + } + + render() { + return + + + } +} + +class SourceTypeEditor extends React.Component { + static propTypes = { + source: React.PropTypes.object.isRequired, + } + + render() { + const source = this.props.source + if(source.type === "geojson") { + return + } + if(source.type === "vector") { + if(source.url) { + return + } else { + return + } + } + return null + } +} + +export default SourceTypeEditor