Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cbf8bc7
initial set up
mheshmati-tech Jun 22, 2020
5d978b9
added React Routes
mheshmati-tech Jun 23, 2020
dd8ee7c
enabled local api call from rails application to get the list of movi…
mheshmati-tech Jun 23, 2020
3421f6a
added main, navbar to render and link to individual components
mheshmati-tech Jun 23, 2020
278793b
added individual components for movie and customer
mheshmati-tech Jun 23, 2020
501cf67
added callback functions to select a user and movie
mheshmati-tech Jun 23, 2020
617c46a
CSS sheets for all
mulhoo Jun 24, 2020
f6f1eee
search component, in progress
mulhoo Jun 24, 2020
25e6719
search bar visible and working
mulhoo Jun 24, 2020
5c0d6c0
minor name change, customer->customerdetails, for clarity
mulhoo Jun 24, 2020
7084032
fixed url issue, search
mulhoo Jun 24, 2020
096e4d6
added functionality to allow users to add a movie to their library
mheshmati-tech Jun 24, 2020
974bf96
added functionality to render the selected user and movie to the navi…
mheshmati-tech Jun 24, 2020
633a6e8
added functionality to checkout a movie when there is a selected user…
mheshmati-tech Jun 24, 2020
e1ade67
restart
mulhoo Jun 26, 2020
c210fff
styling, movies return alphabetically
mulhoo Jun 26, 2020
04d8feb
styling
mulhoo Jun 26, 2020
3c47278
styling
mulhoo Jun 26, 2020
5e94fb5
styling of customers
mulhoo Jun 26, 2020
1c79ba4
fixed customer table
mulhoo Jun 26, 2020
1335b1c
homepage styling
mulhoo Jun 26, 2020
d4fceaa
further styling
mulhoo Jun 26, 2020
307674d
updates to movie view
mulhoo Jun 26, 2020
e990f84
updated homepage
mulhoo Jun 26, 2020
39764fe
background fix
mulhoo Jun 26, 2020
19e48c7
Merge pull request #1 from mulhoo/css
mulhoo Jun 26, 2020
18058e0
status flash
mulhoo Jun 26, 2020
0504fec
code cleanup
mulhoo Jun 26, 2020
c8a7852
flash message styling
mulhoo Jun 26, 2020
979f55d
flash messages working, customers alphabetized
mulhoo Jun 26, 2020
e1ec465
final styling, h1 h2
mulhoo Jun 26, 2020
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
10,330 changes: 5,853 additions & 4,477 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,32 @@
"version": "0.1.1",
"private": true,
"dependencies": {
"@material-ui/core": "^4.10.2",
"@material-ui/lab": "^4.0.0-alpha.56",
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"react": "^16.13.1",
"react-bootstrap": "^1.0.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.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"
]
}
}
100 changes: 95 additions & 5 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
.App {
Body {
text-align: center;
background-image: url("./backgroundimages/backgroundimage2.jpg");
height: 100%;
background-repeat: repeat;
background-attachment: fixed;
}

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

.App-header {
background-color: #222;
height: 150px;
.header {
padding: 20px;
color: white;
background-color: rgb(245, 242, 236);
}

.App-title {
Expand All @@ -26,3 +28,91 @@
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

* {
margin: 0;
padding: 0;
font-family: 'Times New Roman', Times, serif;
color: rgb(19, 15, 15)
}

h1 {
color: rgb(245, 242, 236);
padding-top: 50px;
font-size: 70px;
font-weight: bold;
-webkit-text-stroke: .02px black;
font-family: herculanum;
background-color: rgb(248, 149, 138);
border: 10px dotted black;
padding: 15px;
margin: 25px 200px;
background-clip: padding-box;
}

.header-nav {
width: 100%;
height: 50px;
background-color: rgb(245, 242, 236);
color: white;
font-size: 17px;
}

.header-first-row {
display: flex;
justify-content: space-between;
}

.selected {
font-size: 17px;
font-family: 'Times New Roman', Times, serif;
font-weight: lighter;
text-align: left;
padding: 3px;
}


.links {
padding-top: 30px;
padding-left: 20px;
display: flex;
align-items: center;
}

.nav-link {
font-family: Georgia, 'Times New Roman', Times, serif;
justify-content: space-between;
padding-right: 15px;
font-weight: bold;
}

.store-name {
font-family: ITC Machine;
font-weight: bold;
color: rgb(248, 149, 138);
font-size: 80px;
padding-left: 200px;
}

.checkout-button {
padding-left: 200px;
}

.status {
background-color: rgba(255, 192, 203, 0.637);
display: flex;
align-items: center;
}

.status-alert {
text-align: center;
font-size: 20px;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
color: rgb(94, 5, 80);
padding-right: 15px;
padding-left: 540px;
}

.dismiss-button {
font-size: 15px;
}
52 changes: 34 additions & 18 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import React, { useState } from 'react';
import Navbar from './components/Navbar';
import Main from './components/Main';
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>
</div>
);
}
}
const App = () => {
const [selectedCustomer, setSelectedCustomer] = useState("");
const [selectedMovie, setSelectedMovie] = useState("");
const [status, setStatus] = useState(null)

console.log(selectedCustomer);
console.log(selectedMovie);


return (
<div className='App'>
<Navbar
selectedCustomer={selectedCustomer}
selectedMovie={selectedMovie}
setStatusCallback={setStatus}
/>

{status && <div className="status">
<div className="status-alert">{status}</div>
<button className="dismiss-button" onClick= {() => setStatus(null)}>Dismiss</button>
</div>}

<Main
setSelectedCustomerCallBack={setSelectedCustomer}
setSelectedMovieCallBack={setSelectedMovie}
setStatusCallback={setStatus}
/>
</div>
);
};

