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

Ports - Sav & Angela #9

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
6a9d1c1
added components folder and MovieLibrary component
AngelaOh Jun 24, 2019
6a3504e
router dom installed
qqdipps Jun 24, 2019
e7943c0
Merge branch 'master' of https://github.com/AngelaOh/video-store-cons…
qqdipps Jun 24, 2019
2a2b380
created MovieLibrary component
AngelaOh Jun 24, 2019
46e25c8
basic routes set up for homepage
qqdipps Jun 24, 2019
9d899c4
Merge pull request #1 from AngelaOh/homepage
AngelaOh Jun 24, 2019
1237652
able to view list of movies with MovieLibrary and Movie components
AngelaOh Jun 24, 2019
39d95d1
fixed merge conflicts
AngelaOh Jun 24, 2019
ff18067
Merge pull request #2 from AngelaOh/ao/movie_library_react
qqdipps Jun 24, 2019
1968180
passing callback func exploration
qqdipps Jun 24, 2019
acf296c
Merge branch 'master' into customerList
qqdipps Jun 24, 2019
49fbbd1
addeds select button in Movie component
AngelaOh Jun 24, 2019
66588de
set up api request for customers didmount
qqdipps Jun 24, 2019
2fe1ae9
fixed bunches of bugs
qqdipps Jun 24, 2019
073a42d
added customer information to component
qqdipps Jun 24, 2019
63c3327
trying to add callback function for selectMovie
AngelaOh Jun 24, 2019
6dc9a8d
add movie callback function connected
AngelaOh Jun 24, 2019
07d57f4
added selecting customer functionality
qqdipps Jun 24, 2019
55cf9e2
passing movie as prop when selecting one movie
AngelaOh Jun 24, 2019
62d878a
Merge pull request #4 from AngelaOh/ao/movie_library_select
qqdipps Jun 24, 2019
c4986f2
merge conf
qqdipps Jun 24, 2019
812a319
moved axios api request into separate method
AngelaOh Jun 25, 2019
100702f
fixed indentation and erased comments
AngelaOh Jun 25, 2019
94ca94c
used spread operator to pass movie object into Movie
AngelaOh Jun 25, 2019
fe19caf
more syntax cleanup
AngelaOh Jun 25, 2019
2e682ca
added message in Router if movie is selected
AngelaOh Jun 25, 2019
6e50bfa
Merge pull request #5 from AngelaOh/ao/movie_library_refactorings
qqdipps Jun 25, 2019
1cbb959
refactored homepage to reflect code style changes and temp display of…
qqdipps Jun 25, 2019
69b84c3
fixed display bug for customer
qqdipps Jun 25, 2019
3bc44e3
added a get request to Rails API in MovieSearch
AngelaOh Jun 25, 2019
ce0fb47
Merge branch 'master' of https://github.com/AngelaOh/video-store-cons…
AngelaOh Jun 25, 2019
333ca4b
set up scaffolding for checkOut component
qqdipps Jun 25, 2019
06d9c70
added lifecyle func to derive states from props after intialization o…
qqdipps Jun 25, 2019
acaad7a
sets state so SearchedMovies returns all movies from external databas…
AngelaOh Jun 25, 2019
8dda284
DOM renders list of searched movies
AngelaOh Jun 25, 2019
acf30f3
refactored to functional componenet with callback, state not req
qqdipps Jun 25, 2019
3c6ffc8
Merge pull request #6 from AngelaOh/ao/movie_search
qqdipps Jun 25, 2019
f4cbd3e
removed console.log
qqdipps Jun 25, 2019
1be7acd
Merge pull request #7 from AngelaOh/checkOut
AngelaOh Jun 25, 2019
980a77e
added addToLibrary button
AngelaOh Jun 25, 2019
6e87710
added post request for rental to callback, and update state to clear …
qqdipps Jun 25, 2019
fcd85b6
Merge pull request #8 from AngelaOh/checkOut
AngelaOh Jun 25, 2019
581cc73
Merge branch 'master' into ao/add_to_library
AngelaOh Jun 25, 2019
d6080da
merge resolved
qqdipps Jun 25, 2019
ae532a3
added proptypes to all child components
AngelaOh Jun 25, 2019
d552a73
added customer.js proptypes
AngelaOh Jun 25, 2019
43a3d47
finished PropTypes and erased unnecessary console.logs
AngelaOh Jun 25, 2019
42228cd
Merge pull request #10 from AngelaOh/ao/add_proptypes
AngelaOh Jun 25, 2019
f285f2b
added dynamic button display to movie
qqdipps Jun 25, 2019
d08a45b
conflict resolved
qqdipps Jun 25, 2019
937d7dc
debug conflict
qqdipps Jun 25, 2019
330d6c5
Merge pull request #11 from AngelaOh/DynamicButtonDisplay
AngelaOh Jun 25, 2019
365cbd1
added callback error massage method to movieSearch
qqdipps Jun 26, 2019
9c084df
added callback error massage method to movieLibrary
qqdipps Jun 26, 2019
f4fa53e
added callback error massage method to customerList
qqdipps Jun 26, 2019
f50a6f9
added post request to add movie from exernal into library
AngelaOh Jun 26, 2019
1a379f8
erased unnecessary console.logs
AngelaOh Jun 26, 2019
24b4948
Merge pull request #12 from AngelaOh/ao/add_to_library_axios
qqdipps Jun 26, 2019
c5c4058
added Error Message component and implemeted callback func
qqdipps Jun 26, 2019
562322f
added bootstrap
AngelaOh Jun 26, 2019
1456f4b
implemented clear error callback func and sent to components
qqdipps Jun 26, 2019
a468238
Merge branch 'master' into errorHandling
AngelaOh Jun 26, 2019
4ccca71
Merge pull request #13 from AngelaOh/errorHandling
AngelaOh Jun 26, 2019
b870dd9
added bootstrap button
AngelaOh Jun 26, 2019
b00d146
added bootstrap cards for movie list display
AngelaOh Jun 26, 2019
e7a72c9
added bootstrap nav bar
AngelaOh Jun 26, 2019
dd11799
added customer cards
AngelaOh Jun 26, 2019
ff99ff5
Merge pull request #14 from AngelaOh/ao/styling_movies
qqdipps Jun 27, 2019
839da2f
format auto
qqdipps Jun 27, 2019
e066474
added welcomComponent and display logic
qqdipps Jun 27, 2019
759a65a
Merge branch 'master' into welcomeComponent
qqdipps Jun 27, 2019
3f60144
fixed reload bug
qqdipps Jun 27, 2019
f97ae6e
rearrange error placement and added boot strap alert to error
qqdipps Jun 27, 2019
af4933c
fixed bug in chechout for undfined func
qqdipps Jun 27, 2019
9a9cd3d
Merge branch 'welcomeComponent' into errorStyle
qqdipps Jun 27, 2019
8ef25f7
styling and rearranging selected comp for CheckOut, looks ok, not great
qqdipps Jun 27, 2019
ef08482
Merge pull request #15 from AngelaOh/welcomeComponent
AngelaOh Jun 27, 2019
622c94f
Merge pull request #16 from AngelaOh/errorStyle
AngelaOh Jun 27, 2019
7cfcbc8
Merge pull request #17 from AngelaOh/checkOutStyle
AngelaOh Jun 27, 2019
a8b44b8
added message when movie is added to library
AngelaOh Jun 27, 2019
1b26d3e
Merge pull request #18 from AngelaOh/ao/add_to_library_message
AngelaOh Jun 27, 2019
831655f
refactoring errormessage to generic alert component
qqdipps Jun 27, 2019
73d20eb
merge conflict resolve in imports
qqdipps Jun 27, 2019
05ead74
added modal to show movie information on side
AngelaOh Jun 27, 2019
d82e2d4
added margins for movie list
AngelaOh Jun 27, 2019
dd975d7
fixed card sizes to be uniform
AngelaOh Jun 28, 2019
91f43cd
fixed button on movie
AngelaOh Jun 28, 2019
584cc39
refactoring message components to Alert
qqdipps Jun 28, 2019
8b7a108
refactored MovieSearch errormessage handling to alerts
qqdipps Jun 28, 2019
7840cba
refactored error messages to handling alerts
qqdipps Jun 28, 2019
7b67c43
finished cleaning up and refactoring alerts and related callback func
qqdipps Jun 28, 2019
7dc7daf
removed unused var
qqdipps Jun 28, 2019
0b51c53
Merge pull request #19 from AngelaOh/testing-modal
qqdipps Jun 28, 2019
bfd4725
Merge branch 'sd/refactor-error-to-alert'
qqdipps Jun 28, 2019
787d5dd
updated add to library logic so button changes on click
qqdipps Jun 28, 2019
d9e0e7e
updating proptypes, func naming readability
qqdipps Jun 28, 2019
ac3d888
adding more prop types
qqdipps Jun 28, 2019
f856c96
added prop types for custom movie attr props
qqdipps Jun 28, 2019
67aaf16
changed select to selected on click
qqdipps Jun 28, 2019
b94497a
added button changes
qqdipps Jun 28, 2019
73687d4
Merge pull request #22 from AngelaOh/propTypes-double-check
AngelaOh Jun 28, 2019
337267c
Merge pull request #23 from AngelaOh/select-btn-change
AngelaOh Jun 28, 2019
aac4513
alpha display of movies
qqdipps Jun 28, 2019
e9676db
Merge pull request #24 from AngelaOh/alpha-display
qqdipps Jun 28, 2019
fec100a
disabled button if movies have already been added
AngelaOh Jun 28, 2019
4157c08
Merge pull request #25 from AngelaOh/movie_button
AngelaOh Jun 28, 2019
9dc5049
added disabled button for movie selected, comented out sorting line i…
AngelaOh Jun 28, 2019
98f1ca5
fixing alpha bug
qqdipps Jun 28, 2019
1551251
Merge pull request #26 from AngelaOh/disable_movie_library_button
qqdipps Jun 28, 2019
385d496
Merge branch 'master' into test_master
qqdipps Jun 28, 2019
5e46d85
Merge pull request #27 from AngelaOh/test_master
qqdipps Jun 28, 2019
053bbf2
got rid of spaces
AngelaOh Jun 28, 2019
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
407 changes: 407 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"bootstrap": "^4.3.1",
"react": "^16.8.6",
"react-bootstrap": "^1.0.0-beta.9",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Expand Down Expand Up @@ -36,5 +37,8 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
12 changes: 4 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import Homepage from './component/Homepage';
import './App.css';

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>
<Homepage />
</div>

);
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/component/Alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';

