mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-08 03:18:36 +03:00
correct mapbox token default
This commit is contained in:
@@ -9,7 +9,7 @@ module.exports = {
|
|||||||
SITES_EXT: '/api/example/export_sites/rows',
|
SITES_EXT: '/api/example/export_sites/rows',
|
||||||
SHAPES_EXT: '/api/example/export_shapes/columns',
|
SHAPES_EXT: '/api/example/export_shapes/columns',
|
||||||
INCOMING_DATETIME_FORMAT: '%m/%d/%YT%H:%M',
|
INCOMING_DATETIME_FORMAT: '%m/%d/%YT%H:%M',
|
||||||
MAPBOX_TOKEN: 'pk.EXAMPLE_MAPBOX_TOKEN',
|
// MAPBOX_TOKEN: 'pk.EXAMPLE_MAPBOX_TOKEN',
|
||||||
features: {
|
features: {
|
||||||
USE_COVER: false,
|
USE_COVER: false,
|
||||||
USE_TAGS: false,
|
USE_TAGS: false,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import DefsMarkers from './presentational/Map/DefsMarkers.jsx'
|
|||||||
|
|
||||||
// NB: important constants for map, TODO: make statics
|
// NB: important constants for map, TODO: make statics
|
||||||
const supportedMapboxMap = ['streets', 'satellite']
|
const supportedMapboxMap = ['streets', 'satellite']
|
||||||
const defaultToken = 'your_token'
|
|
||||||
|
|
||||||
class Map extends React.Component {
|
class Map extends React.Component {
|
||||||
constructor () {
|
constructor () {
|
||||||
@@ -70,14 +69,17 @@ class Map extends React.Component {
|
|||||||
|
|
||||||
let firstLayer
|
let firstLayer
|
||||||
|
|
||||||
if ((supportedMapboxMap.indexOf(this.props.ui.tiles) !== -1) && process.env.MAPBOX_TOKEN && process.env.MAPBOX_TOKEN !== defaultToken) {
|
// if mapbox token and one of the default maps are specified
|
||||||
|
if ((supportedMapboxMap.indexOf(this.props.ui.tiles) !== -1) && process.env.MAPBOX_TOKEN) {
|
||||||
firstLayer = L.tileLayer(
|
firstLayer = L.tileLayer(
|
||||||
`http://a.tiles.mapbox.com/v4/mapbox.${this.props.ui.tiles}/{z}/{x}/{y}@2x.png?access_token=${process.env.MAPBOX_TOKEN}`
|
`http://a.tiles.mapbox.com/v4/mapbox.${this.props.ui.tiles}/{z}/{x}/{y}@2x.png?access_token=${process.env.MAPBOX_TOKEN}`
|
||||||
)
|
)
|
||||||
} else if (process.env.MAPBOX_TOKEN && process.env.MAPBOX_TOKEN !== defaultToken) {
|
// if mapbox token and custom map
|
||||||
|
} else if (process.env.MAPBOX_TOKEN) {
|
||||||
firstLayer = L.tileLayer(
|
firstLayer = L.tileLayer(
|
||||||
`http://a.tiles.mapbox.com/styles/v1/${this.props.ui.tiles}/tiles/{z}/{x}/{y}?access_token=${process.env.MAPBOX_TOKEN}`
|
`http://a.tiles.mapbox.com/styles/v1/${this.props.ui.tiles}/tiles/{z}/{x}/{y}?access_token=${process.env.MAPBOX_TOKEN}`
|
||||||
)
|
)
|
||||||
|
// no mapbox token
|
||||||
} else {
|
} else {
|
||||||
firstLayer = L.tileLayer(
|
firstLayer = L.tileLayer(
|
||||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
|
||||||
|
|||||||
Reference in New Issue
Block a user