Skip to content

Commit 80ce13e

Browse files
committed
2 parents 889dabc + c3391fb commit 80ce13e

File tree

22 files changed

+2909
-350
lines changed

22 files changed

+2909
-350
lines changed

package-lock.json

Lines changed: 2598 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "index.js",
66
"scripts": {
77
"lint": "eslint \"*/**/*.{js,jsx}\"",
8-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "echo \"Error: no test specified\" && exit 1",
9+
"bundle_bg": "browserify src/browser/chrome/background.js -o src/browser/chrome/devtools_bundle/bg_bundle.js"
910
},
1011
"repository": {
1112
"type": "git",

src/app/components/App.jsx

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createGlobalStyle } from 'styled-components';
33

44
// containers
55
import SplitPane from '../container/SplitPane.jsx';
6+
import TimeSlider from '../container/TimeSlider.jsx';
67

78
// left pane = events, right pane = details
89
import Events from '../container/Events.jsx';
@@ -30,7 +31,6 @@ const GlobalStyle = createGlobalStyle`
3031
}
3132
`;
3233

33-
3434
class 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.setState({ isPlayingIndex: 0 });
7680
}
7781

82+
console.log('isplaying');
7883
let { isPlaying } = this.state;
7984
isPlaying = !isPlaying;
8085
this.setState({ isPlaying });
@@ -93,14 +98,17 @@ class App extends Component {
9398
}
9499