const Alert = ({ text, type }) => {
return (
<div className={`alert alert-${type}`}>
<p>Alert: {text}</p>
</div>
);
};

export default Alert;
27 changes: 27 additions & 0 deletions src/component/CheckOut.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.checkoutContainer{
/* display: flex;
flex-flow: column;
font-size: 1.5em; */

}

.container {
display: flex;
justify-content: space-around;
text-align: center;
width: 600px;

}

.content {
display: inline;
/* align-self: left; */
}

h2{
font-size: 1em;
}

.sml-img{
height: 50px;
}
46 changes: 46 additions & 0 deletions src/component/CheckOut.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import PropTypes from 'prop-types';
import './CheckOut.css';
import Alert from './Alert';

const CheckOut = ({ customer, movie, checkOutCallBack }) => {
return (
<div className="checkoutContainer jumbotron jumbotron-fluid">
{customer && displayCustomer(customer)}
{movie && displayMovie(movie)}
{customer && movie && (
<button className="btn btn-primary" onClick={checkOutCallBack}>
Check Out Movie
</button>
)}
</div>
);
};

const displayCustomer = customer => {
return (
<article className="container lead">
<h2 className="content">Customer: {customer.name} </h2>
<p className="content">ID: {customer.id} </p>
<p className="content">Account Credit: {customer.account_credit} </p>
</article>
);
};

