Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9267282
ran npm install
dnguye2 Jun 22, 2020
700a7fa
added react-router-dom
dnguye2 Jun 22, 2020
efc528d
routes generated for search, customers, library, and home
dnguye2 Jun 22, 2020
96a763c
added a home component
dnguye2 Jun 22, 2020
ff951e7
added library, customers, and search components
dnguye2 Jun 22, 2020
547ba54
created customer components
dnguye2 Jun 22, 2020
9b81262
created library component
dnguye2 Jun 22, 2020
7f0edb3
created search component
dnguye2 Jun 22, 2020
3fc1ec7
got axios working and Rails connected
dnguye2 Jun 23, 2020
9d18a1d
adds Movie,Customer,&CustomerList.js; with an attempt (ever failing) …
leahwho Jun 23, 2020
dbb935f
library collection of movies view working
dnguye2 Jun 23, 2020
0210ff0
work in progress moviecard completed
dnguye2 Jun 23, 2020
661f15e
added customers list view, basic skeleton
dnguye2 Jun 23, 2020
f34178f
added key for each MovieCard
dnguye2 Jun 23, 2020
8c7c33c
removed unneeded html
dnguye2 Jun 23, 2020
51fc7be
added bootstrap
dnguye2 Jun 23, 2020
3723d49
search results can be displayed
dnguye2 Jun 23, 2020
3b8b19a
basic skeleton for movie card
dnguye2 Jun 23, 2020
ca99408
added navbar
dnguye2 Jun 24, 2020
0155731
got add movie front end to work
dnguye2 Jun 24, 2020
06b28bb
added bootstrap for react and styling for movie search results
dnguye2 Jun 24, 2020
0e6ee3d
styling for site
dnguye2 Jun 24, 2020
16183aa
adds jumbotron to home; change image in carousel
leahwho Jun 24, 2020
18ab3b9
adds slide to carousel
leahwho Jun 24, 2020
85eed40
added font and transparent navbar over carousel
dnguye2 Jun 25, 2020
bbe433e
fixed navbar styling
dnguye2 Jun 25, 2020
2d9f3d9
added padding at top from navbar
dnguye2 Jun 25, 2020
c5ef6d9
moved carousel caption to center and adjusted font size
dnguye2 Jun 25, 2020
116d256
adds onSelect, selected to CustomerCard
leahwho Jun 25, 2020
0ff5f29
adds useEffect to prevent 1,000,000 API calls
leahwho Jun 25, 2020
59f5b07
adds selectedCustomer state, updateSelected method
leahwho Jun 25, 2020
f7114d8
removed selected movie from nav; not written yet!
leahwho Jun 25, 2020
187df83
adds onSelect to movieCard
leahwho Jun 25, 2020
7418687
adds selectedMovie state and method to update
leahwho Jun 25, 2020
8bb7469
little changes, nothing major
leahwho Jun 25, 2020
d6a2339
adds onUpdateSelected
leahwho Jun 25, 2020
eb8423b
added favicon
dnguye2 Jun 25, 2020
3c92f9e
Merge branch 'master' of https://github.com/dnguye2/video-store-consumer
dnguye2 Jun 25, 2020
c3769ec
cleanup
leahwho Jun 25, 2020
982e32a
removed unused passed prop
leahwho Jun 26, 2020
01553b3
removed broken func, clean up
leahwho Jun 26, 2020
97243a8
cleanup, remove unused prop
leahwho Jun 26, 2020
e87ac74
clean up, removed unused prop
leahwho Jun 26, 2020
331f42f
remove broken func and unused prop
leahwho 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,160 changes: 5,668 additions & 4,492 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.1",
"private": true,
"dependencies": {
"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"
]
}
}
Binary file added public/cinema.ico
Binary file not shown.
Binary file removed public/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="shortcut icon" href="%PUBLIC_URL%/cinema.ico">
<!--
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 +19,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>Rentflix</title>
</head>
<body>
<noscript>
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"short_name": "React App",
"short_name": "Rentflix",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"src": "cinema.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
Expand Down
82 changes: 78 additions & 4 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url('https://fonts.googleapis.com/css2?family=Londrina+Solid:wght@100;300;400&display=swap');

.App {
text-align: center;
}
Expand All @@ -14,10 +16,6 @@
color: white;
}

.App-title {
font-size: 1.5em;
}

.App-intro {
font-size: large;
}
Expand All @@ -26,3 +24,79 @@
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

body{
background-color: #0B132B !important;
font-family: 'Londrina Solid', cursive !important;
font-weight: 300 !important;
}

.navbar-brand {
color: #C2FFF6 !important;
-webkit-text-stroke: 0.5px black;
font-weight: 400;
font-size: 50px !important;
}

.nav-link {
-webkit-text-stroke: 0.5px black;
font-weight: 400;
text-transform: uppercase;
font-size: 25px;
}

.card-body {
background-color: #3A506B;
}

.card-title {
color: #ffffff !important;
}

.card-text {
color: #ffffff;
}

