Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octos - VideoStore - Brandy and Jamila #14

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e017535
created movie component
Jcornick21 Jun 18, 2018
75fac09
created MovieLibrary component and return renders to page
Jcornick21 Jun 18, 2018
b5e91b2
Rename movie.js to Movie.js
brandyaustinseattle Jun 18, 2018
f19c383
added status componenet, styling for table
brandyaustinseattle Jun 19, 2018
ca5d117
installed router and links showing/functional
Jcornick21 Jun 19, 2018
b463335
fix for customer page
Jcornick21 Jun 19, 2018
cb8c9f8
updated movie library page
brandyaustinseattle Jun 19, 2018
458e08f
added searchform and search componenets
brandyaustinseattle Jun 19, 2018
0fd646f
finished movie search functionality
brandyaustinseattle Jun 19, 2018
bae1a1e
created customer and customers components
brandyaustinseattle Jun 19, 2018
47f0da9
working on add to library
Jcornick21 Jun 20, 2018
c6fad1c
can now send info to api for adding movie
brandyaustinseattle Jun 20, 2018
9a4fa3a
setup for creating a rental using a form did not work
Jcornick21 Jun 21, 2018
40c10da
minor change to rental setup
Jcornick21 Jun 21, 2018
3463ea2
rent button partially working
brandyaustinseattle Jun 21, 2018
baebf2d
add back button
brandyaustinseattle Jun 21, 2018
99546a8
fix button naming
brandyaustinseattle Jun 21, 2018
005407b
working on rentals
Jcornick21 Jun 21, 2018
87a5f3e
test version working
brandyaustinseattle Jun 22, 2018
4a739b8
working on rent api call
brandyaustinseattle Jun 22, 2018
6cd6ec7
axios call for rental working
brandyaustinseattle Jun 22, 2018
a2cd150
css
Jcornick21 Jun 22, 2018
e93b8fd
Merge branch 'master' of https://github.com/brandyaustinseattle/video…
Jcornick21 Jun 22, 2018
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
81 changes: 81 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4"
},
"scripts": {
Expand All @@ -13,4 +16,4 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
}
25 changes: 24 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.App {
text-align: center;
background-color: #00064d;
color: #bbbbbb;
}

.App-logo {
Expand All @@ -15,7 +17,9 @@
}

.App-title {
font-size: 1.5em;
font-size: 2em;
margin-top: 1em;

}

.App-intro {
Expand All @@ -26,3 +30,22 @@
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

table {
border: 2px solid black;
padding: 10px;
margin: 20px;
background-color: lightyellow;
width: 95%;
text-align: left;
}

.ul {
display: flex;
justify-content: space-around;
list-style-type: none;
border: 1px ;
margin-top: 5em;


}
99 changes: 90 additions & 9 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,100 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import FormPage from './components/FormPage';
import Home from './components/Home';
import Search from './components/Search';
import Status from './components/Status';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";



class App extends Component {

constructor() {
super();

this.state = {

movieTitle: '',
customerId: '',
customerName: '',

status: {
message: 'loaded the page',
type: 'success'
}
}
}

updateStatus = (message, type) => {
this.setState({
status: {
message: message,
type: type
}
})
}

custHandler = (customerInfo) => {
console.log('in custHandler');
console.log(customerInfo);
this.setState({
customerId: customerInfo.id,
customerName: customerInfo.name
});
}

movHandler = (movieTitle) => {
console.log('in movHandler');
console.log(movieTitle);
this.setState({
movieTitle: movieTitle
});
}

render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
<section className="App">

<div>
<Status message={this.state.status.message} types={this.state.status.type} />
</div>

<header>
<h1 className="App-title">blockbuster</h1>

<Router>
<div>
<ul className="ul">
<li>
<Link to="/Home">Home</Link>
</li>
<li>
<Link to="/Search">Search</Link>
</li>
<li>
<Link to="/MovieLibrary">Library</Link>
</li>
<li>
<Link to="/Customers">Customers</Link>
</li>
</ul>

<hr/>

<Route path="/Home" component={Home} />

<Route path="/Search" component={Search} />

<Route path="/MovieLibrary" component={() => <FormPage selectedCustHandler={this.custHandler} selectedMovHandler={this.movHandler} movieTitle={this.state.movieTitle} customerId={this.state.customerId} customerName={this.state.customerName} hideMovies={false} hideCustomers={true} />} />

<Route path="/Customers" component={() => <FormPage selectedCustHandler={this.custHandler} selectedMovHandler={this.movHandler} movieTitle={this.state.movieTitle} customerId={this.state.customerId} customerName={this.state.customerName} hideMovies={true} hideCustomers={false} />} />
</div>
</Router>

</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>

</section>
);
}
}
Expand Down
50 changes: 50 additions & 0 deletions src/components/AddToLibraryForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';

class AddToLibraryForm extends Component {

static propTypes = {
title: PropTypes.string.isRequired
}

constructor(props) {
super();

this.state = {
title: props.title,
overview: props.overview,
release_date: props.release_date,
image_url: props.image_url,
};

}

onFormSubmit = (event) => {
let URL = `http://localhost:3000/movies?title=${this.state.title}&overview=${this.state.overview}&release_date=${this.state.release_date}&image_url=${this.state.image_url}`
event.preventDefault();
axios.post(URL)
.then((response)=> {
})
.catch((error) => {
// this.props.updateStatusCallback(error.message, 'error');

});
}

render(){

return(
<form onSubmit={this.onFormSubmit}>
<input type="hidden" name='title' value={this.state.title} />
<input type="hidden" name='overview' value={this.state.overview} />
<input type="hidden" name='release_date' value={this.state.release_date} />
<input type="hidden" name='image_url' value={this.state.image_url} />

<button type="submit">Add {this.state.title} to Library</button>
</form>
)
}
}

export default AddToLibraryForm;
Loading