export default App;
Binary file added src/backgroundimages/backgroundimage1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/backgroundimages/backgroundimage2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/backgroundimages/backgroundimage3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/backgroundimages/ultimate-movie-weekend.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions src/components/CustomerDetails.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.table tr, th {
vertical-align: middle;
border-width: 1px;
font-size: 20px;
}

.table tr:hover {
background-color: #f5f5f5;
}

.table td {
vertical-align: middle;

border-top: 1px solid rgb(248, 149, 138);
border-bottom: 1px solid rgb(248, 149, 138);
font-size: 18px;
}

.table thead {
padding-left: 1rem;
}

.table th {
vertical-align: bottom;
border-bottom: 4px solid rgb(248, 149, 138);
font-weight: bold;
height: 50px;
}

.table th, td {
padding: 15px;
text-align: left;
}

.customers-container {
margin: 1rem;
background-color: rgb(245, 242, 236);
}

.select-user-button {
padding: 13px;
border: 2px solid rgb(248, 149, 138);
font-weight: bold;
font-size: 15px;
}
32 changes: 32 additions & 0 deletions src/components/CustomerDetails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import './CustomerDetails.css';

const CustomerDetails = (props) => {
const onButtonClick = () => {
props.setSelectedCustomerCallBack(props);
};

return (
<div>
<section class="customers-container">
<table class="table">
<tr>
<td width="200">{props.name}</td>
<td width="250">{props.address}</td>
<td width="125">{props.city}</td>
<td width="75">{props.state}</td>
<td width="100">{props.postal_code}</td>
<td width="125">{props.phone}</td>
<td width="100">{props.account_credit}</td>
<td width="50">{props.movies_checked_out_count}</td>
<button className='select-user-button' onClick={onButtonClick}>
Select User
</button>
</tr>
</table>
</section>
</div>
);
};

export default CustomerDetails;
64 changes: 64 additions & 0 deletions src/components/Customers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import CustomerDetails from '../components/CustomerDetails';
import './CustomerDetails.css';

const Customers = (props) => {
const [customers, setCustomers] = useState([]);
const [errorMessage, setErrorMessage] = useState(null);

useEffect(() => {
axios
.get('http://localhost:3000/customers')
.then((response) => {
const allCustomers = (response.data).sort(function (a, b) {
if(a.name.toLowerCase() < b.name.toLowerCase()) return -1;
if(a.name.toLowerCase() > b.name.toLowerCase()) return 1;
return 0;
});
setCustomers(allCustomers);
})
.catch((error) => {
setErrorMessage(error.message);
});
}, []);

const cutomersList = customers.map((customer) => {
return (
<CustomerDetails
key={customer.id}
id={customer.id}
name={customer.name}
registered_at={customer.registered_at}
address={customer.address}
city={customer.city}
state={customer.state}
postal_code={customer.postal_code}
phone={customer.phone}
account_credit={customer.account_credit}
movies_checked_out_count={customer.movies_checked_out_count}
setSelectedCustomerCallBack={props.setSelectedCustomerCallBack}
/>
);
});

return (
<div>
<h1>Customers</h1>
<table className="table">
<thead>
<th width="200">Name</th>
<th width="250">Address</th>
<th width="125">City</th>
<th width="75">State</th>
<th width="100">Postal Code</th>
<th width="125">Phone</th>
<th width="100">Account Credit</th>
<th width="50">Movies Checked Out</th>
</thead>
</table>
{cutomersList}
</div>
);
};
export default Customers;
5 changes: 5 additions & 0 deletions src/components/Home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.homepage-photo {
padding-top: 40px;
max-width: 60%;
height: auto;
}
13 changes: 13 additions & 0 deletions src/components/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import "./Home.css";
import movienight from '../backgroundimages/ultimate-movie-weekend.jpg';

const Home = () => {
return (
<div>
<img className="homepage-photo" src={movienight} alt="movie-night"/>
</div>
);
}

export default Home;
Loading