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

addy & lindsay - edges - video store #20

Open
wants to merge 75 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8f6503b
add react router
addisoncole Dec 18, 2018
67aa3d0
add react router to index.js, add header placeholder for nav bar cont…
addisoncole Dec 18, 2018
9d1e17b
add component folder. npm install axios. create NewRental component, …
addisoncole Dec 18, 2018
c24fe15
add Functional Component Template for development. Add Selector compo…
addisoncole Dec 18, 2018
154d0c6
created basic framework for 3 nav buttons
elle-terch Dec 18, 2018
600dfb7
added placeholder buttons for nav components
elle-terch Dec 18, 2018
1276c0d
renamed nav components
elle-terch Dec 18, 2018
4196586
added components
elle-terch Dec 18, 2018
29bb439
renamed components
elle-terch Dec 18, 2018
99d9945
merge
addisoncole Dec 18, 2018
228a123
added client side Links for Search Customers and Library. Cleaned up …
addisoncole Dec 18, 2018
f43447a
created pieces for movie component
elle-terch Dec 18, 2018
4d3db6b
connected link in nav component to routes which render library, custo…
addisoncole Dec 18, 2018
dda8809
fixed merge conflicts.
addisoncole Dec 18, 2018
d6d0642
removed Library component, and connected library section component to…
addisoncole Dec 18, 2018
c8b5923
added pieces for customer component
elle-terch Dec 18, 2018
387b194
rendered customer component in customer section
elle-terch Dec 18, 2018
4cd85ab
merge with master
elle-terch Dec 18, 2018
108b72b
hooked customersection component up to API
elle-terch Dec 18, 2018
e28a074
connect library component to rails api with axios call during mount.
addisoncole Dec 18, 2018
53e003a
Merge branch 'master' of https://github.com/addisoncole/video-store-c…
addisoncole Dec 18, 2018
1e702dd
Merge branch 'customers_api'
elle-terch Dec 18, 2018
2872d0e
added missing .css files for corresponding components. Create search …
addisoncole Dec 18, 2018
ae78c05
created callback functions to send info for a specific movie
elle-terch Dec 18, 2018
7085dc9
merge with master
elle-terch Dec 18, 2018
235fbf3
created ability to select a video from library
elle-terch Dec 18, 2018
2f00b6f
searchBar component passes form state to search section and onsubmit …
addisoncole Dec 18, 2018
fe0a61f
add missing component css files.
addisoncole Dec 18, 2018
dfd98ca
Merge branch 'search'
addisoncole Dec 18, 2018
d4c15c8
created callback functions to select a customer for rental
elle-terch Dec 19, 2018
1343aa8
add onCall function to NewRental button, which calls callback functio…
addisoncole Dec 19, 2018
f6a736d
basic structure for axios post call for checking out a movie. works w…
addisoncole Dec 19, 2018
7561c5a
add axios, create initial state for app.js to maintain state of retur…
addisoncole Dec 19, 2018
260554d
spacing
addisoncole Dec 19, 2018
e8a361a
title change
addisoncole Dec 19, 2018
d6b0b2e
created function to add move from API to local library
elle-terch Dec 19, 2018
fce289f
Merge branch 'master' of https://github.com/addisoncole/video-store-c…
elle-terch Dec 19, 2018
68a6d4e
css for app and nav
addisoncole Dec 19, 2018
a9be211
created status message for checking out a movie
elle-terch Dec 19, 2018
b1e395d
add className to movie component. add missing proptypes.
addisoncole Dec 20, 2018
489833d
add missing propType to LibrarySection component. Add css flex box to…
addisoncole Dec 20, 2018
82d4b9c
add styling to movie to create card elements. Added fonts.
addisoncole Dec 20, 2018
fef69b4
fixed status message for checking out a movie
elle-terch Dec 20, 2018
e1872b4
added status messages for loading the movie library
elle-terch Dec 20, 2018
8e86753
added status messages for loading customers & errors
elle-terch Dec 20, 2018
e18d071
added proptypes
elle-terch Dec 20, 2018
3191c5b
added status for adding movie to library
elle-terch Dec 20, 2018
26d6c3f
add css styling to search component, nav bar and customer components.
addisoncole Dec 20, 2018
14d3cee
fixed merge conflicts
addisoncole Dec 20, 2018
e815a00
cleaned up some spacing and added missing PropTypes
addisoncole Dec 20, 2018
3dc2539
added proptypes to status bar
elle-terch Dec 20, 2018
bcad085
added proptypes to new rental
elle-terch Dec 20, 2018
b3af609
fixed status messages
elle-terch Dec 20, 2018
ec96cca
merging with master
elle-terch Dec 20, 2018
0b172c1
added number of checked out movies to customers
elle-terch Dec 20, 2018
027fc39
fixed movies per customer
elle-terch Dec 20, 2018
e51fc1b
updated conditional for nonexistent release date
elle-terch Dec 20, 2018
5385399
added ternary to create date to fix bug.
addisoncole Dec 20, 2018
11e4b8b
Merge branch 'master' of https://github.com/addisoncole/video-store-c…
addisoncole Dec 20, 2018
6ed6447
add styling touches to movie component and header.
addisoncole Dec 20, 2018
84f894d
add transition styling
addisoncole Dec 20, 2018
9e5426a
add styling to status bar
addisoncole Dec 21, 2018
a41cd90
add styling to status bar and customers. corrected search seaction to…
addisoncole Dec 21, 2018
99d5390
change header text color, add some styling to selector. ad dmissing p…
addisoncole Dec 21, 2018
b8b6abb
added sorting methods to library and customer sections. added styling…
addisoncole Dec 21, 2018
673b2b0
styling on selector and spacing.
addisoncole Dec 21, 2018
c63aa08
removed extraneous console.logs and fixed spacing and added missing s…
addisoncole Dec 21, 2018
ed25bee
added null option for title
elle-terch Dec 21, 2018
e0d2e29
styling on status bar, text color to fix scheme.
addisoncole Dec 21, 2018
63dabcf
add button and callback method to check in a movie for a customer. ch…
addisoncole Dec 21, 2018
af618dd
add spacing to header in customer component.
addisoncole Dec 21, 2018
7a599ff
add styling to movie and customer so that it is highlighted red if it…
addisoncole Dec 21, 2018
a964bb1
refactor error messages.
addisoncole Dec 21, 2018
df88a73
dry up css
addisoncole Dec 21, 2018
2698104
small style change to status bar gradient. animation package loaded, …
addisoncole Dec 21, 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
20,255 changes: 12,067 additions & 8,188 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
"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-router-dom": "^4.3.1",
"react-scripts": "^2.1.1",
"react-transition-group": "^2.5.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
4 changes: 3 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Major+Mono+Display|Raleway:thin,thinitalic,extralight,regular,bold,bolditalic,black,blackitalic" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -19,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Be Kind, Rewind</title>
</head>
<body>
<noscript>
Expand Down
45 changes: 28 additions & 17 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
.App {
text-align: center;

.video-store {
color: #bdc3c7;
}

.video-store__header {
display: flex;
flex-direction: row;
background-image: linear-gradient(to bottom, rgba(14, 16, 17, 1), rgba(255,0,0,0));
width: 100vw;
height: 15vh;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
.video-store__header a {
text-decoration: none;
}

.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;

.video-store__header h1 {
font-size: 3vw;
color: rgba(243, 156, 18,1.0);
margin-left: 1em;
margin-right: 1em;
text-shadow:-24px -0px 10px rgba(255,255,255,.2), -10px -0px 8px rgba(255,255,255,.6);
transition: color 4s;
}

.App-title {
font-size: 1.5em;
.video-store__header h1:hover {
color: rgba(245, 178, 55, 0);
text-shadow:-24px -0px 10px rgba(255,255,255,.2), -10px -0px 8px rgba(255,255,255,.6);
}

.App-intro {
font-size: large;
h1, h2, h3 {
font-family: 'Major Mono Display', monospace;
}

@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
body {
font-family: 'Raleway', sans-serif;
}
105 changes: 97 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,107 @@
import React, { Component } from 'react';
import logo from './logo.svg';

import { Route, Link } from 'react-router-dom'
import axios from 'axios';
import NewRental from './components/NewRental';
import Nav from './components/Nav';
import LibrarySection from './components/LibrarySection';
import CustomerSection from './components/CustomerSection';
import SearchSection from './components/SearchSection';
import StatusBar from './components/StatusBar';

import './App.css';

const MOVIE_RENTALS = "http://localhost:3000/rentals/";

class App extends Component {

constructor() {
super();

this.state = {
selectedCustomer: "",
selectedCustomerID: "",
selectedMovie: "",
returnDate: this.getReturnDay(),
status: {
statusClass: 'default',
statusMessage: ''
}
}
}

selectMovie = (movie) => {
this.changeStatus('success', `Selected ${movie.title}`)
this.setState({selectedMovie: movie.title })
}


selectCustomer = (customer) => {
this.changeStatus('success', `Selected ${customer.name}`)
this.setState({
selectedCustomer: customer.name,
selectedCustomerID: customer.id,
})
}

changeStatus = (style, message) => {
this.setState({
status: {
statusClass: style,
statusMessage: message
}
})
}

rentMovie = () => {
axios.post(MOVIE_RENTALS + this.state.selectedMovie + "/check-out?customer_id=" + this.state.selectedCustomerID + "&due_date=" + this.state.returnDate)
.then((response) => {
this.changeStatus('success', `${this.state.selectedCustomer} has checked out ${this.state.selectedMovie}`)
console.log(response.data)
})
.catch((error) => {
this.changeStatus('error', `${error.response.status}: ${error.response.statusText}`)
console.log(error.response)
});
}

checkInMovie = () => {
axios.post(MOVIE_RENTALS + this.state.selectedMovie + "/return?customer_id=" + this.state.selectedCustomerID)
.then((response) => {
this.changeStatus('success', `${this.state.selectedCustomer} has checked in ${this.state.selectedMovie}`)
console.log(response.data)
})
.catch((error) => {
this.changeStatus('error', `${error.response.status}: ${error.response.statusText}`)
});
}

getReturnDay = () => {

const date = new Date().getDate() + 5;
const month = new Date().getMonth() + 1;
const year = new Date().getFullYear();

return (year + '/' + month + '/' + date);
};

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>
<div className="video-store">
<header className="video-store__header">
<Link to= "/"><h1>Be Kind, Rewind&lt;&lt;</h1></Link>
<Nav />
<NewRental selectedCustomer={this.state.selectedCustomer} selectedMovie={this.state.selectedMovie} rentMovieCallBack={this.rentMovie}
checkInMovieCallBack={this.checkInMovie}/>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>

<StatusBar statusClass={this.state.status.statusClass} statusMessage={this.state.status.statusMessage}/>
<Route path="/" exact="true" render={() => <SearchSection changeStatusCallback = {this.changeStatus} />} />
<Route path="/library" render={() => <LibrarySection selectMovieCallback = {this.selectMovie} changeStatusCallback = {this.changeStatus} currentSelected = {this.state.selectedMovie}/>} />
<Route path="/customers" render={() => <CustomerSection selectCustomerCallback = {this.selectCustomer} changeStatusCallback = {this.changeStatus} currentSelected = {this.state.selectedCustomer}/>} />
<Route path="/search" render={() => <SearchSection changeStatusCallback = {this.changeStatus} />} />

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

import './NewComponent.css';

class NewComponent extends Component {
constructor(props) {
super(props);
}

render() {

return (
<div>
</div>
)
}
}

NewComponent.propTypes = {

};

export default NewComponent;
17 changes: 17 additions & 0 deletions src/components/.FunctionalComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import './FunctionalComponentTemplate.css';


const FunctionalComponent = (props) => {
return (
<div>
</div>
);
}

FunctionalComponent.propTypes = {

};

export default FunctionalComponent;
96 changes: 96 additions & 0 deletions src/components/Customer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.customer-card {
background-color: rgba(14, 16, 17, 1);
margin: 3vh;
box-shadow: 5px 8px 15px rgba(14, 16, 17, .7);
display: flex;
flex-direction: column;
text-align: center;
width: 200px;
height: 275px;
transition: box-shadow 2s;
}

.customer-card-selected {
background-color: rgba(14, 16, 17, 1);
margin: 3vh;
box-shadow: 5px 8px 15px rgba(14, 16, 17, .7);
display: flex;
flex-direction: column;
text-align: center;
width: 200px;
height: 275px;
transition: box-shadow 2s;
box-shadow: 5px 8px 20px rgba(192, 57, 43,.4),-5px 8px 20px rgba(192, 57, 43,.4);
}

.customer-card:hover{
box-shadow: 5px 8px 20px rgba(129, 236, 236,.4),-5px 8px 20px rgba(129, 236, 236,.4);
}

.customer-card h3 {
font-family: "Raleway", sans-serif;
font-size: 22px;
font-weight: 700;
text-shadow: 1px 1px 1px rgba(250,250,250,.4);
margin: .3em;
margin-top:.8em;
transition: text-shadow 2s;
}

.customer-card-selected h3 {
font-family: "Raleway", sans-serif;
font-size: 22px;
font-weight: 700;
text-shadow: 2px 2px 2px rgba(192, 57, 43,1);
margin: .3em;
margin-top:.8em;
transition: text-shadow 2s;
}

.customer-card:hover h3 {
text-shadow: 2px 2px 2px rgba(129, 236, 236,.7);
}

.customer-card h3 small, .customer-card-selected h3 small{
font-family: "Major Mono Display", sans-serif;
font-style: italic;
font-size: 16px;
}

.customer-card button, .customer-card-selected button {
font-family: 'Raleway', sans-serif;
border-radius: 5px;
padding: 10px 20px;
font-size: 18px;
font-weight: 700;
text-decoration: none;
text-shadow: 1px 1px 1px rgba(250,250,250,.4);
margin: 20px;
position: relative;
display: inline-block;
background-color: rgba(253, 203, 110,1.0);
border:none;
box-shadow: none;
text-align: center;
transition: background-color 1s;
}


.customer-card button:hover, .customer-card-selected button:hover {
background-color: rgba(245, 178, 55, 1);
}

.customer-card button:active, .customer-card-selected button:active {
transform: translate(0px, 1px);
-webkit-transform: translate(0px, 1px);
box-shadow: inset -2px -2px 0px 0px rgba(245, 178, 55, 1);
}

.member-date {
opacity: 0;
transition: 2s;
}

.customer-card:hover .member-date, .customer-card-selected:hover .member-date {
opacity: 1;
}
36 changes: 36 additions & 0 deletions src/components/Customer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import PropTypes from 'prop-types';
import './Customer.css';


const Customer = ({name, phone, movies, selectCustomerCallback, memberDate, currentSelected}) => {

const currentRentals = movies > 0 ? `${movies} movie(s) checked out` : "";
const displayMemberDate = memberDate.slice(0,4);
const styling = name === currentSelected ? "customer-card-selected" : "customer-card";

return (
<div className={styling}>
<h3>{name}</h3>
<div>
<h3><small>{phone}</small></h3>
<p>{currentRentals}</p>
</div>
<div>
<button onClick={selectCustomerCallback}>Select</button>
</div>
<p className="member-date"><small>Member since {displayMemberDate}</small></p>
</div>
)
}

Customer.propTypes = {
name: PropTypes.string,
phone: PropTypes.string,
movies: PropTypes.int,
selectCustomerCallback: PropTypes.func,
memberDate: PropTypes.string,
currentSelected: PropTypes.string,
};

export default Customer;
Loading