@@ -3,6 +3,7 @@ import { createGlobalStyle } from 'styled-components';
33
44// containers
55import SplitPane from '../container/SplitPane.jsx' ;
6+ import TimeSlider from '../container/TimeSlider.jsx' ;
67
78// left pane = events, right pane = details
89import Events from '../container/Events.jsx' ;
@@ -30,7 +31,6 @@ const GlobalStyle = createGlobalStyle`
3031 }
3132` ;
3233
33-
3434class App extends Component {
3535 constructor ( props ) {
3636 super ( props ) ;
@@ -39,15 +39,19 @@ class App extends Component {
3939 data : [ ] ,
4040 isPlaying : false ,
4141 isRecording : false ,
42+ isSearching : false ,
43+ isPlayingIndex : 0 ,
4244 } ;
45+
4346 this . port = null ;
44- this . isPlayingIndex = 0 ;
4547 this . addActionToView = this . addActionToView . bind ( this ) ;
4648 this . toTheFuture = this . toTheFuture . bind ( this ) ;
4749 this . toThePast = this . toThePast . bind ( this ) ;
4850 this . setIsPlaying = this . setIsPlaying . bind ( this ) ;
4951 this . setIsRecording = this . setIsRecording . bind ( this ) ;
5052 this . actionInPlay = this . actionInPlay . bind ( this ) ;
53+ this . handleBarChange = this . handleBarChange . bind ( this ) ;
54+ this . searchChange = this . searchChange . bind ( this ) ;
5155 }
5256
5357 componentDidMount ( ) {
@@ -71,10 +75,11 @@ class App extends Component {
7175
7276 // functionality to change 'play' button to 'stop'
7377 setIsPlaying ( ) {
74- if ( this . isPlayingIndex === this . state . data . length - 1 ) {
75- this . isPlayingIndex = 0 ;
78+ if ( this . state . isPlayingIndex === this . state . data . length - 1 ) {
79+ this . state . isPlayingIndex = 0 ;
7680 }
7781
82+ console . log ( 'isplaying' )
7883 let { isPlaying } = this . state ;
7984 isPlaying = ! isPlaying ;
8085 this . setState ( { isPlaying } ) ;
@@ -121,6 +126,25 @@ class App extends Component {
121126 } ) ;
122127 }
123128
129+ // filter search bar results
130+ // *** NOT FINISHED ***
131+ searchChange ( e ) {
132+ const { data } = this . state ;
133+ console . log ( data ) ;
134+ }
135+
136+ // time travel bar change
137+ handleBarChange ( e ) {
138+ const { data } = this . state ;
139+ const { id, action, state } = data [ e . target . value ] ;
140+
141+ this . setState ( {
142+ id,
143+ action,
144+ state,
145+ isPlayingIndex : e . target . value ,
146+ } ) ;
147+ }
124148
125149 // function to travel to the FUTURE
126150 toTheFuture ( ) {
@@ -141,6 +165,7 @@ class App extends Component {
141165 }
142166
143167 render ( ) {
168+ console . log ( this . state . isPlayingIndex ) ;
144169 const {
145170 action,
146171 id,
@@ -163,10 +188,6 @@ class App extends Component {
163188 addAction = { this . addActionToView }
164189 toTheFuture = { this . toTheFuture }
165190 toThePast = { this . toThePast }
166- isPlaying = { isPlaying }
167- isRecording = { isRecording }
168- setIsPlaying = { this . setIsPlaying }
169- setIsRecording = { this . setIsRecording }
170191 activeEventId = { id }
171192 />
172193 ) }
@@ -179,6 +200,17 @@ class App extends Component {
179200 />
180201 ) }
181202 />
203+ < TimeSlider
204+ data = { data }
205+ toTheFuture = { this . toTheFuture }
206+ toThePast = { this . toThePast }
207+ isPlaying = { isPlaying }
208+ isPlayingIndex = { this . state . isPlayingIndex }
209+ isRecording = { isRecording }
210+ setIsPlaying = { this . setIsPlaying }
211+ setIsRecording = { this . setIsRecording }
212+ handleBarChange = { this . handleBarChange }
213+ />
182214 </ >
183215 ) ;
184216 }
0 commit comments