95100
actionInPlay() {
96-
this.isPlayingIndex++;
101+
let { isPlayingIndex } = this.state;
102+
if (isPlayingIndex >= this.state.data.length - 1) isPlayingIndex = 0;
103+
104+
this.setState({ isPlayingIndex: isPlayingIndex + 1 });
105+
const { id, action, state } = this.state.data[isPlayingIndex + 1];
97106

98-
const { id, action, state } = this.state.data[this.isPlayingIndex];
99107
setTimeout(() => {
100108
this.setState((prev, props) => {
101-
return { ...prev, id, action, state }
109+
return { ...prev, id, action, state };
102110
});
103-
if (this.state.isPlaying && this.isPlayingIndex < this.state.data.length - 1) {
111+
if (this.state.isPlaying && isPlayingIndex + 1 < this.state.data.length - 1) {
104112
this.actionInPlay();
105113
} else {
106114
this.setState({ isPlaying: false });
@@ -121,6 +129,25 @@ class App extends Component {
121129
});
122130
}
123131

132+
// filter search bar results
133+
// *** NOT FINISHED ***
134+
searchChange(e) {
135+
const { data } = this.state;
136+
console.log(data);
137+
}
138+
139+
// time travel bar change
140+
handleBarChange(e) {
141+
const { data } = this.state;
142+
const { id, action, state } = data[e.target.value];
143+
144+
this.setState({
145+
id,
146+
action,
147+
state,
148+
isPlayingIndex: parseInt(e.target.value),
149+
});
150+
}
124151

125152
// function to travel to the FUTURE
126153
toTheFuture() {
@@ -141,6 +168,7 @@ class App extends Component {
141168
}
142169

143170
render() {
171+
console.log(this.state.isPlayingIndex);
144172
const {
145173
action,
146174
id,
@@ -163,10 +191,6 @@ class App extends Component {
163191
addAction={this.addActionToView}
164192
toTheFuture={this.toTheFuture}
165193
toThePast={this.toThePast}
166-
isPlaying={isPlaying}
167-
isRecording={isRecording}
168-
setIsPlaying={this.setIsPlaying}
169-
setIsRecording={this.setIsRecording}
170194
activeEventId={id}
171195
/>
172196
)}
@@ -179,6 +203,17 @@ class App extends Component {
179203
/>
180204
)}
181205
/>
206+
<TimeSlider
207+
data={data}
208+
toTheFuture={this.toTheFuture}
209+
toThePast={this.toThePast}
210+
isPlaying={isPlaying}
211+
isPlayingIndex={this.state.isPlayingIndex}
212+
isRecording={isRecording}
213+
setIsPlaying={this.setIsPlaying}
214+
setIsRecording={this.setIsRecording}
215+
handleBarChange={this.handleBarChange}
216+
/>
182217
</>
183218
);
184219
}

src/app/components/DetailCards/DetailsNav.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@ import { Buttons, Button, DetailsNavWrapper, Ul } from '../../styles/Nav.jsx';
88

99
export default function RightNav(props) {
1010
return (
11-
//make this nav bar with react router
12-
//sync it so each active link displays appropriate div
13-
//with info
14-
15-
//style pages so inputted information is styled correctly
1611
<>
1712
<DetailsNavWrapper>
1813
<Buttons>
19-
<NavLink activeClassName='active' to='/actions'>
14+
<NavLink activeClassName='active' to='/'>
2015
<Button>actions</Button>
2116
</NavLink>
2217
<NavLink activeClassName='active' to='/effects'>
@@ -28,5 +23,5 @@ export default function RightNav(props) {
2823
</Buttons>
2924
</DetailsNavWrapper>
3025
</>
31-
)
26+
);
3227
}

src/app/components/EventCards/EventCreator.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ export default function EventCreator(props) {
99
} = props;
1010
return (
1111
<EventCard id={id} onClick={addAction} selectedEvent={selectedEvent}>
12-
&#x2630;
13-
{action}
14-
<EventTimeDiv selectedEvent={selectedEvent}>{actionTime || '00:00:01'}</EventTimeDiv>
12+
&#x2630;{action}
13+
<EventTimeDiv id={id} selectedEvent={selectedEvent}>{actionTime || '00:00:01'}</EventTimeDiv>
1514
</EventCard>
1615

1716
);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
3+
export default function FilterBar(props) {
4+
const {
5+
searchChange,
6+
} = props;
7+
8+
return (
9+
<input
10+
type="text"
11+
placeholder="filter"
12+
onChange={searchChange}
13+
/>
14+
);
15+
}
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
import React from 'react';
22

33
// styled component
4-
import { TimeTravelContainer, EventTimeDiv } from '../../styles/Events.jsx';
4+
import { PreviousNextWrapper, PrevNextButton } from '../../styles/Events.jsx';
55

66
export default function TimeTavel(props) {
77
const {
88
toTheFuture,
99
toThePast,
10-
setIsRecording,
11-
isRecording,
12-
setIsPlaying,
13-
isPlaying,
1410
} = props;
1511

1612

1713
return (
1814
<>
19-
<TimeTravelContainer>
20-
<EventTimeDiv onClick={setIsRecording}>{isRecording ? 'PAUSE' : 'RECORD'}</EventTimeDiv>
21-
<EventTimeDiv onClick={setIsPlaying}>{isPlaying ? 'STOP' : 'PLAY' }</EventTimeDiv>
22-
</TimeTravelContainer>
23-
<TimeTravelContainer>
24-
<EventTimeDiv onClick={toThePast}>PREVIOUS</EventTimeDiv>
25-
<EventTimeDiv onClick={toTheFuture}>NEXT</EventTimeDiv>
26-
</TimeTravelContainer>
15+
<PreviousNextWrapper>
16+
<PrevNextButton onClick={toThePast}>PREVIOUS</PrevNextButton>
17+
<PrevNextButton onClick={toTheFuture}>NEXT</PrevNextButton>
18+
</PreviousNextWrapper>
2719
</>
2820
);
2921
}

src/app/container/Details.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export default function Details(props) {
2626
<Router>
2727
<>
2828
<DetailsNav />
29-
3029
{/* routing components and rendering them with props */}
3130
<Route
32-
path='/actions'
31+
exact
32+
path='/'
3333
render={props => <ActionsDisplay {...props} action={action} />}
3434
/>
3535
<Route

src/app/container/Events.jsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class Events extends Component {
1818
data,
1919
toTheFuture,
2020
toThePast,
21-
setIsPlaying,
22-
isPlaying,
23-
setIsRecording,
24-
isRecording,
25-
isPlayingIndex,
2621
} = this.props;
2722
return (
2823
<>
@@ -35,10 +30,6 @@ class Events extends Component {
3530
<TimeTravel
3631
toTheFuture={toTheFuture}
3732
toThePast={toThePast}
38-
setIsRecording={setIsRecording}
39-
isRecording={isRecording}
40-
setIsPlaying={setIsPlaying}
41-
isPlaying={isPlaying}
4233
/>
4334
</>
4435
);

src/app/container/TimeSlider.jsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
3+
// styled component
4+
5+
import { TimeTravelContainer, EventTimeDiv } from '../../app/styles/Events.jsx';
6+
import { SliderWrapper, Button } from '../styles/TimeSlider.jsx'
7+
8+
const TimeSlider = (props) => {
9+
const {
10+
toTheFuture,
11+
toThePast,
12+
setIsRecording,
13+
isRecording,
14+
setIsPlaying,
15+
isPlaying,
16+
isPlayingIndex,
17+
data,
18+
handleBarChange,
19+
} = props;
20+
21+
return (
22+
<>
23+
<SliderWrapper>
24+
<Button onClick={setIsRecording}>{isRecording ? 'PAUSE' : 'RECORD'}</Button>
25+
<Button onClick={setIsPlaying}>{isPlaying ? '||' : '►'}</Button>
26+
<input type="range" min="0" max={data.length - 1} value={isPlayingIndex}
27+
onChange={handleBarChange} />
28+
</SliderWrapper>
29+
</>
30+
);
31+
};
32+
33+
export default TimeSlider;

0 commit comments

Comments
 (0)