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

Sam and Angelica -- Octos #10

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ce277a0
Set up React Router.
amcejamorales Jun 18, 2018
47dbf1d
add links and route paths for main components
samanthaberk Jun 18, 2018
aea7ee8
List of all customers displays on customer list page.
amcejamorales Jun 18, 2018
70617e9
current customer name updates on click
samanthaberk Jun 19, 2018
d27ec52
Display movies' image and title in library page.
amcejamorales Jun 19, 2018
ef10b65
updates current movie on button click
samanthaberk Jun 19, 2018
2bfcd09
Add search form to search page.
amcejamorales Jun 19, 2018
61759ce
Movie Search form displays list of movies according to search term
samanthaberk Jun 19, 2018
a371379
Post to VideoStoreConsumer-API using rack-cors.
amcejamorales Jun 19, 2018
ec11002
Add movie button adds movie from external api to library
samanthaberk Jun 19, 2018
26d3325
Create new rental for the selected customer and movie.
amcejamorales Jun 19, 2018
5c02f3b
Add video cassette favicon
samanthaberk Jun 19, 2018
4faf258
Merge branch 'master' of https://github.com/samanthaberk/video-store-…
samanthaberk Jun 19, 2018
fb5a651
create status component
samanthaberk Jun 20, 2018
28ea6f7
Update status and implement error handling when creating a rental.
amcejamorales Jun 20, 2018
855bad3
our clever tagline
samanthaberk Jun 20, 2018
1847c74
status update callback on library component
samanthaberk Jun 20, 2018
160a941
status update callback on customer component
amcejamorales Jun 20, 2018
e785653
add status update callback to search feature and add movie to library…
samanthaberk Jun 20, 2018
5cc7ffd
Validate prop types in components.
amcejamorales Jun 20, 2018
839fe59
header styling
samanthaberk Jun 20, 2018
29dfd3f
fix spacing issue on header
samanthaberk Jun 20, 2018
afb8eb3
Create NewCustomerForm component and toggle display in CustomerList c…
amcejamorales Jun 21, 2018
30600cd
Save NewCustomerForm input in component state and post new customerto…
amcejamorales Jun 21, 2018
144fc53
Merge branch 'master' of https://github.com/samanthaberk/video-store-…
samanthaberk Jun 21, 2018
e854ae3
change search link to component in header and add styling to status u…
samanthaberk Jun 21, 2018
93bb902
initial styling
samanthaberk Jun 21, 2018
71c3915
More styling
samanthaberk Jun 22, 2018
b5d7f95
Resolve merge conflicts.
amcejamorales Jun 22, 2018
9397199
Fix NewCustomerForm component to write proper postal code and account…
amcejamorales Jun 22, 2018
7176d20
Clear NewCustomerForm on submit.
amcejamorales Jun 22, 2018
ae47259
Use className instead of class key word.
amcejamorales Jun 22, 2018
34b2472
change header
samanthaberk Jun 22, 2018
5fa610c
Merge branch 'master' of https://github.com/samanthaberk/video-store-…
samanthaberk Jun 22, 2018
432fca0
add editcustomer form
samanthaberk Jun 22, 2018
80c126b
Display edit customer form in customer list component.
amcejamorales Jun 22, 2018
b27c105
Incomplete edit customer implementation.
amcejamorales Jun 22, 2018
edb4500
Remove unusable code.
amcejamorales Jun 22, 2018
31c665a
Style NewCustomerForm component.
amcejamorales 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
89 changes: 89 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",
"font-awesome": "^4.7.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router-dom": "^4.4.0-alpha.0",
"react-scripts": "1.1.4"
},
"scripts": {
Expand All @@ -13,4 +16,4 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
}
Binary file modified public/favicon.ico
Binary file not shown.
51 changes: 39 additions & 12 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,54 @@
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
body {
background: steelblue;
background-repeat: repeat;
}

