Skip to content

Commit 35ae10c

Browse files
authored
Merge pull request #25 from murphybrandon/front-end
Front end
2 parents 3370fcd + 3e41dc2 commit 35ae10c

File tree

14 files changed

+182
-236
lines changed

14 files changed

+182
-236
lines changed

src/app/components/App.jsx

Lines changed: 40 additions & 8 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.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
}

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 ? <text>||</text> : <text>&#9658;</text> }</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)