Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
.env.development.local
.env.test.local
.env.production.local
/.history
/debug.log

npm-debug.log*
yarn-debug.log*
Expand Down
84 changes: 84 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[1124/160308.731:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.732:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.732:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.732:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.732:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.733:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.733:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.733:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.733:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.733:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.735:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.735:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.735:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.735:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1124/160308.736:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.517:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.532:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.533:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.534:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.534:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1125/194618.534:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.183:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1221/185849.221:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.061:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.085:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.085:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.085:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.085:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.085:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.086:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.087:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.087:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.087:ERROR:crash_report_database_win.cc(469)] failed to stat report
[1223/091714.087:ERROR:crash_report_database_win.cc(469)] failed to stat report
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"dotenv": "^8.2.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.2.0"
"react-scripts": "3.2.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.88.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
22 changes: 0 additions & 22 deletions src/App.css

This file was deleted.

26 changes: 0 additions & 26 deletions src/App.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

20 changes: 20 additions & 0 deletions src/Suggestion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import {Grid, Image, Header } from "semantic-ui-react";

const Suggestion = (props) => {

const performVideoChange = () => {
props.changeVideo(props.video);
};

return (
<Grid.Column onClick={performVideoChange}>
<Image src={props.video.snippet.thumbnails.medium.url} />
<Header size="small" textAlign="left">
{props.video.snippet.title}
</Header>
</Grid.Column>
);
}

export default Suggestion;
132 changes: 132 additions & 0 deletions src/VidPlayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import React, {Component} from 'react';
import Suggestion from "./Suggestion";
import {
Form,
Container,
Embed,
Divider,
Grid,
Icon,
Header,
} from "semantic-ui-react";

class VidPlayer extends Component{
constructor(){
super();
this.state = {
query: 'space',
url: 'https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=20&key=AIzaSyDYfC8I1ZFiWh6DWMUybfKM_k17ZVc4NqQ&q=',
mainVideo: '',
mainVideoImage: '',
mainVideoTitle: '',
suggestedVideos: [],
moreSuggestions: []
};
this.getVideos=this.getVideos.bind(this);
this.searchVideos=this.searchVideos.bind(this);
this.handleChange=this.handleChange.bind(this);
this.changeVideo=this.changeVideo.bind(this);
}

componentDidMount(){
this.getVideos(this.state.query);
}

getVideos(searchQuery){
let url = this.state.url + searchQuery;
return(
fetch(url).then(response => response.json())
.then(data => {
let firstVideo = data.items.shift();
let suggestions = data.items.splice(0, 9);
this.setState({
...this.state,
mainVideo: firstVideo.id.videoId,
mainVideoTitle: firstVideo.snippet.title,
suggestedVideos: suggestions,
moreSuggestions: data.items,
mainVideoImage: firstVideo.snippet.thumbnails.high.url
});
})
)
}

handleChange(e){
this.setState({...this.state, query:e.target.value});
}

searchVideos(e){
e.preventDefault();
this.getVideos(this.state.query);
}

changeVideo(video){
this.setState({
...this.state,
mainVideo: video.id.videoId,
mainVideoImage: video.snippet.thumbnails.high.url,
mainVideoTitle: video.snippet.title
});
}

render(){
console.log(this.state.mainVideoImage);
return (
<div>
<Header as="h1" textAlign="left" color="red" style={{margin:"10px"}}>
Vidapp
</Header>
<Container textAlign="center">
<Form onSubmit={this.searchVideos} size="large">
<Form.Group>
<Form.Input
placeholder="Video Name/Tag"
width={6}
onChange={this.handleChange}
/>
<Form.Button content="Get Videos" icon size="large" color="red">
<Icon name="search" />
</Form.Button>
</Form.Group>
</Form>

<Header size="large" textAlign="left">
{this.state.mainVideoTitle}
</Header>

<Embed
id={this.state.mainVideo}
placeholder={this.state.mainVideoImage}
source="youtube"
/>

<Divider horizontal>Suggestions</Divider>

<Grid doubling columns={3}>
{this.state.suggestedVideos.map((video, i) => (
<Suggestion
video={video}
changeVideo={this.changeVideo}
key={i}
/>
))}
</Grid>

<Divider horizontal> More Suggestions</Divider>

<Grid doubling columns={5}>
{this.state.moreSuggestions.map((video, i) => (
<Suggestion
video={video}
changeVideo={this.changeVideo}
key={i}
/>
))}
</Grid>
</Container>
</div>
);
}
}

export default VidPlayer;
13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

12 changes: 3 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import 'semantic-ui-css/semantic.min.css'
import VidPlayer from './VidPlayer';

ReactDOM.render(<App />, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
ReactDOM.render(<VidPlayer />, document.getElementById('root'));
Loading