.App-header {
header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
height: 60px;
line-height: 60px;
display: flex;
flex-wrap: wrap;
justify-content: stretch;
}

.App-title {
font-size: 1.5em;
header p {
margin: 0;
}

.App-intro {
font-size: large;
header a {
color: #fff;
font-size: 1.25em;
}

@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
button.col-1 {
margin: .5em;
display: inline-block;
font-size: 1.25em;
cursor: pointer;
flex: none;
}

.search {
margin: .5em;
display: inline-block;
font-size: 1.25em;
cursor: pointer;
flex: none;
}

.col-1 {
flex-grow: 1;
}

.tagline {
text-align: center;
color: white;
font-weight: bold;
text-shadow: 2px 2px 4px #000000;
}
124 changes: 115 additions & 9 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,125 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import { BrowserRouter as Router, Link, Route } from 'react-router-dom';
import axios from 'axios';
import Library from './components/Library';
import Search from './components/Search';
import CustomerList from './components/CustomerList';
import Status from './components/Status';

import './App.css';

class App extends Component {
constructor(){
super();
this.state = {
customerName: "",
customerId: 0,
movieTitle: "",
movieId: 0,
status: {
message: "",
type: ""
}
}
}

displayCurrentCustomer = (name) => {
this.setState({
customerName: name
});
}

updateCurrentCustomer = (id) => {
this.setState({
customerId: id
});
}

updateCurrentMovie = (id) => {
this.setState({
movieId: id
});
}

displayCurrentMovie = (title) => {
this.setState({
movieTitle: title
});
}

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

createNewRental = () => {
this.updateStatus('Creating new rental', 'success');
let dueDate = new Date();
dueDate.setDate(dueDate.getDate() + 7);
dueDate = `${dueDate.getFullYear()}-${String(dueDate.getMonth() + 1).padStart(2, "0")}-${String(dueDate.getDate()).padStart(2, "0")}`;

const NEW_RENTAL_URL = `http://localhost:3000/rentals/${this.state.movieTitle}/check-out`;
axios.post(NEW_RENTAL_URL, {
due_date: dueDate,
customer_id: this.state.customerId
})
.then(() => {
this.updateStatus(`Successfully rented ${this.state.movieTitle}`, 'success');
})
.catch((error) => {
this.updateStatus(`Encountered an error when checking out ${this.state.movieTitle}: ${error.message}`, 'error');
});
}

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>
<Router>
<div>
<header>
<Link to="/Search" className='col-1'>Search for Movies <i className="fa fa-search-plus"></i></Link>
<Link to="/library" className='col-1'>All Movies <i className="fa fa-file-movie-o"></i></Link>
<Link to="/customers" className='col-1'>Customers <i className="fa fa-group"></i></Link>

<p className='col-1'>Current Customer: {this.state.customerName}</p>
<p className='col-1'>Current Movie: {this.state.movieTitle}</p>
<button
className='col-1'
onClick={this.createNewRental}
>
Check Out
</button>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
<Status type={this.state.status.type} message={this.state.status.message}/>
<h1 className="tagline"> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! </h1>
<h1 className="tagline"> Like Netflix, but not as Convenient </h1>
<h1 className="tagline"> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! </h1>

<Route
path="/search"
render={() => <Search
updateStatusCallback={this.updateStatus}/>}
/>
<Route
path="/library"
render={()=> <Library
updateCurrentMovieCallback={this.updateCurrentMovie}
displayCurrentMovieCallback={this.displayCurrentMovie}
updateStatusCallback={this.updateStatus}/>}
/>
<Route
path="/customers"
render={() => <CustomerList
updateCurrentCustomerCallback={this.updateCurrentCustomer}
displayCurrentCustomerCallback={this.displayCurrentCustomer}
updateStatusCallback={this.updateStatus}/>}
/>
</div>
</Router>
);
}
}
Expand Down
Binary file added src/backgroundImage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading