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

Kate & Leti - Ampers - VideoStoreConsumer #13

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
353a3e2
Setting up react files
LetiTran Jun 18, 2018
63a25d2
starts components folder
Oh-KPond Jun 18, 2018
e7ceeae
gets movie component to render
Oh-KPond Jun 19, 2018
a81dd82
creates draft Library and Search Results movie collections
Oh-KPond Jun 19, 2018
47ecfcd
Merge branch 'master' into feature_movie-component
Oh-KPond Jun 19, 2018
4934c01
Created a Customer Collection and a Customer Component with a checkbo…
LetiTran Jun 19, 2018
b153b59
Merge pull request #1 from LetiTran/feature_movie-component
LetiTran Jun 19, 2018
21f96c4
Merge pull request #2 from LetiTran/feature_customer-component
Oh-KPond Jun 19, 2018
1c4b808
adds axios and gets library movie collection
Oh-KPond Jun 19, 2018
1059dcc
creates a movie list based on a static query, and fixes showing image
Oh-KPond Jun 19, 2018
3213153
Getting all customers from our API with axios to create a table of cu…
LetiTran Jun 19, 2018
02b6578
Changed checkbox to button and changed conditional statement for the …
LetiTran Jun 19, 2018
4a8432e
Merge pull request #3 from LetiTran/feature_search-results-list-movie…
LetiTran Jun 19, 2018
0a4a338
Merged with master and feature_customerCollection-axios and Fixed cus…
LetiTran Jun 19, 2018
09ae194
Merge branch 'master' into feature_customerCollection-axios
Oh-KPond Jun 19, 2018
e4ea0f2
Merge pull request #4 from LetiTran/feature_customerCollection-axios
Oh-KPond Jun 19, 2018
ca7f4b9
adds router and header to app js
Oh-KPond Jun 19, 2018
b3775cc
Merge pull request #5 from LetiTran/feature_header-component
LetiTran Jun 19, 2018
8934080
merging..
LetiTran Jun 19, 2018
ddc340c
Merged with routes
LetiTran Jun 19, 2018
2037238
Added components SelectionBar and SelectedCustomer - displaying it tr…
LetiTran Jun 19, 2018
a87b1e0
Changed costumer selection logic to App.js and its state. Rendering S…
LetiTran Jun 19, 2018
77f1aa2
Merge pull request #6 from LetiTran/feature_selectedCustomerComponent
Oh-KPond Jun 19, 2018
0f98424
creates search form and form functionallity to query api
Oh-KPond Jun 19, 2018
3d98a6a
Merge pull request #7 from LetiTran/feature_search-form-component
LetiTran Jun 19, 2018
157c417
code clean up
Oh-KPond Jun 19, 2018
7e19ab1
Adds selectedMovie component and selection function on Library.
LetiTran Jun 19, 2018
1bc8bb0
Added movie and customer id elements to Library and Customer componen…
LetiTran Jun 20, 2018
376859c
Adding isRequired to Movie prop vlidations
LetiTran Jun 20, 2018
394f789
Makes it possible to rent a movie given the movie and slected custome…
LetiTran Jun 20, 2018
8bf9d65
Calculates the due date for a new rental base d on today's date + 7 d…
LetiTran Jun 20, 2018
72c5d17
Disbales 'rent' button if customer or movie are not selected.
LetiTran Jun 20, 2018
a1231da
Merge pull request #8 from LetiTran/feature_checkout-rental
Oh-KPond Jun 20, 2018
4f27ab7
merges master and finishes add movie to library functionality
Oh-KPond Jun 20, 2018
312e702
Merge pull request #9 from LetiTran/feature_save-movie-to-library
LetiTran Jun 20, 2018
6491699
Clears state after renting the movie.
LetiTran Jun 20, 2018
4129874
Merge pull request #10 from LetiTran/feature_checkout-rental
Oh-KPond Jun 20, 2018
973064c
Adds a modal component and displays it in App.js -- Still needs lots …
LetiTran Jun 21, 2018
f7ec71d
Fixes modal for checked-out movie confirmatio. Modal display logic is…
LetiTran Jun 21, 2018
bb5e171
Deletes unecessary propTypes - they were used just for displaying res…
LetiTran Jun 21, 2018
71f7cc7
attemps to show search results
Oh-KPond Jun 21, 2018
5be05b0
Merge pull request #11 from LetiTran/feature_modal-rentingConfirmation
Oh-KPond Jun 21, 2018
298998a
conditional component try
Oh-KPond Jun 21, 2018
5c3b5a7
Merge branch 'master' of https://github.com/LetiTran/video-store-cons…
LetiTran Jun 21, 2018
022f946
Fixes merge error from before with Checkout Modal
LetiTran Jun 21, 2018
b750285
Changes prop validation because of Search form error given without id.
LetiTran Jun 21, 2018
08cb25b
Adds a toggle function for displaying searchResults route path or not.
LetiTran Jun 21, 2018
657aa01
Merge pull request #12 from LetiTran/feature_show-search-results-route
Oh-KPond Jun 21, 2018
37da272
Adds modal confirmation for adding a movide from search-results to li…
LetiTran Jun 21, 2018
96c25a5
Fixes little Moda bug with file that was beeing imported.
LetiTran Jun 21, 2018
2ef3352
Merge pull request #13 from LetiTran/feature_modal-adding-to-libraryC…
Oh-KPond Jun 22, 2018
dea91e1
makes the customer table look pretty
Oh-KPond Jun 22, 2018
b0a1032
Added prop validaiton for new func.
LetiTran Jun 22, 2018
5cd6f32
Merge branch 'feature_modal-adding-to-libraryConfirmation' because of…
LetiTran Jun 22, 2018
0609eff
styles movie and movie collections components
Oh-KPond Jun 22, 2018
f669e24
Merge pull request #14 from LetiTran/feature_movie-customer-styling
LetiTran Jun 22, 2018
de2b7ed
adds styling to select bar and some styles to the nav
Oh-KPond Jun 22, 2018
259ac3c
Merge pull request #15 from LetiTran/feature_style-select-bar
LetiTran Jun 22, 2018
89c77c0
Formats release date for movies.
LetiTran Jun 22, 2018
0774f78
Fixes typo in SelectionBar that was causing a little bug on button to…
LetiTran Jun 22, 2018
5ce2f55
Adds $ sign to customer credit.
LetiTran Jun 22, 2018
9079f57
styles modals and select customer button
Oh-KPond Jun 22, 2018
01a442a
styles header
Oh-KPond Jun 22, 2018
a5c88d8
Merge pull request #16 from LetiTran/feature_style-select-bar
LetiTran 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.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4"
},
"scripts": {
Expand All @@ -13,4 +15,4 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
}
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
-->
<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=Open+Sans" rel="stylesheet">
<!--
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 Down
32 changes: 17 additions & 15 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
.nav ul {
display: flex;
justify-content: center;
align-items: baseline;
}

