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

Ampers: Nora Peters & Monalisa Chatterjee #7

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
22b8a21
app return VideoStore component
MonalisaC Jun 18, 2018
00779d1
initial setup
npeters5 Jun 18, 2018
0d2560b
Used react router to display nav
MonalisaC Jun 18, 2018
3f26455
add search component and css
npeters5 Jun 18, 2018
48bbdaf
Merge branch 'master' of https://github.com/npeters5/video-store-cons…
MonalisaC Jun 18, 2018
abe0604
Merge branch 'master' into nora-dev
npeters5 Jun 18, 2018
82400bb
add constructor, state and callbacks for selection
MonalisaC Jun 19, 2018
32ca8f0
Added customer and customerList component
MonalisaC Jun 19, 2018
7782c88
adds Customer component and stylesheet
npeters5 Jun 19, 2018
c7f8162
adds SearchForm component with callback on submit
npeters5 Jun 19, 2018
9c5de36
Fixed bug related to select customer
MonalisaC Jun 19, 2018
78f0ffa
adds Video component
npeters5 Jun 19, 2018
a149084
removes Search component and stylesheet, updates package json
npeters5 Jun 19, 2018
e48c9ae
Added selection component
MonalisaC Jun 19, 2018
39297cb
Add Rental Library and movie component
MonalisaC Jun 19, 2018
a566ed1
refactors VideoStore to hold selectedmovie & customer instead of coll…
npeters5 Jun 19, 2018
fe8c67b
merge conflicts resolved
npeters5 Jun 19, 2018
e47923f
using the same movie component
MonalisaC Jun 20, 2018
9ecfc9b
Changed SearchResult to import from movie
MonalisaC Jun 20, 2018
0df74ff
add checkout feature
MonalisaC Jun 20, 2018
f0c3e38
refactors SearchResults to have movie instead of video sub components
npeters5 Jun 20, 2018
6550188
merge conflict resolved
npeters5 Jun 20, 2018
36372eb
implements StatusBar component, touching related subcomponents
npeters5 Jun 21, 2018
73262c9
implements FeaturedFilms component. Not ideal - duplication from Rent…
npeters5 Jun 22, 2018
44b93be
super cool styling
npeters5 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
114 changes: 114 additions & 0 deletions package-lock.json

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

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "1.1.4"
"react-marquee": "^1.0.0",
"react-marquee-double": "^0.1.8",
"react-meta-tags": "^0.4.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4",
"react-text-marquee": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
}
4 changes: 4 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

body {
background-color: #2067B2;
}
12 changes: 2 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import VideoStore from './components/VideoStore'

class App extends Component {
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>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
<VideoStore url="http://localhost:3001"/>
);
}
}
Expand Down
Empty file added src/components/Customer.css
Empty file.
16 changes: 16 additions & 0 deletions src/components/Customer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { Component } from 'react';
import './Customer.css';

const Customer = (props) => {
// {"id":1,"name":"Shelley Rocha","registered_at":"2015-04-29T14:54:14.000Z","address":"Ap #292-5216 Ipsum Rd.","city":"Hillsboro","state":"OR","postal_code":"24309","phone":"(322) 510-8695","account_credit":13.15,"movies_checked_out_count":0}
return (
<div>
<div>{props.customer.name} (Checked out: {props.customer.movies_checked_out_count})</div>
<div>{props.customer.address}</div>
<div>{props.customer.city} {props.customer.state} {props.customer.postal_code}</div>
<div>{props.customer.phone}</div>
</div>
);
}

export default Customer;
Empty file added src/components/CustomerList.css
Empty file.
59 changes: 59 additions & 0 deletions src/components/CustomerList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';

import './CustomerList.css';
import Customer from './Customer'

class CustomerList extends Component {
constructor() {
super();
this.state = {
customers: [],
};
}

componentDidMount() {
this.props.setStatus('Loading customers...', 'pending');
axios.get(`${this.props.url}/customers`)
.then( (response) => {
console.log( response.data );
this.setState({
customers: response.data
});
this.props.setStatus(`Loaded ${response.data.length} customers`, 'success');
} )
.catch( (error) => {
this.props.setStatus(`Failed to load customers: ${error.message}`, 'error');
console.log("got to the error");
console.log(error);
} );
}

onClickSelect(e, customer) {
this.props.selectCustomerCallback(customer);
}

render () {
const customers = this.state.customers.map((customer, index) => {
return (
<div key={index}>
<Customer customer={customer}/>
<div><button onClick={ (e) => this.onClickSelect(e, customer) }>Select Customer</button></div>
</div>
)
})
return (
<div>
{customers}
</div>
);
}
}

CustomerList.propTypes = {
url: PropTypes.string.isRequired,
selectCustomerCallback: PropTypes.func.isRequired,
};

export default CustomerList;
19 changes: 19 additions & 0 deletions src/components/FeaturedFilms.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
h2 {
text-align: center;
margin-bottom: 50px;
}

.features-container {
display: grid;
/*grid-template-columns: 1fr 1fr 1fr;*/
/*grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));*/
grid-template-columns: repeat(auto-fit, 186px);
grid-template-rows: auto;
justify-items: center;
justify-content: space-evenly;
}

.grid-item {
justify-self: center;
align-items: center;
}
61 changes: 61 additions & 0 deletions src/components/FeaturedFilms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
import './FeaturedFilms.css';
import Movie from './Movie'


class FeaturedFilms extends Component {
constructor() {
super();
this.state = {
movies: [],
};
}

componentDidMount() {
axios.get(`${this.props.url}/movies`)
.then( (response) => {
console.log( response.data );
this.setState({
movies: response.data
});
} )
.catch( (error) => {
this.props.setStatus(`Failed to load movies: ${error.message}`, 'success');
});
}

onClickSelect(e, movie) {
this.props.selectMovieCallback(movie);
e.preventDefault();
}

render () {
let movies = this.state.movies.map((movie, index) => {
return (
<div className="grid-item" key={index}>
<div>
<button onClick={ (e) => this.onClickSelect(e, movie) }>Select This Movie
</button>
</div>
<Movie movie={movie}/>
</div>
)
})
movies = movies.sort(() => .5 - Math.random());
movies = movies.slice(0,3);
return (
<div className="features-container">
{movies}
</div>
);
}
}

FeaturedFilms.propTypes = {
// url: PropTypes.string.isRequired,
// selectMovieCallback: PropTypes.func.isRequired,
};

export default FeaturedFilms;
Empty file added src/components/Movie.css
Empty file.
Loading