.button {
background-color: #5BC0BE;
border: none;
color: #1C2541;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}

.bannerContainer {
position: absolute;
top:0;
}

.carousel {
position:absolute;
top:0;
}

.carousel-inner {
width: 100%;
overflow: hidden;
}

.carousel-caption {
transform: translateY(-50%);
bottom: 0;
top: 50%;
-webkit-text-stroke: 0.5px black;
font-size: 3vw;
color: #ffffffc5 !important;
}

.navbar{
position:absolute !important;
width:100% !important;
top: 0;
z-index:10;
max-width:100%;
padding: 40px;
}
118 changes: 101 additions & 17 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,105 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import React, { useState } from 'react';
import './App.css';
import Home from "./components/Home";
import Library from './components/Library';
import CustomersList from './components/CustomersList';
import Search from './components/Search';
import {
BrowserRouter as Router,
Switch,
Route,
} from "react-router-dom";

const App = () => {

const [selectedCustomer, setSelectedCustomer] = useState({
name: '',
id: null,
});

const [selectedMovie, setSelectedMovie] = useState({
name: '',
id: null,
});


const updateSelectedCustomer = (newSelected) => {
setSelectedCustomer({
name: newSelected.name,
id: newSelected.id
});
// setAlert(`You selected ${newSelected.name}. Nice.`)
};

const updateSelectedMovie = (newSelected) => {
setSelectedMovie({
name: newSelected.name,
id: newSelected.id
});
// setAlert(`You selected ${newSelected.name}. Nice.`)
};

return (
<Router>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
crossorigin="anonymous"></link>
</head>

<nav className="navbar navbar-expand-lg navbar-dark px-5">
<a className="navbar-brand text-uppercase" href="/">Rentflix</a>
<button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span>
</button>

<div className="collapse navbar-collapse" id="navbarSupportedContent">
<ul className="navbar-nav mr-auto">
<li className="nav-item">
<a className="nav-link" href="/">Home <span className="sr-only">(current)</span></a>
</li>
<li className="nav-item">
<a className="nav-link" href="/search">Search <span className="sr-only">(current)</span></a>
</li>
<li className="nav-item">
<a className="nav-link" href="/library">Library <span className="sr-only">(current)</span></a>
</li>
<li className="nav-item">
<a className="nav-link" href="/customers">Customers <span className="sr-only">(current)</span></a>
</li>
<li className="nav-item">
<a className="nav-link" href="#">Selected Movie: {selectedMovie.name} <span className="sr-only">(current)</span></a>
</li>
<li className="nav-item">
<a className="nav-link" href="#">Selected Customer: {selectedCustomer.name} <span className="sr-only">(current)</span></a>
</li>
</ul>
</div>
</nav>

<Switch>
<Route path="/search">
<Search />
</Route>
<Route path="/customers">
<CustomersList
onUpdateSelectedCustomer={updateSelectedCustomer}
/>
</Route>
<Route path="/library">
<Library
onUpdateSelectedMovie={updateSelectedMovie}
/>
</Route>
<Route path="/">
<Home />
</Route>
</Switch>

</Router>
);
}


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>
);
}
}

export default App;
Empty file added src/components/CustomerCard.css
Empty file.
38 changes: 38 additions & 0 deletions src/components/CustomerCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import PropTypes from "prop-types";
import Card from 'react-bootstrap/Card'

const CustomerCard = ({id, name, movies_checked_out_count, registered_at, onUpdateSelect}) => {

const onSelect = () => {
const newSelected = {
id: id,
name: name,
}
onUpdateSelect(newSelected)
}

return (
<Card>
<Card.Header>Name: {name}</Card.Header>
<Card.Body>
<Card.Title>Customer #{id}</Card.Title>
<Card.Text>
Currently, {name} has {movies_checked_out_count} movies checked out.
</Card.Text>
<button className="button" onClick={onSelect}>Select this Customer</button>
</Card.Body>
<Card.Footer className="text-muted">Joined on {new Date(registered_at).toString()}</Card.Footer>
</Card>
);
};

CustomerCard.propTypes = {
id: PropTypes.number,
name: PropTypes.string,
movies_checked_out_count: PropTypes.number,
registered_at: PropTypes.string,
onUpdateSelect: PropTypes.func,
};

export default CustomerCard;
Empty file.
44 changes: 44 additions & 0 deletions src/components/CustomersList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, {useState, useEffect} from 'react';
import axios from "axios";
import CustomerCard from './CustomerCard';

const CustomersList = ({onUpdateSelectedCustomer}) => {
const [error, setError] = useState(null);
const [customerList, setCustomerList] = useState(null);


useEffect(() => {
axios.get('http://localhost:3000/customers')
.then((response) => {
const data = response.data;

let customerCollection = data.map((customer) => {
return (
<div className="col-md-4 pb-4">
<CustomerCard
id = {customer.id}
name = {customer.name}
movies_checked_out_count = {customer.movies_checked_out_count}
registered_at = {customer.registered_at}
phone = {customer.phone}
key = {customer.id}
onUpdateSelect={onUpdateSelectedCustomer}
/>
</div>
);
});
setCustomerList(customerCollection);
})
.catch((error) => {
setError(error.response);
})
}, []);

return (
<div class="row m-5 pt-5">{customerList}</div>
);
};



export default CustomersList;
Empty file added src/components/Home.css
Empty file.
Loading