mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-13 05:48:36 +03:00
Filter by timerange on selecting Narrative
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
areEqual,
|
||||
isNotNullNorUndefined
|
||||
} from '../data/utilities';
|
||||
} from '../utilities';
|
||||
import hash from 'object-hash';
|
||||
import 'leaflet-polylinedecorator';
|
||||
|
||||
@@ -363,16 +363,19 @@ Stop and start the development process in terminal after you have added your tok
|
||||
.attr('class', 'narrative')
|
||||
.attr('d', sequenceLine)
|
||||
.style('stroke-width', d => {
|
||||
if (!d[0]) return 0;
|
||||
// Note: [0] is a non-elegant way to get the narrative id out of the first
|
||||
// event in the narrative sequence
|
||||
const styleProps = getNarrativeStyle(d[0].narrative);
|
||||
return styleProps.strokeWidth;
|
||||
})
|
||||
.style('stroke-dasharray', d => {
|
||||
if (!d[0]) return 'none';
|
||||
const styleProps = getNarrativeStyle(d[0].narrative);
|
||||
return (styleProps.style === 'dotted') ? "2px 5px" : 'none';
|
||||
})
|
||||
.style('stroke', d => {
|
||||
if (!d[0]) return 'none';
|
||||
const styleProps = getNarrativeStyle(d[0].narrative);
|
||||
return styleProps.stroke;
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import {
|
||||
areEqual
|
||||
} from '../data/utilities';
|
||||
} from '../utilities';
|
||||
import esLocale from '../data/es-MX.json';
|
||||
import copy from '../data/copy.json';
|
||||
|
||||
|
||||
@@ -35,3 +35,17 @@ export function areEqual(arr1, arr2) {
|
||||
export function isNotNullNorUndefined(variable) {
|
||||
return (typeof variable !== 'undefined' && variable !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Date object given a datetime string of the format: "2016-09-10T07:00:00"
|
||||
* @param {string} datetime
|
||||
*/
|
||||
export function parseDate(datetime) {
|
||||
return new Date(datetime.slice(0, 4),
|
||||
datetime.slice(5, 7) - 1,
|
||||
datetime.slice(8, 10),
|
||||
datetime.slice(11, 13),
|
||||
datetime.slice(14, 16),
|
||||
datetime.slice(17, 19)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user