Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add component shell structure with some existing dom structure in place for guidance

Edward Plato5b80107ef03d
diff --git a/web/js/components/timeline/VisTimeline.css b/web/js/components/timeline/VisTimeline.css
deleted file mode 100644
index d2c7a6825..000000000
--- a/web/js/components/timeline/VisTimeline.css
+++ /dev/null
@@ -1,61 +0,0 @@
-.vis-timeline {
- border: 2px solid purple;
- font-family: 'Arial', 'Helvetica', sans-serif;
- font-size: 12px;
- background: #000000c4;
-}
-
-.vis-time-axis .vis-text {
- color: #fff;
-}
-
-/* can be used as end? */
-.vis-current-time {
-}
-
-.timelineDragger {
- z-index: 5 !important;
-}
-
-#tf > div > div.vis-panel.vis-background.vis-vertical > div.vis-custom-time.timelineDragger > div {
- left: -29px !important;
- width: 60px !important;
- content: url("data:image/svg+xml;charset=UTF-8, <svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='100' width='100'><clipPath id='timelineDragger'><polygon points='50,15, 100,100, 0,100' /></clipPath><g><polygon fill='#ccc' stroke='#515151' points='50,15, 100,100, 0,100' /><rect width='6' height='30' x='35' y='60' fill='#515151' /><rect width='6' height='30' x='47' y='60' fill='#515151' /><rect width='6' height='30' x='59' y='60' fill='#515151' /></g></svg>");
-
- clip-path: url("#timelineDragger");
- -webkit-clip-path: polygon(50% 15%, 100% 100%, 0% 100%);
-}
-
-.timelineHover {
-}
-
-.timelineHover > div {
- left: 0;
- width: 2px;
-}
-
-#newTimeline {
- /* margin-top: 250px; */
-}
-
-.vis-panel.vis-center {
- border: none;
-}
-
-.vis-time-axis .vis-grid.vis-minor {
- border-width: 2px;
-}
-
-.vis-time-axis.vis-background {
- /* height: 10px; */
-}
-
-.vis-panel.vis-bottom {
- border-left: none;
- border-right: none;
-}
-
-#guitarpickX {
- width: 100px;
- user-select: none;
-}
\ No newline at end of file
diff --git a/web/js/components/timeline/appJSDOMbreakdown.txt b/web/js/components/timeline/appJSDOMbreakdown.txt
new file mode 100644
index 000000000..64f61ca43
--- /dev/null
+++ b/web/js/components/timeline/appJSDOMbreakdown.txt
@@ -0,0 +1,100 @@
+//? TIMELINE CONTAINER
+ <section
+ id="timeline"
+ className="timeline-inner clearfix"
+ style={{ display: 'none' }}
+ >
+ //? LEFT PANEL (DATE SELECTOR, ZOOM BUTTONS, ANIMATION BUTTON)
+ <div id="timeline-header">
+ //? DATE SELECTOR
+ <div id="date-selector-main" />
+ //? LEFT/RIGHT ARROWS / TIMESCALE ZOOM CHANGE
+ <div id="zoom-buttons-group">
+ //? TIMESCALE ZOOM CHANGE
+ <div id="zoom-btn-container">
+ <span
+ id="current-zoom"
+ className="zoom-btn zoom-btn-active"
+ data-zoom="3"
+ >
+ Days
+ </span>
+ <div className="wv-tooltip">
+ <div id="timeline-zoom" className="timeline-zoom">
+ <span
+ id="zoom-years"
+ className="zoom-btn zoom-btn-inactive zoom-years"
+ data-zoom="1"
+ >
+ Years
+ </span>
+ <span
+ id="zoom-months"
+ className="zoom-btn zoom-btn-inactive zoom-months"
+ data-zoom="2"
+ >
+ Months
+ </span>
+ <span
+ id="zoom-days"
+ className="zoom-btn zoom-btn-inactive zoom-days"
+ data-zoom="3"
+ >
+ Days
+ </span>
+ <span
+ id="zoom-minutes"
+ className="zoom-btn zoom-btn-inactive zoom-minutes"
+ data-zoom="4"
+ >
+ Minutes
+ </span>
+ </div>
+ </div>
+ </div>
+ //? LEFT/RIGHT ARROWS
+ <div
+ className="button-action-group"
+ id="left-arrow-group"
+ title="Click and hold to animate backwards"
+ >
+ <svg id="timeline-svg" width="24" height="30">
+ <path
+ d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
+ className="arrow"
+ />
+ </svg>
+ </div>
+ <div
+ className="button-action-group"
+ id="right-arrow-group"
+ title="Click and hold to animate forwards"
+ >
+ <svg width="24" height="30">
+ <path
+ d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
+ className="arrow"
+ />
+ </svg>
+ </div>
+ </div>
+ //? ANIMATION BUTTON
+ <div
+ className="button-action-group animate-button"
+ id="animate-button"
+ title="Set up animation"
+ >
+ <i id="wv-animate" className="fas fa-video wv-animate" />
+ </div>
+ </div>
+ //? TIMELINE AXIS (CONTAINS DRAGGERS, RANGE SELECTION)
+ <div id="timeline-footer">
+ <div id="wv-animation-widet-case"> </div>
+ </div>
+ //? VERY RIGHT WITH HAMBURGER (AND GLORIOUS TODAY BUTTON)
+ <div id="timeline-hide">
+ <svg className="hamburger" width="10" height="9">
+ <path d="M 0,0 0,1 10,1 10,0 0,0 z M 0,4 0,5 10,5 10,4 0,4 z M 0,8 0,9 10,9 10,8 0,8 z" />
+ </svg>
+ </div>
+ </section>
\ No newline at end of file
diff --git a/web/js/components/timeline/grid-range.js b/web/js/components/timeline/grid-range.js
index abc3fa977..b6607efbe 100644
--- a/web/js/components/timeline/grid-range.js
+++ b/web/js/components/timeline/grid-range.js
@@ -63,15 +63,15 @@ class GridRange extends PureComponent {
const tileTextConditionOptions = {
minute: (itemDateObject) => {
let timeScaleUnit = itemDateObject.minutes;
- return timeScaleUnit === 0 ||
- timeScaleUnit === 15 ||
+ return timeScaleUnit === 0 ||
+ timeScaleUnit === 15 ||
timeScaleUnit === 30 ||
timeScaleUnit === 45;
},
hour: (itemDateObject) => {
let timeScaleUnit = itemDateObject.hours;
- return timeScaleUnit === 0 ||
- timeScaleUnit === 6 ||
+ return timeScaleUnit === 0 ||
+ timeScaleUnit === 6 ||
timeScaleUnit === 12 ||
timeScaleUnit === 18;
},
@@ -127,8 +127,8 @@ class TileHolder extends PureComponent {
const axisScaleGridElement = {
minute: (gridWidth, index, item) => {
let timeScaleUnit = item.dateObject.minutes;
- let lineLengthY = timeScaleUnit === 0 ||
- timeScaleUnit === 15 ||
+ let lineLengthY = timeScaleUnit === 0 ||
+ timeScaleUnit === 15 ||
timeScaleUnit === 30 ||
timeScaleUnit === 45 ? 58 : timeScaleUnit % 5 === 0 ? 20 : 10;
return (
@@ -141,8 +141,8 @@ const axisScaleGridElement = {
},
hour: (gridWidth, index, item) => {
let timeScaleUnit = item.dateObject.hours;
- let lineLengthY = timeScaleUnit === 0 ? 58 :
- timeScaleUnit === 6 ||
+ let lineLengthY = timeScaleUnit === 0 ? 58 :
+ timeScaleUnit === 6 ||
timeScaleUnit === 12 ||
timeScaleUnit === 18 ? 22 : 10;
// let lineLengthY = timeScaleUnit === 0 ? 58 : timeScaleUnit === 12 ? 22 : 10;
diff --git a/web/js/components/timeline/tester.js b/web/js/components/timeline/tester.js
deleted file mode 100644
index e6083d85d..000000000
--- a/web/js/components/timeline/tester.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import React, { Component, createRef } from 'react'
-// import ReactDOM from 'react-dom'
-import { FixedSizeList as List } from 'react-window'
-import { decay, listen, pointer, transform, value } from 'popmotion'
-
-// import './styles.css'
-
-class VirtualList extends Component {
- itemCount = 1000
- itemSize = 35
- scrollOffsetInitial = 0
- listX = value(0, value => {
- if (this.list) {
- this.list.scrollTo(value)
- this.scrollOffsetInitial = value
- }
- })
- clampMovement = transform.clamp(
- 0,
- this.itemCount * this.itemSize - window.innerWidth,
- )
-
- componentDidMount() {
- listen(document, 'mousedown').start(() => {
- pointer({ x: -this.scrollOffsetInitial })
- .pipe(
- ({ x }) => -x,
- this.clampMovement,
- )
- .start(this.listX)
- })
- listen(document, 'mouseup').start(() => {
- decay({
- from: this.listX.get(),
- velocity: this.listX.getVelocity(),
- })
- .pipe(this.clampMovement)
- .start(this.listX)
- })
- }
-
- handleListRef = component => {
- this.list = component
- }
-
- handleScroll = ({ scrollOffset, scrollUpdateWasRequested }) => {
- if (!scrollUpdateWasRequested) {
- this.scrollOffsetInitial = scrollOffset
- }
- }
-
- render() {
- return (
- <List
- direction="horizontal"
- ref={this.handleListRef}
- onScroll={this.handleScroll}
- itemCount={this.itemCount}
- itemSize={this.itemSize}
- width={window.innerWidth}
- height={50}
- >
- {({ index, style }) => <div style={style}>{index}</div>}
- </List>
- )
- }
-}
-
-export default VirtualList;
\ No newline at end of file
diff --git a/web/js/components/timeline/timeline-axis.js b/web/js/components/timeline/timeline-axis.js
index 1e143001f..8d8211a46 100644
--- a/web/js/components/timeline/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis.js
@@ -18,7 +18,7 @@ import GridRange from './grid-range';
//! CONCERNS: #################################################################################################################################
//! hover over & show time - how to handle too fast/too slow date updates - debounce? real time is an ugly blur, too slow would defeat the purpose ?
//! what kind of realistic time scaling should i expect, is hovering over the first pixel of a year and getting Jan 5th 5:30am all right?
-//!
+//!
const timeScales = [ 'minute', 'hour', 'day', 'month', 'year' ];
@@ -49,7 +49,7 @@ const timeScaleOptions = {
timeAxis: {
scale: 'month',
gridWidth: 12,
- scaleMs: null //# null set to require a
+ scaleMs: null //# null set to require a
// scaleMs: 2678400000
}
},
@@ -137,11 +137,11 @@ class TimelineAxis extends Component {
//# taken from older, working commit - current version being used, but may need to still handle floating point issues
let midPoint = -((gridWidth * gridNumber) / 2) + ((numberOfVisibleTiles / 2) * gridWidth);
// midPoint = midPointWorkingCommit
-
- //# this causing offset issue, but "fixes" floating point
+
+ //# this causing offset issue, but "fixes" floating point
// let midPoint = +(-(+((gridWidth * +(numberOfVisibleTiles * 1.5).toFixed(10)) / 2).toFixed(10)) + +(+(numberOfVisibleTiles / 2).toFixed(10) * gridWidth).toFixed(10)).toFixed(10); //# CAN'T FLOOR numberOfVisibleTiles / 2
//# -0.5(12 * 1.5numberOfVisibleTiles) + 0.5numberOfVisibleTiles * 12
-
+
// let mockPropsSelectedDate = '1941-01-01';
// console.log(hoverTime, draggerDateActual, hoverTime)
let hoverTime = moment.utc(this.state.hoverTime);
@@ -173,7 +173,7 @@ class TimelineAxis extends Component {
hoverTimeNextZero = hoverTimeZero.clone().add(1, timeScale);
}
- console.log(hoverTime.format(), hoverTimeZero.format(), hoverTimeNextZero.format())
+ // console.log(hoverTime.format(), hoverTimeZero.format(), hoverTimeNextZero.format())
// value of hover time, hover time timeunit zeroed, hover time next unit timeunit zeroed
let hoverTimeValue = hoverTime.valueOf();
@@ -185,7 +185,7 @@ class TimelineAxis extends Component {
let diffStartAndZeroed = hoverTimeValue - hoverTimeZeroValue;
let pixelsToAdd = diffStartAndZeroed / diffFactor;
- console.log(pixelsToAdd)
+ // console.log(pixelsToAdd)
// console.log(hoverTime, hoverTime.format(), pixelsToAdd);
// console.log(Math.floor(leftOffset / gridWidth));
@@ -195,7 +195,7 @@ class TimelineAxis extends Component {
//! additional offset needed for midPoint and/or position
let offSetGrids = Math.floor(leftOffset / gridWidth);
- console.log(Math.floor(gridNumber/2), offSetGrids, gridNumber/2)
+ // console.log(Math.floor(gridNumber/2), offSetGrids, gridNumber/2)
//# MOST EXPENSIVE FUNCTION!!!! Greater the gridNumber === longer. 960 els ~23ms vs 100 at 3.5ms)
let current = this.getDateArray(Math.floor(gridNumber/2), Math.floor(gridNumber/2), timeScale, hoverTime);
// console.log(current)
@@ -205,7 +205,7 @@ class TimelineAxis extends Component {
//# get front and back dates
let frontDate = moment.utc(deque.peekFront().rawDate);
let backDate = moment.utc(deque.peekBack().rawDate);
- console.log(frontDate.format())
+ // console.log(frontDate.format())
// check if dragger date is between front/back dates, null set to ignore granularity (go to ms), [] for inclusive of front/back dates
let isBetween = draggerDateActual.isBetween(frontDate, backDate, null, '[]');
// let pixelsToAddToDragger = 0;
@@ -214,7 +214,7 @@ class TimelineAxis extends Component {
if (isBetween) {
// let frontDateValue = moment.utc(frontDate.rawDate).valueOf(); // ZERO
// let draggerPositionFromFront = draggerDateActualValue - frontDateValue;
-
+
// pixelsToAddToDragger = Math.abs(frontDate.diff(draggerDateActual, timeScale, true) * gridWidth);
draggerPosition = Math.abs(frontDate.diff(draggerDateActual, timeScale, true) * gridWidth);
draggerVisible = true;
@@ -245,8 +245,8 @@ class TimelineAxis extends Component {
position += gridWidth/2;
}
let position2 = midPoint - (axisWidth / 2 - leftOffset);
- console.log(position, position2)
- console.log(midPoint, position, (axisWidth / 2 - leftOffset), axisWidth / 2, leftOffset)
+ // console.log(position, position2)
+ // console.log(midPoint, position, (axisWidth / 2 - leftOffset), axisWidth / 2, leftOffset)
}
// console.log(pixelsToAddToDragger, midPoint, (axisWidth / 2 - leftOffset), pixelsToAdd, position)
@@ -257,21 +257,17 @@ class TimelineAxis extends Component {
let currentTransformX = 0;
//? this.addLine(...) added as a callback in this.setState due to relying on changed timescale/grid state
//? can change later if passing more arguments is more performant or required due to asynchronous behavior of setState
- console.log(midPoint, position, pixelsToAdd, leftOffset);
+ // console.log(midPoint, position, pixelsToAdd, leftOffset);
// console.log(draggerPosition - pixelsToAdd + position - 49)
// console.log(draggerPositionB - pixelsToAdd + position - 49)
this.setState({
- // draggerPosition: draggerPosition + draggerPixelsToAdd,
- // draggerPosition: pixelsToAddToDragger + position - pixelsToAdd - 49,
- // draggerPosition: gridWidth - 49,
draggerPosition: draggerPosition - pixelsToAdd + position - 49,
draggerVisible: draggerVisible,
draggerPositionB: draggerPositionB - pixelsToAdd + position - 49,
draggerVisibleB: draggerVisibleB,
deque: deque,
currentDateRange: current.dates,
- // currentDate: moment.utc().subtract(12, timeScale),
currentTransformX: currentTransformX,
gridNumber: gridNumber,
gridWidth: gridWidth,
@@ -279,14 +275,9 @@ class TimelineAxis extends Component {
moved: false,
timeScaleChange: true,
dragSentinelChangeNumber: dragSentinelChangeNumber,
- // }, function() {
- // this.setState({
- // position: position - pixelsToAdd - 1, //# NEED TO CLEAN UP LOGIC/VARIABLE NAMES, why - 1 pixel off?
- position: position - pixelsToAdd, //# above 1 pixel off was making handleStopDrag have d.x & midPoint inequality,
- //# requiring a double click to move dragger after updateScale timeScale change
- midPoint: position,
- dragSentinelCount: 0
- // })
+ position: position - pixelsToAdd,
+ midPoint: position,
+ dragSentinelCount: 0
})
}
@@ -522,7 +513,7 @@ class TimelineAxis extends Component {
draggerPositionRevision: draggerPositionRevision
}
}
-
+
// deque extension to pop NUM times
removeBackMultipleInPlace = (deque, num) => {
for (let i = 0; i < num; i++) {
@@ -535,7 +526,7 @@ class TimelineAxis extends Component {
deque.shift();
}
}
-
+
// return array of days based on:
// subtract - integer (negative numbers selects start date in the future)
// add - integer (negative numbers selects end date in the past)
@@ -561,16 +552,16 @@ class TimelineAxis extends Component {
}
startDate = dayZeroed.clone().subtract(subtract, timeScale);
endDate = dayZeroed.clone().add(add, timeScale);
- }
+ }
// console.log(inputDate, dayZeroed.format(), startDate.format(), endDate.format(), subtract, add)
dateArray = dateCalc.getTimeRange(startDate, endDate, timeScale);
// console.log(dateArray)
return dateArray;
}
-
+
// Called when AXIS dragging starts. If `false` is returned any handler,
- // the action will cancel.
+ // the action will cancel.
// handleStartDrag = () => {
// this.setState({
// dragging: !this.state.dragging
@@ -587,7 +578,7 @@ class TimelineAxis extends Component {
// set temp place holder for where hover line was when clicked to check for drag vs click
setLineClick = () => {
// console.log('hit', this.state.hoverTime)
- this.setState({
+ this.setState({
// draggerTimeState: this.state.hoverTime,
redLineClick: this.state.leftOffset,
})
@@ -631,7 +622,6 @@ class TimelineAxis extends Component {
handleResize = (e) => {
// let axisWidth = Math.floor(window.innerWidth * 0.9);
let axisWidth = this.props.width;
- console.log(axisWidth)
let timeScale = this.state.timeScale;
this.updateScale(timeScale, axisWidth);
console.log('resize')
@@ -639,7 +629,7 @@ class TimelineAxis extends Component {
axisWidth: axisWidth
}, function() {
let parentBoundingClientRect = document.querySelector('#wv-timeline-axis').getBoundingClientRect();
- this.setState({
+ this.setState({
parentBoundingClientRectLeft: parentBoundingClientRect.left
});
})
@@ -650,7 +640,6 @@ class TimelineAxis extends Component {
window.addEventListener("resize", this.handleResize);
// let axisWidth = Number((window.innerWidth * 0.9).toFixed(2));
let axisWidth = this.props.width;
- console.log(axisWidth)
let timeScale = this.props.timeScale; // 'day'
let time = moment.utc(this.props.selectedDate).format() //'1941-01-01T12:00:00Z';
@@ -669,7 +658,7 @@ class TimelineAxis extends Component {
let numberOfVisibleTiles = Number((axisWidth / gridWidth).toFixed(8));
// let tilesTillSelectedDAte = Math.floor(numberOfVisibleTiles / 2);
// let draggerPosition = Number(((axisWidth / 2) - 50).toFixed(8));
-
+
// let draggerPosition = tilesTillSelectedDAte * gridWidth - 49; //# CENTER DRAGGER A
let draggerVisible = true;
@@ -688,14 +677,11 @@ class TimelineAxis extends Component {
// console.log(dragSentinelChangeNumber)
//# get midPoint for position based on # of tiles and gridWidth
//# 120 test case - this.getDateArray(60, 60, timeScale, selectedDate);
- let midPointOLD = -((gridWidth * (numberOfVisibleTiles * 1.5)) / 2) + (numberOfVisibleTiles / 2 * gridWidth);
-
- let midPoint = +(-(+((gridWidth * +(numberOfVisibleTiles * 1.5).toFixed(10)) / 2).toFixed(10)) + +(+(numberOfVisibleTiles / 2).toFixed(10) * gridWidth).toFixed(10)).toFixed(10); //# CAN'T FLOOR numberOfVisibleTiles / 2
+ // let midPointOLD = -((gridWidth * (numberOfVisibleTiles * 1.5)) / 2) + (numberOfVisibleTiles / 2 * gridWidth);
+ // let midPoint = +(-(+((gridWidth * +(numberOfVisibleTiles * 1.5).toFixed(10)) / 2).toFixed(10)) + +(+(numberOfVisibleTiles / 2).toFixed(10) * gridWidth).toFixed(10)).toFixed(10); //# CAN'T FLOOR numberOfVisibleTiles / 2
- let midPointWorkingCommit = -((gridWidth * gridNumber) / 2) + (numberOfVisibleTiles / 2 * gridWidth);
- midPoint = midPointWorkingCommit
+ let midPoint = -((gridWidth * gridNumber) / 2) + (numberOfVisibleTiles / 2 * gridWidth);
- console.log(midPointWorkingCommit, midPointOLD, midPoint)
let draggerTime = moment.utc(time);
let draggerTimeZero = moment.utc(time).startOf(timeScale)
let draggerTimeNextZero = moment.utc(draggerTime).startOf(timeScale).add(1, timeScale);
@@ -763,7 +749,7 @@ class TimelineAxis extends Component {
// if (this.state.timeScale !== nextState.timeScale) {
// console.log('update')
// return true;
- // }
+ // }
// return false;
return true;
}
@@ -777,13 +763,13 @@ class TimelineAxis extends Component {
// console.log(propsSelectedDate, stateSelectedDate)
if (this.state.timeScale !== prevState.timeScale) {
this.updateScale(this.state.timeScale);
- }
+ }
if (this.props.width !== prevProps.width) {
this.handleResize();
}
-
-
+
+
// else if (propsSelectedDate !== stateSelectedDate) {
// this.setState({
// selectedDate: propsSelectedDate,
@@ -913,20 +899,20 @@ class TimelineAxis extends Component {
// console.log(draggerPosition, time)
// update draggerTimeState based on deltaX from state draggerTimeState
// TODO: test consistency throught timescales, currently seems off 0.5 on ocassion
- let draggerTime = moment.utc(time);
+ let draggerTime = moment.utc(time);
let draggerTimeZero = draggerTime.clone().startOf(timeScale);
let draggerTimeNextZero = draggerTimeZero.clone().add(1, timeScale);
let draggerTimeValue = draggerTime.valueOf();
let draggerTimeZeroValue = draggerTimeZero.valueOf();
let draggerTimeNextZeroValue = draggerTimeNextZero.valueOf();
-
+
let diffZeroValues = draggerTimeNextZeroValue - draggerTimeZeroValue;
let diffFactor = diffZeroValues / gridWidth;
let newDraggerTime = moment.utc(draggerTimeValue + (diffFactor * deltaX)).format();
// handle drag timeline
- // TODO: updatePanel
+ // TODO: updatePanel
if (draggerPosition < -49) { // handle drag timeline towards PAST
this.setState({
draggerPosition: -48,
@@ -1015,7 +1001,7 @@ class TimelineAxis extends Component {
let backDate = moment.utc(this.state.deque.peekBack().rawDate);
let draggerTimeStateB = moment.utc(this.state.draggerTimeStateB, 'YYYY-MM-DDTHH:mm:ss.SSSZ');
let isBetween = draggerTimeStateB.isBetween(frontDate, backDate, null, '[]');
-
+
let draggerVisibleB = isBetween ? true : false;
this.setState({
compareMode: !this.state.compareMode,
@@ -1087,7 +1073,7 @@ class TimelineAxis extends Component {
</clipPath>
</defs>
<Draggable
- axis="x"
+ axis="x"
onDrag={this.handleDrag.bind(this)}
position={{ x: this.state.position, y: 0 }}
// onStart={this.handleStartDrag.bind(this)}
@@ -1111,7 +1097,7 @@ class TimelineAxis extends Component {
draggerName='A'
draggerPosition={this.state.draggerPosition}
draggerVisible={this.state.draggerVisible}
- transformX={this.state.currentTransformX}
+ transformX={this.state.currentTransformX}
draggerSelected={this.state.draggerSelected}
parentPosition={this.state.position} />
<Dragger
@@ -1121,7 +1107,7 @@ class TimelineAxis extends Component {
draggerName='B'
draggerPosition={this.state.draggerPositionB}
draggerVisible={this.state.compareMode ? this.state.draggerVisibleB : false}
- transformX={this.state.currentTransformX}
+ transformX={this.state.currentTransformX}
draggerSelected={this.state.draggerSelectedB}
parentPosition={this.state.position} />
</svg>
@@ -1161,7 +1147,7 @@ class Dragger extends PureComponent {
let { transformX, draggerPosition, draggerName, handleDragDragger, selectDragger, compareOn } = this.props;
return (
<Draggable
- axis="x"
+ axis="x"
onMouseDown={() => selectDragger(draggerName)}
onDrag={handleDragDragger.bind(this, draggerName)}
position={{ x: draggerPosition, y: -25 }}
@@ -1173,7 +1159,7 @@ class Dragger extends PureComponent {
>
<g style={{cursor: 'pointer', display: this.props.draggerVisible ? 'flex' : 'none'}} className="gridShell dragger" transform={`translate(${transformX}, 0)`}>
<polygon fill='#ccc' stroke={this.props.draggerSelected ? 'yellow' : '#515151'} strokeWidth='2px' points='50,25, 90,90, 10,90'></polygon>
- {compareOn ?
+ {compareOn ?
<text fontSize='30px' fontWeight='700' x='0' y='65' fill='#515151' transform={`translate(39, 10)`} textRendering='optimizeLegibility' clipPath='url(#textDisplay)'>{draggerName}</text>
:
<React.Fragment>
diff --git a/web/js/components/timeline/timeline-axis/grid-range/grid-range.js b/web/js/components/timeline/timeline-axis/grid-range/grid-range.js
new file mode 100644
index 000000000..21a0f7d14
--- /dev/null
+++ b/web/js/components/timeline/timeline-axis/grid-range/grid-range.js
@@ -0,0 +1,130 @@
+import React, { PureComponent } from 'react';
+import moment from 'moment';
+
+import TileRect from './tile-rect';
+import TileText from './tile-text';
+
+//# PureComponent performs a shallow comparison of props and state - may not need shouldComponentUpdate
+class GridRange extends PureComponent {
+// constructor(props) {
+// super(props);
+// this.state= {
+// hoverLinePosition: 0
+// }
+// }
+
+ showHover = (e, itemDate, nextDate, index) => {
+ e.preventDefault();
+ e.stopPropagation();
+ e.persist();
+ // let target = e.target;
+ // let clientX = e.clientX;
+ // let boundingClientRect = target.getBoundingClientRect();
+ // //! IE11 doesn't like boundingClientRect.x
+ // let xHoverPositionInCurrentGrid = Math.floor(clientX) - Math.floor(boundingClientRect.left);
+ requestAnimationFrame(() => {
+ let target = e.target;
+ let clientX = e.clientX;
+ let boundingClientRect = target.getBoundingClientRect();
+ //! IE11 doesn't like boundingClientRect.x
+ let xHoverPositionInCurrentGrid = Math.floor(clientX) - Math.floor(boundingClientRect.left);
+
+ let gridWidth = this.props.gridWidth;
+ // let boundingClientRect = e.target.getBoundingClientRect();
+ // //! IE11 doesn't like boundingClientRect.x
+ // let xHoverPositionInCurrentGrid = Math.floor(e.clientX) - Math.floor(boundingClientRect.left);
+
+ let currentDateValue = moment.utc(itemDate).valueOf();
+ let nextDateValue = moment.utc(nextDate).valueOf();
+ let diff = nextDateValue - currentDateValue;
+ let diffFactor = diff / gridWidth; // gridWidth
+ let displayDate = moment.utc(currentDateValue + (xHoverPositionInCurrentGrid * diffFactor)).format();
+ this.props.displayDate(displayDate, clientX);
+ // this.setState({
+ // hoverLinePosition: index * gridWidth + xHoverPositionInCurrentGrid
+ // })
+ })
+ }
+
+ componentDidUpdate(prevProps, prevState) {
+ //# Dragger changes are tied too close to this.props.transformX since add/minus click dragger and this updates
+ //# decouple
+ // console.log('GridRange update', prevProps, prevState)
+ }
+
+ render() {
+ let gridWidth = this.props.gridWidth;
+ return (
+ <g className="gridShell" transform={`translate(${this.props.transformX}, 0)`}>
+ <TileHolder dateArray={this.props.dateArray} gridWidth={gridWidth} showHover={this.showHover} timeScale={this.props.timeScale} />
+ {/* <line className="svgLine" stroke="blue" strokeWidth="2" strokeOpacity="0.48" x1="0" x2="0" y1="0" y2="90" transform={`translate(${this.state.hoverLinePosition + 2}, 0)`} shapeRendering="optimizeSpeed"/> */}
+ </g>
+ )
+ }
+}
+
+const tileTextConditionOptions = {
+ minute: (itemDateObject) => {
+ let timeScaleUnit = itemDateObject.minutes;
+ return timeScaleUnit === 0 ||
+ timeScaleUnit === 15 ||
+ timeScaleUnit === 30 ||
+ timeScaleUnit === 45;
+ },
+ hour: (itemDateObject) => {
+ let timeScaleUnit = itemDateObject.hours;
+ return timeScaleUnit === 0 ||
+ timeScaleUnit === 6 ||
+ timeScaleUnit === 12 ||
+ timeScaleUnit === 18;
+ },
+ day: (itemDateObject) => {
+ let timeScaleUnit = itemDateObject.date;
+ return timeScaleUnit === 1;
+ },
+ month: (itemDateObject) => {
+ let timeScaleUnit = itemDateObject.months;
+ return timeScaleUnit === 0;
+ },
+ year: (itemDateObject) => {
+ let timeScaleUnit = itemDateObject.years;
+ return timeScaleUnit % 10 === 0;
+ }
+}
+
+class TileHolder extends PureComponent {
+ render() {
+ let timeScale = this.props.timeScale;
+ let tileTextCondition = tileTextConditionOptions[timeScale];
+ let midTile = Math.floor(this.props.dateArray.length / 2);
+ return (
+ <React.Fragment>
+ {this.props.dateArray.map((item, index) => {
+ return (
+ item.withinRange ?
+ <React.Fragment key={index}>
+ <TileRect
+ item={item}
+ index={index}
+ gridWidth={this.props.gridWidth}
+ showHover={this.props.showHover}
+ midTile={midTile === index ? true : false}
+ />
+ {tileTextCondition(item.dateObject) ?
+ <TileText
+ item={item}
+ index={index}
+ gridWidth={this.props.gridWidth}
+ />
+ : null }
+ </React.Fragment>
+ : null
+ )
+ }
+ )}
+ </React.Fragment>
+ )
+ }
+}
+
+export default GridRange;
\ No newline at end of file
diff --git a/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js b/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js
new file mode 100644
index 000000000..29b9c7281
--- /dev/null
+++ b/web/js/components/timeline/timeline-axis/grid-range/tile-rect.js
@@ -0,0 +1,94 @@
+import React, { PureComponent } from 'react';
+
+const axisScaleGridElement = {
+ minute: (gridWidth, index, item) => {
+ let timeScaleUnit = item.dateObject.minutes;
+ let lineLengthY = timeScaleUnit === 0 ||
+ timeScaleUnit === 15 ||
+ timeScaleUnit === 30 ||
+ timeScaleUnit === 45 ? 58 : timeScaleUnit % 5 === 0 ? 20 : 10;
+ return (
+ <React.Fragment>
+ <rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect>
+ <line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />
+ <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />
+ </React.Fragment>
+ )
+ },
+ hour: (gridWidth, index, item) => {
+ let timeScaleUnit = item.dateObject.hours;
+ let lineLengthY = timeScaleUnit === 0 ? 58 :
+ timeScaleUnit === 6 ||
+ timeScaleUnit === 12 ||
+ timeScaleUnit === 18 ? 22 : 10;
+ // let lineLengthY = timeScaleUnit === 0 ? 58 : timeScaleUnit === 12 ? 22 : 10;
+ return (
+ <React.Fragment>
+ <rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect>
+ <line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />
+ <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />
+ </React.Fragment>
+ )
+ },
+ day: (gridWidth, index, item, midTile) => {
+ let dayOfWeek = item.dayOfWeek;
+ let lineLengthY = item.dateObject.date === 1 ? 58 : dayOfWeek === 0 ? 22 : 10;
+ return (
+ <React.Fragment>
+ {/* <rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect> */}
+ <rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={midTile ? 'yellow' : 'rgba(0,0,0,0)'} shapeRendering="optimizeSpeed"></rect>
+ <line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />
+ <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />
+ </React.Fragment>
+ )
+ },
+ month: (gridWidth, index, item) => {
+ let timeScaleUnit = item.dateObject.months;
+ let lineLengthY = timeScaleUnit === 0 ? 58 : timeScaleUnit % 3 === 0 ? 22 : 10;
+ return (
+ <React.Fragment>
+ <rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect>
+ <line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />
+ <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />
+ </React.Fragment>
+ )
+ },
+ year: (gridWidth, index, item) => {
+ let timeScaleUnit = item.dateObject.years;
+ let lineLengthY = timeScaleUnit % 10 === 0 ? 58 : timeScaleUnit % 5 === 0 ? 22 : 10;
+ return (
+ <React.Fragment>
+ <rect className="grid" width={gridWidth} height={100} transform={`translate(${index * gridWidth}, 0)`} fill={item.withinRange ? 'rgba(0,0,0,0)' : 'black'} shapeRendering="optimizeSpeed"></rect>
+ <line stroke="black" strokeLinecap="round" strokeWidth="0.2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 2.2}, 0)`} />
+ <line stroke="white" strokeLinecap="round" strokeWidth="2" x1="0" x2="0" y1="0" y2={lineLengthY} transform={`translate(${index * gridWidth + 1}, 0)`} />
+ </React.Fragment>
+ )
+ },
+}
+
+class TileRect extends PureComponent {
+ // componentDidUpdate() {
+ // console.log('TileRect update')
+ // }
+ render() {
+ let { item, gridWidth, index, midTile, showHover } = this.props;
+ // console.log(item.dateObject)
+ return (
+ <React.Fragment>
+ <g onMouseMove={(e) => showHover(e, item.rawDate, item.rawNextDate, index)}>
+ { axisScaleGridElement[item.timeScale](gridWidth, index, item, midTile) }
+ </g>
+ </React.Fragment>
+ )
+ }
+}
+
+
+// FUNCTIONAL COMPONENT VERSION OF ABOVE - less code in compile
+// const TileText = ({ item, gridWidth, index }) => {
+// return (
+// axisScaleTextElement[item.timeScale](gridWidth, index, item)
+// )
+// }
+
+export default TileRect;
\ No newline at end of file
diff --git a/web/js/components/timeline/timeline-axis/grid-range/tile-text.js b/web/js/components/timeline/timeline-axis/grid-range/tile-text.js
new file mode 100644
index 000000000..22f9ff1fd
--- /dev/null
+++ b/web/js/components/timeline/timeline-axis/grid-range/tile-text.js
@@ -0,0 +1,78 @@
+import React, { PureComponent } from 'react';
+
+const axisScaleTextElement = {
+ minute: (gridWidth, index, item) => {
+ return (
+ <React.Fragment>
+ <g>
+ <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>
+ </g>
+ </React.Fragment>
+ )
+ },
+ hour: (gridWidth, index, item) => {
+ let timeScaleUnit = item.dateObject.hours;
+ let dateText = timeScaleUnit === 12 || timeScaleUnit === 6 || timeScaleUnit === 18 ? `${timeScaleUnit}:00` : item.date;
+ return (
+ <React.Fragment>
+ <g>
+ <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{dateText}</text>
+ </g>
+ </React.Fragment>
+ )
+ },
+ day: (gridWidth, index, item) => {
+ // let timeScaleUnit = item.dateObject.date;
+ return (
+ <React.Fragment>
+ <g>
+ <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 8}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>
+ </g>
+ </React.Fragment>
+ )
+ },
+ month: (gridWidth, index, item) => {
+ // let timeScaleUnit = item.dateObject.months;
+ return (
+ <React.Fragment>
+ <g>
+ <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 5}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>
+ </g>
+ </React.Fragment>
+ )
+ },
+ year: (gridWidth, index, item) => {
+ // let timeScaleUnit = item.dateObject.years;
+ return (
+ <React.Fragment>
+ <g>
+ <text className="gridText" x="0" y="45" fill={item.withinRange ? 'white' : ''} transform={`translate(${(index * gridWidth) + 5}, 20)`} textRendering="optimizeLegibility" clipPath="url(#textDisplay)">{item.date}</text>
+ </g>
+ </React.Fragment>
+ )
+ },
+}
+
+
+class TileText extends PureComponent {
+ //# TODO: all of these (if visible or not) are being updated - should optimize so only visible are shown
+ // componentDidUpdate() {
+ // console.log('TileText update')
+ // }
+ render() {
+ let { item, gridWidth, index } = this.props;
+ // console.log(item)
+ return (
+ axisScaleTextElement[item.timeScale](gridWidth, index, item)
+ )
+ }
+}
+
+// FUNCTIONAL COMPONENT VERSION OF ABOVE - less code in compile
+// const TileText = ({ item, gridWidth, index }) => {
+// return (
+// axisScaleTextElement[item.timeScale](gridWidth, index, item)
+// )
+// }
+
+export default TileText;
\ No newline at end of file
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis-container.js b/web/js/components/timeline/timeline-axis/timeline-axis-container.js
new file mode 100644
index 000000000..2a6d0a434
--- /dev/null
+++ b/web/js/components/timeline/timeline-axis/timeline-axis-container.js
@@ -0,0 +1,27 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import TimelineAxis from './timeline-axis';
+import TimelineDragger from './timeline-dragger';
+
+class TimelineAxisContainer extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { };
+ }
+
+ render() {
+ return (
+ <React.Fragment>
+ <TimelineAxis width={this.props.width} />
+ <TimelineDragger />
+ </React.Fragment>
+ );
+ };
+}
+
+TimelineAxisContainer.defaultProps = {
+};
+TimelineAxisContainer.propTypes = {
+};
+
+export default TimelineAxisContainer;
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index c14dad108..204b005cf 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -1,8 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import TimelineScale from './timeline-scale';
-import TimelineDragger from './timeline-dragger';
-import TimelineDateDialog from './timeline-date-dialog';
+import GridRange from './grid-range/grid-range';
class TimelineAxis extends React.Component {
constructor(props) {
@@ -10,15 +8,10 @@ class TimelineAxis extends React.Component {
this.state = { };
}
- onHoverx() {
- console.log('hovered');
- }
-
render() {
return (
<React.Fragment>
- <TimelineScale width={this.props.width} />
- <TimelineDragger />
+ <GridRange />
</React.Fragment>
);
};
diff --git a/web/js/components/timeline/timeline-axis/timeline-date-dialog.js b/web/js/components/timeline/timeline-axis/timeline-date-dialog.js
deleted file mode 100644
index 4e09a736f..000000000
--- a/web/js/components/timeline/timeline-axis/timeline-date-dialog.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-
-class TimelineDateDialog extends React.Component {
- constructor(props) {
- super(props);
- this.state = { };
- }
-
- render() {
- return (
-<div></div>
- );
- };
-}
-
-TimelineDateDialog.defaultProps = {
-};
-TimelineDateDialog.propTypes = {
-};
-
-export default TimelineDateDialog;
diff --git a/web/js/components/timeline/timeline-axis/timeline-scale.js b/web/js/components/timeline/timeline-axis/timeline-scale.js
deleted file mode 100644
index 2932d5b67..000000000
--- a/web/js/components/timeline/timeline-axis/timeline-scale.js
+++ /dev/null
@@ -1,137 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import Draggable from 'react-draggable';
-
-class TimelineScale extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- years: ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027", "2028", "2029", "2030", "2031", "2032", "2033", "2034", "2035", "2036", "2037", "2038", "2039", "2040", "2041", "2042", "2043", "2044", "2045", "2046", "2047", "2048", "2049", "2050", "2051", "2052", "2053", "2054", "2055", "2056", "2057", "2058", "2059", "2060", "2061", "2062", "2063", "2064", "2065", "2066", "2067", "2068", "2069", "2070", "2071", "2072", "2073", "2074", "2075", "2076", "2077", "2078", "2079", "2080", "2081", "2082", "2083", "2084", "2085", "2086", "2087", "2088", "2089", "2090", "2091", "2092", "2093", "2094", "2095", "2096", "2097", "2098", "2099"]
- };
- }
-
- getEm() {
- let initX1 = 220;
- return this.state.years.map((date, i) => {
- // let year = date.getUTCFullYear();
- let year = date;
- initX1 += 220;
- return (
- <React.Fragment key={i}>
- {this.createTicks(initX1)}
- <text x="0" y="0" fontSize="25" dy="0">
- <tspan x={initX1.toString()} y="46" dy=".6em" fill="rgb(255,255,255)" className="timeline-date-text">{year}</tspan>
- </text>
- </React.Fragment>
- )
- })
- }
-
- createTicks(startingX) {
- var ticks = [];
-
- for (let i = 0; i <= 10; i++) {
- ticks.push(<line style={startingX > 1000 ? { display: 'none' } : { }} key={i} x1={startingX.toString()} y1="0" x2={startingX.toString()} y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>);
- startingX += 20;
- }
-
- return ticks;
- }
-
- getTimelineAxisHTML() {
-
- return (
- <React.Fragment>
- {/* <svg id="newDesign" height="68" width={this.props.width - 300} transform="translate(320,477)" style={{background: 'rgba(40, 40, 40, 0.70)'}} > */}
- <g>
- <line x1="0" y1="0" x2="0" y2="45" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <text x="0" y="0" fontSize="25" dy="0" style={{userSelect: 'none'}}>
- <tspan x="10" y="46" dy=".6em" fill="rgb(255,255,255)" className="timeline-date-text">2018</tspan>
- </text>
- <React.Fragment>
- {this.getEm()}
- </React.Fragment>
- <line x1="20" y1="0" x2="20" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="40" y1="0" x2="40" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="60" y1="0" x2="60" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="80" y1="0" x2="80" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="100" y1="0" x2="100" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="120" y1="0" x2="120" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="140" y1="0" x2="140" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="160" y1="0" x2="160" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="180" y1="0" x2="180" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="200" y1="0" x2="200" y2="45" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <text x="0" y="0" fontSize="25" dy="0">
- <tspan x="210" y="46" dy=".6em" fill="rgb(255,255,255)" className="timeline-date-text" >2019</tspan>
- </text>
- <line x1="220" y1="0" x2="220" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="240" y1="0" x2="240" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="260" y1="0" x2="260" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="280" y1="0" x2="280" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="300" y1="0" x2="300" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="320" y1="0" x2="320" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="340" y1="0" x2="340" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="360" y1="0" x2="360" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="380" y1="0" x2="380" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="400" y1="0" x2="400" y2="45" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <text x="0" y="0" fontSize="25" dy="0">
- <tspan x="410" y="46" dy=".6em" fill="rgb(255,255,255)" className="timeline-date-text">2020</tspan>
- </text>
- <line x1="420" y1="0" x2="420" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="440" y1="0" x2="440" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="460" y1="0" x2="460" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="480" y1="0" x2="480" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="500" y1="0" x2="500" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="520" y1="0" x2="520" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="540" y1="0" x2="540" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="560" y1="0" x2="560" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="580" y1="0" x2="580" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="600" y1="0" x2="600" y2="45" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <text x="0" y="0" fontSize="25" dy="0">
- <tspan x="610" y="46" dy=".6em" fill="rgb(255,255,255)" className="timeline-date-text">2021</tspan>
- </text>
- <line x1="620" y1="0" x2="620" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="640" y1="0" x2="640" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="660" y1="0" x2="660" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="680" y1="0" x2="680" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="700" y1="0" x2="700" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="720" y1="0" x2="720" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="740" y1="0" x2="740" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="760" y1="0" x2="760" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="780" y1="0" x2="780" y2="20" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <line x1="800" y1="0" x2="800" y2="45" className="tick-new" stroke="rgb(255,255,255)" strokeWidth="2"></line>
- <text x="0" y="0" fontSize="25" dy="0">
- <tspan x="810" y="46" dy=".6em" fill="rgb(255,255,255)" className="timeline-date-text">2022</tspan>
- </text>
- <line x1="0" y1="0" x2="776" y2="0" stroke="rgb(255,255,255)" strokeWidth="8"></line>
- </g>
- {/* </svg> */}
- </React.Fragment>
- );
- }
-
- render() {
- // console.log(this.props.dateArray)
- // console.log(this.props.dateArray[0].getUTCFullYear())
- return (
- <div style={{height: '2500px', width: '2100px', position: 'relative', overflow: 'auto', padding: '0'}}>
- <Draggable
- position={{ x: 300, y: 385 }}
- axis="x"
- handle="#newDesign"
- >
- <svg id="newDesign" height="68" width={this.props.width * 4} transform="translate(320,477)" style={{background: 'rgba(40, 40, 40, 0.70)'}} >
- {this.getTimelineAxisHTML()}
- </svg>
- </Draggable>
- </div>
- );
- };
-}
-
-TimelineScale.defaultProps = {
-};
-TimelineScale.propTypes = {
-};
-
-export default TimelineScale;
diff --git a/web/js/components/timeline/timeline-controls/date-change-arrows.js b/web/js/components/timeline/timeline-controls/date-change-arrows.js
new file mode 100644
index 000000000..8cadfc890
--- /dev/null
+++ b/web/js/components/timeline/timeline-controls/date-change-arrows.js
@@ -0,0 +1,39 @@
+import React, { PureComponent } from 'react';
+
+class DateChangeArrows extends PureComponent {
+ render() {
+ return (
+ <div>
+ {/* left arrow */}
+ {/* <div
+ className="button-action-group"
+ id="left-arrow-group"
+ title="Click and hold to animate backwards"
+ >
+ <svg id="timeline-svg" width="24" height="30">
+ <path
+ d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
+ className="arrow"
+ />
+ </svg>
+ </div> */}
+
+ {/* right arrow */}
+ {/* <div
+ className="button-action-group"
+ id="right-arrow-group"
+ title="Click and hold to animate forwards"
+ >
+ <svg width="24" height="30">
+ <path
+ d="M 10.240764,0 24,15 10.240764,30 0,30 13.759236,15 0,0 10.240764,0 z"
+ className="arrow"
+ />
+ </svg>
+ </div> */}
+ </div>
+ );
+ }
+}
+
+export default DateChangeArrows;
diff --git a/web/js/components/timeline/timeline-controls/date-change-controls.js b/web/js/components/timeline/timeline-controls/date-change-controls.js
new file mode 100644
index 000000000..e1d7a43d7
--- /dev/null
+++ b/web/js/components/timeline/timeline-controls/date-change-controls.js
@@ -0,0 +1,59 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import DateSelector from '../../date-selector/date-selector';
+import DateZoomChange from './date-zoom-change';
+import DateChangeArrows from './date-change-arrows';
+
+class DateChangeControls extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ };
+ }
+
+ render() {
+ // ZOOM LEVELS:
+ // 1-YEAR, 2-MONTH, 3-DAY, 4-MINUTE, 5-DAY??
+ let mockDateSelectorProps = {
+ date: new Date(),
+ fontSize: null,
+ height: '30',
+ id: 'main',
+ idSuffix: 'animation-widget-main',
+ maxDate: new Date('2019-04-01'),
+ maxZoom: 5, // 3 === DAY, 5 TRIGGERS CONDITIONAL TO SHOW SUBDAILY
+ minDate: new Date('1947-02-01'),
+ onDateChange: (date) => console.log('mock', date),
+ width: '120'
+ }
+ return (
+ <div>
+ <DateSelector
+ {...mockDateSelectorProps}
+ />
+ <DateZoomChange />
+ <DateChangeArrows />
+
+ {/* animation button */}
+ {/* <div
+ className="button-action-group animate-button"
+ id="animate-button"
+ title="Set up animation"
+ >
+ <i id="wv-animate" className="fas fa-video wv-animate" />
+ </div> */}
+ </div>
+ );
+ }
+}
+// Timeline.defaultProps = {
+// };
+// Timeline.propTypes = {
+// width: PropTypes.number,
+// drawContainers: PropTypes.func,
+// changeDate: PropTypes.func,
+// selectedDate: PropTypes.instanceOf(Date)
+// };
+
+export default DateChangeControls;
diff --git a/web/js/components/timeline/timeline-controls/date-zoom-change.js b/web/js/components/timeline/timeline-controls/date-zoom-change.js
new file mode 100644
index 000000000..20682b64b
--- /dev/null
+++ b/web/js/components/timeline/timeline-controls/date-zoom-change.js
@@ -0,0 +1,58 @@
+import React, { PureComponent } from 'react';
+
+class DateZoomChange extends PureComponent {
+ render() {
+ return (
+ <div>
+
+ {/* <div id="zoom-btn-container"> */}
+ {/* timeScale display */}
+ {/* <span
+ id="current-zoom"
+ className="zoom-btn zoom-btn-active"
+ data-zoom="3"
+ >
+ Days
+ </span> */}
+
+ {/* hover timeScale unit dialog / entry point to Custom selector */}
+ {/* <div className="wv-tooltip">
+ <div id="timeline-zoom" className="timeline-zoom">
+ <span
+ id="zoom-years"
+ className="zoom-btn zoom-btn-inactive zoom-years"
+ data-zoom="1"
+ >
+ Years
+ </span>
+ <span
+ id="zoom-months"
+ className="zoom-btn zoom-btn-inactive zoom-months"
+ data-zoom="2"
+ >
+ Months
+ </span>
+ <span
+ id="zoom-days"
+ className="zoom-btn zoom-btn-inactive zoom-days"
+ data-zoom="3"
+ >
+ Days
+ </span>
+ <span
+ id="zoom-minutes"
+ className="zoom-btn zoom-btn-inactive zoom-minutes"
+ data-zoom="4"
+ >
+ Minutes
+ </span>
+ </div>
+ </div>
+ </div> */}
+
+ </div>
+ );
+ }
+}
+
+export default DateZoomChange;
diff --git a/web/js/components/timeline/timeline.js b/web/js/components/timeline/timeline.js
index 81fd7790d..2db2a6443 100644
--- a/web/js/components/timeline/timeline.js
+++ b/web/js/components/timeline/timeline.js
@@ -1,7 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
+
+import DateChangeControls from './timeline-controls/date-change-controls';
import './timeline.css';
import TimelineAxis from './timeline-axis';
+// import TimelineAxisContainer from './timeline-axis/timeline-axis-container';
class Timeline extends React.Component {
constructor(props) {
@@ -19,7 +22,18 @@ class Timeline extends React.Component {
let dateFormatted = this.state.selectedDate.toISOString();
return (
<div>
+ <DateChangeControls />
<TimelineAxis {...this.state} selectedDate={dateFormatted}/>
+
+ {/* new modular version - currently a shell */}
+ {/* <TimelineAxisContainer {...this.state} selectedDate={dateFormatted}/> */}
+
+ {/* hammmmmmmmmmmburger 🍔 */}
+ {/* <div id="timeline-hide">
+ <svg className="hamburger" width="10" height="9">
+ <path d="M 0,0 0,1 10,1 10,0 0,0 z M 0,4 0,5 10,5 10,4 0,4 z M 0,8 0,9 10,9 10,8 0,8 z" />
+ </svg>
+ </div> */}
</div>
);
}
diff --git a/web/js/date/timeline.js b/web/js/date/timeline.js
index 2f7be89f3..88b2c1797 100644
--- a/web/js/date/timeline.js
+++ b/web/js/date/timeline.js
@@ -32,7 +32,6 @@ export function timeline(models, config, ui) {
self.margin.left -
self.margin.right +
28;
- console.log(self.width)
return self.width;
};