This commit is contained in:
Lachlan Kermode
2020-06-18 10:24:28 +02:00
parent 00105711a8
commit 00a8080eba
11 changed files with 29 additions and 36 deletions

View File

@@ -1,5 +1,3 @@
import { timeFormat, timeParse } from 'd3'
import moment from 'moment'
let { DATE_FMT, TIME_FMT } = process.env

View File

@@ -81,7 +81,7 @@ class Card extends React.Component {
}
// NB: should be internaionalized.
renderTime() {
renderTime () {
let timelabel = this.makeTimelabel(this.props.event.datetime)
let precision = this.props.event.time_display

View File

@@ -139,7 +139,7 @@ class Map extends React.Component {
const pane = this.map.getPanes().overlayPane
const { width, height } = this.getClientDims()
return !!this.map ? (
return this.map ? (
<Portal node={pane}>
<svg
ref={this.svgRef}

View File

@@ -7,7 +7,6 @@ import { setLoading, setNotLoading } from '../actions'
import hash from 'object-hash'
import copy from '../common/data/copy.json'
import { sizes } from '../common/global'
import Header from './presentational/Timeline/Header'
import Axis from './TimelineAxis.jsx'
import Clip from './presentational/Timeline/Clip'
@@ -16,7 +15,6 @@ import ZoomControls from './presentational/Timeline/ZoomControls.js'
import Markers from './presentational/Timeline/Markers.js'
import Events from './presentational/Timeline/Events.js'
import Categories from './TimelineCategories.jsx'
const TIMELINE_AXIS = 0
class Timeline extends React.Component {
constructor (props) {
@@ -70,10 +68,11 @@ class Timeline extends React.Component {
addEventListeners () {
window.addEventListener('resize', () => { this.computeDims() })
let element = document.querySelector('.timeline-wrapper')
if (element !== null)
if (element !== null) {
element.addEventListener('transitionend', (event) => {
this.computeDims()
})
}
}
makeScaleX () {
@@ -277,8 +276,7 @@ class Timeline extends React.Component {
const { features, domain } = this.props
const { USE_CATEGORIES, GRAPH_NONLOCATED } = features
if (!USE_CATEGORIES)
return this.state.dims.trackHeight / 2
if (!USE_CATEGORIES) { return this.state.dims.trackHeight / 2 }
const { category, project } = event
if (GRAPH_NONLOCATED && GRAPH_NONLOCATED.categories.includes(category)) {

View File

@@ -70,7 +70,7 @@ class TimelineAxis extends React.Component {
/>
<g
ref={this.xAxis1Ref}
transform={`translate(0, ${this.props.dims.trackHeight + PADDING - 2*(PADDING / 3)})`}
transform={`translate(0, ${this.props.dims.trackHeight + PADDING - 2 * (PADDING / 3)})`}
clipPath={`url(#clip)`}
className={`axis axisHourText`}
/>

View File

@@ -28,9 +28,9 @@ class TimelineCategories extends React.Component {
const { features, dims } = this.props
const { category } = cat
const strokeWidth = 1 // dims.trackHeight / (this.props.categories.length + 1)
if (features.GRAPH_NONLOCATED
&& features.GRAPH_NONLOCATED.categories
&& features.GRAPH_NONLOCATED.categories.includes(category)) {
if (features.GRAPH_NONLOCATED &&
features.GRAPH_NONLOCATED.categories &&
features.GRAPH_NONLOCATED.categories.includes(category)) {
return null
}

View File

@@ -41,7 +41,6 @@ export default class Search extends React.Component {
filterFilters={this.props.filterFilters}
categoryFilters={this.props.categoryFilters}
filter={this.props.filter}
filter={filter}
isCategory={this.props.isCategory}
/>
)

View File

@@ -10,7 +10,6 @@ export default ({
extraRender
}) => {
const s = r * 2 / 3
const s2 = r * 4 / 3
return (
<polygon
onClick={onSelect}

View File

@@ -1,26 +1,26 @@
import React from 'react'
const TimelineHandles = ({ dims, onMoveTime }) => {
return null
return <div />
// temporarilty disabled while we get functionality working again
return (
<g className='time-controls-inline'>
<g
transform={`translate(${dims.marginLeft - 20}, ${dims.contentHeight - 10})`}
onClick={() => onMoveTime('backwards')}
>
<circle r='15' />
<path d='M0,-7.847549217020565L6.796176979388489,3.9237746085102825L-6.796176979388489,3.9237746085102825Z' transform='rotate(270)' />
</g>
<g
transform={`translate(${dims.width - dims.width_controls + 20}, ${dims.contentHeight - 10})`}
onClick={() => onMoveTime('forward')}
>
<circle r='15' />
<path d='M0,-7.847549217020565L6.796176979388489,3.9237746085102825L-6.796176979388489,3.9237746085102825Z' transform='rotate(90)' />
</g>
</g>
)
// return (
// <g className='time-controls-inline'>
// <g
// transform={`translate(${dims.marginLeft - 20}, ${dims.contentHeight - 10})`}
// onClick={() => onMoveTime('backwards')}
// >
// <circle r='15' />
// <path d='M0,-7.847549217020565L6.796176979388489,3.9237746085102825L-6.796176979388489,3.9237746085102825Z' transform='rotate(270)' />
// </g>
// <g
// transform={`translate(${dims.width - dims.width_controls + 20}, ${dims.contentHeight - 10})`}
// onClick={() => onMoveTime('forward')}
// >
// <circle r='15' />
// <path d='M0,-7.847549217020565L6.796176979388489,3.9237746085102825L-6.796176979388489,3.9237746085102825Z' transform='rotate(90)' />
// </g>
// </g>
// )
}
export default TimelineHandles

View File

@@ -1,5 +1,5 @@
import React from 'react'
import colors, { sizes } from '../../../common/global'
import colors from '../../../common/global'
const TimelineMarkers = ({
styles,

View File

@@ -1,7 +1,6 @@
import { createSelector } from 'reselect'
import { insetSourceFrom, dateMin, dateMax } from '../common/utilities'
import { isTimeRangedIn } from './helpers'
import { sizes } from '../common/global'
// Input selectors
export const getEvents = state => state.domain.events