mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
Linting fixes
This commit is contained in:
@@ -259,7 +259,7 @@ class Dashboard extends React.Component {
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<Toolbar
|
||||
isNarrative={!!app.associations.narrative}
|
||||
methods={{
|
||||
@@ -364,7 +364,7 @@ export default connect(
|
||||
...state,
|
||||
narrativeIdx: selectors.selectNarrativeIdx(state),
|
||||
narratives: selectors.selectNarratives(state),
|
||||
selected: selectors.selectSelected(state),
|
||||
selected: selectors.selectSelected(state)
|
||||
}),
|
||||
mapDispatchToProps
|
||||
)(Dashboard)
|
||||
|
||||
@@ -17,12 +17,11 @@ import SelectedEvents from './presentational/Map/SelectedEvents.jsx'
|
||||
import Narratives from './presentational/Map/Narratives'
|
||||
import DefsMarkers from './presentational/Map/DefsMarkers.jsx'
|
||||
|
||||
import { mapClustersToLocations } from '../common/utilities'
|
||||
import { mapClustersToLocations } from '../common/utilities'
|
||||
|
||||
// NB: important constants for map, TODO: make statics
|
||||
const supportedMapboxMap = ['streets', 'satellite']
|
||||
const defaultToken = 'your_token'
|
||||
const clusterId = 'clusters'
|
||||
|
||||
class Map extends React.Component {
|
||||
constructor () {
|
||||
@@ -166,7 +165,7 @@ class Map extends React.Component {
|
||||
return acc
|
||||
}, [])
|
||||
this.index.load(convertedLocations)
|
||||
this.setState({indexLoaded: true})
|
||||
this.setState({ indexLoaded: true })
|
||||
this.update()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
var map = L.map('map').setView([0, 0], 0);
|
||||
|
||||
// Empty Layer Group that will receive the clusters data on the fly.
|
||||
var markers = L.geoJSON(null, {
|
||||
pointToLayer: createClusterIcon
|
||||
}).addTo(map);
|
||||
|
||||
// Update the displayed clusters after user pan / zoom.
|
||||
map.on('moveend', update);
|
||||
|
||||
function update() {
|
||||
// if (!ready) return;
|
||||
var bounds = map.getBounds();
|
||||
var bbox = [bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth()];
|
||||
var zoom = map.getZoom();
|
||||
var clusters = index.getClusters(bbox, zoom);
|
||||
markers.clearLayers();
|
||||
markers.addData(clusters);
|
||||
}
|
||||
|
||||
// Zoom to expand the cluster clicked by user.
|
||||
markers.on('click', function(e) {
|
||||
var clusterId = e.layer.feature.properties.cluster_id;
|
||||
var center = e.latlng;
|
||||
var expansionZoom;
|
||||
if (clusterId) {
|
||||
expansionZoom = index.getClusterExpansionZoom(clusterId);
|
||||
map.flyTo(center, expansionZoom);
|
||||
}
|
||||
});
|
||||
|
||||
// Retrieve Points data.
|
||||
var placesUrl = 'https://cdn.rawgit.com/mapbox/supercluster/v4.0.1/test/fixtures/places.json';
|
||||
var index;
|
||||
var ready = false;
|
||||
|
||||
jQuery.getJSON(placesUrl, function(geojson) {
|
||||
// Initialize the supercluster index.
|
||||
index = supercluster({
|
||||
radius: 60,
|
||||
extent: 256,
|
||||
maxZoom: 18
|
||||
}).load(geojson.features); // Expects an array of Features.
|
||||
|
||||
ready = true;
|
||||
update();
|
||||
});
|
||||
|
||||
function createClusterIcon(feature, latlng) {
|
||||
if (!feature.properties.cluster) return L.marker(latlng);
|
||||
|
||||
var count = feature.properties.point_count;
|
||||
var size =
|
||||
count < 100 ? 'small' :
|
||||
count < 1000 ? 'medium' : 'large';
|
||||
var icon = L.divIcon({
|
||||
html: '<div><span>' + feature.properties.point_count_abbreviated + '</span></div>',
|
||||
className: 'marker-cluster marker-cluster-' + size,
|
||||
iconSize: L.point(40, 40)
|
||||
});
|
||||
|
||||
return L.marker(latlng, {
|
||||
icon: icon
|
||||
});
|
||||
}
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(map);
|
||||
@@ -9,7 +9,7 @@ function ClusterEvents ({
|
||||
onSelect,
|
||||
svg,
|
||||
clusters,
|
||||
numClusters,
|
||||
numClusters
|
||||
}) {
|
||||
function renderClusterBySize (cluster) {
|
||||
const { point_count: pointCount, cluster_id: clusterId } = cluster.properties
|
||||
@@ -20,7 +20,7 @@ function ClusterEvents ({
|
||||
fill: colors.fallbackEventColor,
|
||||
stroke: colors.darkBackground,
|
||||
strokeWidth: 0,
|
||||
fillOpacity: calcOpacity(pointCount),
|
||||
fillOpacity: calcOpacity(pointCount)
|
||||
})
|
||||
|
||||
return (
|
||||
@@ -39,7 +39,6 @@ function ClusterEvents ({
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
function renderCluster (cluster) {
|
||||
/**
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user