const displayMovie = movie => {
return (
<article className="container my-4">
<h2 className="content">Movie: {movie.title} </h2>
<p className="content">ID: {movie.id} </p>
<img className="sml-img" src={movie.image_url} alt="" />
</article>
);
};

CheckOut.propTypes = {
movie: PropTypes.string,
customer: PropTypes.string,
checkOutCallback: PropTypes.func,
};

export default CheckOut;
3 changes: 3 additions & 0 deletions src/component/Customer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.customer-card {
padding-top: 15px;
}
30 changes: 30 additions & 0 deletions src/component/Customer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import PropTypes from 'prop-types';
import './Customer.css'

const Customer = props => {
return (
<div className='customer-card card bg-light mb-3'>
<h2 className='card-title'>
{props.name} ID: {props.id}
</h2>
<div className='card-body'>
<p>Number of movies checked out: {props.movies_checked_out_count}</p>
<p>Account credit: {props.account_credit}</p>
<button className='btn btn-outline-success' onClick={() => props.customerSelectCallback({ ...props })}>
SELECT
</button>
</div>
</div>
);
};

Customer.propTypes = {
name: PropTypes.string,
id: PropTypes.number,
movies_checked_out_count: PropTypes.number,
account_credit: PropTypes.number,
customerSelectCallback: PropTypes.func
}

export default Customer;
8 changes: 8 additions & 0 deletions src/component/CustomerList.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.customer-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
margin-top: 25px;

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

class CustomerList extends Component {
constructor(props) {
super(props);
this.state = {
customerList: [],
};
}
customerCollection = () => {
return this.state.customerList.map((customer, i) => {
return (
<Customer
{...customer}
key={i}
customerSelectCallback={this.props.customerSelectCallback}
/>
);
});
};

componentDidMount = () => {
this.props.alertCallback('', '');
this.props.hideWelcomeCallback();
this.getCustomers();
};

getCustomers = () => {
URL = 'http://localhost:3000';
axios
.get(URL + '/customers')
.then(response => {
const customerList = response.data.map(customer => {
return customer;
});
this.setState({
customerList: customerList,
});

if (customerList.length === 0) {
const errorMessage = 'No customers in system.';
this.props.alertCallback(errorMessage, 'danger');
}
})
.catch(error => {
console.log(error.message);
this.props.alertCallback(error.message, 'danger');
});
};

render() {
return (
<div className="customer-container">{this.customerCollection()}</div>
);
}
}

CustomerList.propTypes = {
customerSelectCallback: PropTypes.func,
alertCallback: PropTypes.func,
hideWelcomeCallback: PropTypes.func,
};

export default CustomerList;
Empty file added src/component/Homepage.css
Empty file.
Loading