.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
.nav ul li {
list-style: none;
margin-right: 2em;
color: #00887A;
}

.App-title {
font-size: 1.5em;
*:focus {
outline:none;
}

.App-intro {
font-size: large;
.header {
display: flex;
justify-content: space-between;
align-items: baseline;
padding: 0 5%;
}

@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
h1 {
font-size: 3.5em;
}
173 changes: 163 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,172 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { BrowserRouter as Router, Route, Link, Switch, Redirect } from "react-router-dom";
import CustomerCollection from './components/CustomerCollection.js'
import LibraryCollection from './components/LibraryCollection.js'
import SearchForm from './components/SearchForm.js'
import SearchResults from './components/SearchResults.js'
import SelectionBar from './components/SelectionBar.js'
import CheckOutModal from './components/CheckOutModal.js'
import AddtoLibModal from './components/AddtoLibModal.js'

class App extends Component {

constructor() {
super();
this.state = {
selectedCustomerName: 'Please Select a Customer',
selectedCustomerId: 0,
selectedMovieName: 'Please Select a Movie',
selectedMovieId: 0,
searchQuery: '',
checkoutIsOpen: false,
showSearch: false,
addLibIsOpen: false
};
}

selectionCustomerBarComponent = (customerName, customerId) => {
// preventDefault();
const updateState = {};

if(customerName === this.state.selectedCustomerName && this.state.selectedCustomerName !== 'Please Select a Customer'){
updateState["selectedCustomerName"] = 'Please Select a Customer';
updateState["selectedCustomerId"] = 0;
this.setState(updateState);
} else {
updateState["selectedCustomerName"] = customerName;
updateState["selectedCustomerId"] = customerId;
this.setState(updateState);
}
}


selectionMovieBarComponent= (movieInfo) => {
const updateState = {};

if(movieInfo.title === this.state.selectedMovieName && this.state.selectedMovieName !== 'Please Select a Movie'){
updateState["selectedMovieName"] = 'Please Select a Movie';
updateState["selectedMovieId"] = 0;
this.setState(updateState);
} else {
updateState["selectedMovieName"] = movieInfo.title;
updateState["selectedMovieId"] = movieInfo.id;
this.setState(updateState);
}
}

clearState =()=>{
this.setState({
selectedCustomerName: 'Please Select a Customer',
selectedCustomerId: 0,
selectedMovieName: 'Please Select a Movie',
selectedMovieId: 0,
});
}

searchQuery = (query) => {
this.setState({
searchQuery: query,
});
this.toggleSearchresults("show");
}

renderSearchResults() {
if(this.state.showSearch) {
return (
<Redirect to='/search'/>
);
}
}


toggleCheckoutModal = () => {
this.setState({
checkoutIsOpen: !this.state.checkoutIsOpen
});
}

toggleLibModal= () => {
this.setState({
addLibIsOpen: !this.state.addLibIsOpen
});
}


toggleSearchresults = (bool) => {
if(bool === "show") {
this.setState({
// showSearch: !this.state.showSearch
showSearch: bool
});
} else {
this.setState({
// showSearch: !this.state.showSearch
showSearch: false
});
}
}



render() {
const Library = () => (
<LibraryCollection selectionBarComponentCallBack={this.selectionMovieBarComponent}/>
)

const Customers = () => (
<CustomerCollection selectionBarComponentCallBack={this.selectionCustomerBarComponent}
/>
)

const Search = () => (
<SearchResults query={this.state.searchQuery} toggleLibModalCallBack = {this.toggleLibModal} />
)


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>
<Router>
<div className="App">
<header className="header">
<h1>THE Video Store</h1>
<nav className="nav">
<ul>
<li>
<SearchForm searchQueryCallback={this.searchQuery} />
</li>
<li>
<Link to="/library" onClick={this.toggleSearchresults}>Library</Link>
</li>
<li>
<Link to="/customers" onClick={this.toggleSearchresults}>Customers</Link>
</li>
<li>{this.renderSearchResults()}</li>
</ul>
</nav>
</header>

<SelectionBar
customerName={this.state.selectedCustomerName} movieName={this.state.selectedMovieName}
customerId={this.state.selectedCustomerId}
movieId={this.state.selectedMovieId}
clearStateCallBack = {this.clearState}
toggleCheckoutModalCallBack = {this.toggleCheckoutModal}
/>

<CheckOutModal show={this.state.checkoutIsOpen}
onClose={this.toggleCheckoutModal} />

<AddtoLibModal show={this.state.addLibIsOpen}
onClose={this.toggleLibModal} />

<Switch>
<Route path="/search" component={Search} />
<Route path="/library" component={Library} />
<Route path="/customers" component={Customers} />
</Switch>

</div>
</Router>
);
}
}
Expand Down
Loading