├── .firebase ├── hosting.YnVpbGQ.cache └── hosting.cHVibGlj.cache ├── .firebaserc ├── .gitignore ├── README.md ├── firebase.json ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.css ├── App.js ├── App.test.js ├── components ├── Cart │ ├── Cart.css │ └── Cart.js ├── CheckoutForm │ └── CheckoutForm.js ├── Header │ ├── Header.css │ └── Header.js ├── Inventory │ ├── Inventory.css │ └── Inventory.js ├── Login │ ├── Login.css │ ├── Login.js │ └── useAuth.js ├── NotFound │ └── NotFound.js ├── Product │ ├── Product.css │ └── Product.js ├── ProductDetail │ ├── ProductDetail.css │ └── ProductDetail.js ├── Review │ ├── Review.css │ └── Review.js ├── ReviewItem │ └── ReviewItem.js ├── Shipment │ ├── Shipment.css │ └── Shipment.js └── Shop │ ├── Shop.css │ └── Shop.js ├── fakeData ├── android.js ├── camera.js ├── index.js ├── laptop.js └── shippingCosts.js ├── images ├── favicon.ico ├── giphy.gif └── logo.png ├── index.css ├── index.js ├── logo.svg ├── serviceWorker.js ├── setupTests.js └── utilities └── databaseManager.js /.firebase/hosting.YnVpbGQ.cache: -------------------------------------------------------------------------------- 1 | favicon.ico,1583763177632,0969be82c7701bf4de58d53af1a6ef4b9f8da2f9f509cc8daac533db48812d40 2 | logo192.png,1583763177633,3ee59515172ee198f3be375979df15ac5345183e656720a381b8872b2a39dc8b 3 | logo512.png,1583763177634,ee7e2f3fdb8209c4b6fd7bef6ba50d1b9dba30a25bb5c3126df057e1cb6f5331 4 | manifest.json,1583763177634,5c997de1364b8be939319fa9209abd77f2caf7f8844999a9e2e9173f844e7840 5 | robots.txt,1583763177635,b2090cf9761ef60aa06e4fab97679bd43dfa5e5df073701ead5879d7c68f1ec5 6 | asset-manifest.json,1584505577923,1797a917b3ab7427b1f2ef860d2053fe53e6fde28d5d71e6f93c488b7c1878db 7 | index.html,1584505577922,823651f4a0b6768173910581e3a473b005335d9c1808cc3e04690398fb65841f 8 | precache-manifest.b9589ffae53a36d547eba9b6293c6a62.js,1584505577923,304269b07bad43c76a48dbf771aed17722f62a7fffda93c12437f49334e59e7c 9 | service-worker.js,1584505577922,9adf7b83ce7e075e7d9ba3a5babe998a0f0bcd6d72e3db30157361f00c7a41ba 10 | static/css/main.4d08e108.chunk.css,1584505577933,9a653669575763afd59dba24f9f0314fa8dec9b2fe0ab068fc5d29882759fb0f 11 | static/css/main.4d08e108.chunk.css.map,1584505577951,1ea20aa54678235765ffc9fcadd9f986f559c7fc4fe57f17ba550a74435fd4d9 12 | static/js/2.a2fd073e.chunk.js.LICENSE.txt,1584505577950,9bcb399a214296738fdff5f89dde1bff17b15589dea66a7d77a6f4e215e61149 13 | static/js/runtime-main.3ea24278.js,1584505577951,a35a3837a95cb7eb982efdd1f0fa353f6ca1cae1aecd70873ba56c1ad113c1a5 14 | static/js/runtime-main.3ea24278.js.map,1584505577951,6ad569fc881cd8180e748d4553ab86fb83dec9e5ca84352d9a6299c4d3b3bc08 15 | static/js/main.1282ba60.chunk.js,1584505577938,67eb9973ebba0072b2b80e932f7f1e79831421931fc13962292a6ea2439def7b 16 | static/media/logo.95f238a5.png,1584505577930,84bb80c7ad5aac5f696f09b797455057759cbbd91b44e20b7a658944eabce45b 17 | static/js/main.1282ba60.chunk.js.map,1584505577952,c486b0315fa8dfa010084646fc899968c7807238b0a53f9b56381a6e89857dfa 18 | static/js/2.a2fd073e.chunk.js,1584505577951,5a103b3c7e6c909ee38ea7b05b370e8a01bb5a9299f4bc12bf3b7c5cb4cc43f6 19 | static/media/giphy.e800c846.gif,1584505577951,95d1c42718616b96867ef9fe5defea149b9ef347bf0beb69a583977b01e5bd85 20 | static/js/2.a2fd073e.chunk.js.map,1584505577953,2d147bc5861ae87528f876d38f8ae20bdc31cbb28d8f5cf015358f21717250be 21 | -------------------------------------------------------------------------------- /.firebase/hosting.cHVibGlj.cache: -------------------------------------------------------------------------------- 1 | favicon.ico,1583763177632,0969be82c7701bf4de58d53af1a6ef4b9f8da2f9f509cc8daac533db48812d40 2 | index.html,1584503554953,5ae8403aca2715f267c4426473cc68778cf2776009eef4c267e121038ebfbc51 3 | logo192.png,1583763177633,3ee59515172ee198f3be375979df15ac5345183e656720a381b8872b2a39dc8b 4 | logo512.png,1583763177634,ee7e2f3fdb8209c4b6fd7bef6ba50d1b9dba30a25bb5c3126df057e1cb6f5331 5 | manifest.json,1583763177634,5c997de1364b8be939319fa9209abd77f2caf7f8844999a9e2e9173f844e7840 6 | robots.txt,1583763177635,b2090cf9761ef60aa06e4fab97679bd43dfa5e5df073701ead5879d7c68f1ec5 7 | -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "ema-john-simple" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | /src/firebase.config.js 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "build", 4 | "ignore": [ 5 | "firebase.json", 6 | "**/.*", 7 | "**/node_modules/**" 8 | ], 9 | "rewrites": [ 10 | { 11 | "source": "**", 12 | "destination": "/index.html" 13 | } 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ema-john-simple", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@fortawesome/fontawesome-svg-core": "^1.2.27", 7 | "@fortawesome/free-solid-svg-icons": "^5.12.1", 8 | "@fortawesome/react-fontawesome": "^0.1.8", 9 | "@stripe/react-stripe-js": "^1.1.0", 10 | "@stripe/stripe-js": "^1.2.0", 11 | "@testing-library/jest-dom": "^4.2.4", 12 | "@testing-library/react": "^9.4.1", 13 | "@testing-library/user-event": "^7.2.1", 14 | "bootstrap": "^4.4.1", 15 | "firebase": "^7.10.0", 16 | "react": "^16.13.0", 17 | "react-bootstrap": "^1.0.0-beta.17", 18 | "react-dom": "^16.13.0", 19 | "react-hook-form": "^4.10.2", 20 | "react-router-dom": "^5.1.2", 21 | "react-scripts": "3.4.0", 22 | "react-with-firebase-auth": "^1.3.0" 23 | }, 24 | "scripts": { 25 | "start": "react-scripts start", 26 | "build": "react-scripts build", 27 | "test": "react-scripts test", 28 | "eject": "react-scripts eject" 29 | }, 30 | "eslintConfig": { 31 | "extends": "react-app" 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 18 | 19 | 28 | React App 29 | 30 | 31 | 32 |
33 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | 2 | .App-link { 3 | color: #61dafb; 4 | } 5 | 6 | @keyframes App-logo-spin { 7 | from { 8 | transform: rotate(0deg); 9 | } 10 | to { 11 | transform: rotate(360deg); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './App.css'; 3 | import Header from './components/Header/Header'; 4 | import Shop from './components/Shop/Shop'; 5 | import { 6 | BrowserRouter as Router, 7 | Switch, 8 | Route 9 | } from "react-router-dom"; 10 | import Review from './components/Review/Review'; 11 | import Inventory from './components/Inventory/Inventory'; 12 | import NotFound from './components/NotFound/NotFound'; 13 | import ProductDetail from './components/ProductDetail/ProductDetail'; 14 | import Login from './components/Login/Login'; 15 | import { AuthContextProvider, PrivateRoute } from './components/Login/useAuth'; 16 | import Shipment from './components/Shipment/Shipment'; 17 | 18 | 19 | function App(props) { 20 | return ( 21 |
22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 |
54 | ); 55 | } 56 | 57 | export default App; -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /src/components/Cart/Cart.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/components/Cart/Cart.css -------------------------------------------------------------------------------- /src/components/Cart/Cart.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Cart = (props) => { 4 | const cart = props.cart; 5 | //const total = cart.reduce( (total, prd) => total + prd.price , 0 ) 6 | let total = 0; 7 | for(let i = 0; i< cart.length; i++){ 8 | const product = cart[i]; 9 | total = total + product.price * product.quantity; 10 | } 11 | let shipping = 0; 12 | if(total > 35){ 13 | shipping = 0; 14 | } 15 | else if(total > 15){ 16 | shipping = 4.99; 17 | } 18 | else if(total > 0){ 19 | shipping = 12.99 20 | } 21 | 22 | const tax = (total / 10).toFixed(2); 23 | const grandTotal = (total + shipping + Number(tax)).toFixed(2); 24 | 25 | const formatNumber = num => { 26 | const precision = num.toFixed(2); 27 | return Number(precision); 28 | } 29 | return ( 30 |
31 |

Order Summary

32 |

Items Ordered: {cart.length}

33 |

Product Price: {formatNumber(total)}

34 |

Shiiping Cost: {shipping}

35 |

Tax + VAT: {tax}

36 |

Total Price: {grandTotal}

37 |
38 | { 39 | props.children 40 | } 41 |
42 | ); 43 | }; 44 | 45 | export default Cart; -------------------------------------------------------------------------------- /src/components/CheckoutForm/CheckoutForm.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | CardElement, 4 | useStripe, 5 | useElements, 6 | } from '@stripe/react-stripe-js'; 7 | import { useState } from 'react'; 8 | 9 | const CheckoutForm = (props) => { 10 | const [paymentError, setPaymentError] = useState(null); 11 | const [paymentFinished, setPaymentFinished] = useState(null); 12 | const stripe = useStripe(); 13 | const elements = useElements(); 14 | 15 | const handleSubmit = async (event) => { 16 | event.preventDefault(); 17 | const {error, paymentMethod} = await stripe.createPaymentMethod({ 18 | type: 'card', 19 | card: elements.getElement(CardElement), 20 | }); 21 | if(error){ 22 | setPaymentError(error.message); 23 | setPaymentFinished(null); 24 | } 25 | else{ 26 | setPaymentFinished(paymentMethod); 27 | const payment = {id: paymentMethod.id, last4: paymentMethod.card.last4} 28 | props.handlePlaceOrder(payment); 29 | setPaymentError(null); 30 | } 31 | 32 | }; 33 | 34 | return ( 35 |
36 | 37 | 40 | { 41 | paymentError &&

{paymentError}

42 | } 43 | { 44 | paymentFinished &&

Payment Successfull

45 | } 46 | 47 | ); 48 | }; 49 | 50 | export default CheckoutForm; -------------------------------------------------------------------------------- /src/components/Header/Header.css: -------------------------------------------------------------------------------- 1 | .header img{ 2 | height: 80px; 3 | } 4 | .header{ 5 | text-align: center; 6 | } 7 | .header nav{ 8 | background-color: black; 9 | line-height: 40px; 10 | font-size: 20px; 11 | } 12 | nav a{ 13 | text-decoration: none; 14 | color: white; 15 | margin-right: 20px; 16 | padding: 5px; 17 | } 18 | nav a:hover{ 19 | background-color: gray; 20 | text-decoration: none; 21 | } -------------------------------------------------------------------------------- /src/components/Header/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import logo from '../../images/logo.png'; 3 | import './Header.css'; 4 | import { useAuth } from '../Login/useAuth'; 5 | 6 | 7 | const Header = () => { 8 | const auth = useAuth(); 9 | return ( 10 |
11 | 12 | 24 |
25 | ); 26 | }; 27 | 28 | export default Header; -------------------------------------------------------------------------------- /src/components/Inventory/Inventory.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/components/Inventory/Inventory.css -------------------------------------------------------------------------------- /src/components/Inventory/Inventory.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Inventory = () => { 4 | const handleAddInventory = () =>{ 5 | 6 | } 7 | return ( 8 |
9 |

Add Inventory to Sell more...

10 | 11 |
12 | ); 13 | }; 14 | 15 | export default Inventory; -------------------------------------------------------------------------------- /src/components/Login/Login.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/components/Login/Login.css -------------------------------------------------------------------------------- /src/components/Login/Login.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Auth from './useAuth'; 3 | 4 | const Login = () => { 5 | const auth = Auth(); 6 | const handleSignIn = () =>{ 7 | auth.singInWithGoogle() 8 | .then(res => { 9 | window.location.pathname = '/review'; 10 | }) 11 | } 12 | const handleSignOut = () => { 13 | auth.signOut() 14 | .then(res => { 15 | window.location.pathname = '/'; 16 | }); 17 | } 18 | return ( 19 |
20 |

Join the Party !!!

21 | { 22 | auth.user ? : 23 | 24 | } 25 |
26 | ); 27 | }; 28 | 29 | export default Login; -------------------------------------------------------------------------------- /src/components/Login/useAuth.js: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect } from 'react'; 2 | import * as firebase from "firebase/app"; 3 | import "firebase/auth"; 4 | import firebaseConfig from "../../firebase.config"; 5 | import { useState, createContext } from "react"; 6 | import { Route, Redirect } from 'react-router-dom'; 7 | 8 | 9 | firebase.initializeApp(firebaseConfig); 10 | 11 | const AuthContext = createContext(); 12 | 13 | export const AuthContextProvider = (props) =>{ 14 | const auth = Auth(); 15 | return {props.children} 16 | } 17 | 18 | export const useAuth = () => useContext(AuthContext); 19 | 20 | export const PrivateRoute = ({ children, ...rest }) => { 21 | const auth = useAuth(); 22 | return ( 23 | 26 | auth.user ? ( 27 | children 28 | ) : ( 29 | 35 | ) 36 | } 37 | /> 38 | ); 39 | } 40 | 41 | const getUser = user => { 42 | const {displayName, email, photoURL} = user; 43 | return {name: displayName, email, photo: photoURL}; 44 | } 45 | 46 | const Auth = () => { 47 | const [user, setUser] = useState(null); 48 | 49 | const singInWithGoogle = () =>{ 50 | const provider = new firebase.auth.GoogleAuthProvider(); 51 | return firebase.auth().signInWithPopup(provider) 52 | .then(res => { 53 | const singedInUser = getUser(res.user); 54 | setUser(singedInUser); 55 | return res.user; 56 | }) 57 | .catch(err => { 58 | setUser(null); 59 | return err.mesage; 60 | }) 61 | } 62 | const signOut = () => { 63 | return firebase.auth().signOut().then(function() { 64 | setUser(null); 65 | return true; 66 | }).catch(function(error) { 67 | console.log(error); 68 | return false; 69 | }); 70 | } 71 | 72 | useEffect(() => { 73 | firebase.auth().onAuthStateChanged(function(usr) { 74 | if (usr) { 75 | const currUser = getUser(usr); 76 | setUser(currUser); 77 | } else { 78 | // No user is signed in. 79 | } 80 | }); 81 | } , []) 82 | 83 | 84 | return { 85 | user, 86 | singInWithGoogle, 87 | signOut 88 | } 89 | } 90 | 91 | export default Auth; -------------------------------------------------------------------------------- /src/components/NotFound/NotFound.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const NotFound = () => { 4 | return ( 5 |
6 |

Sorry, page not found

7 |

404 Error!!!

8 |
9 | ); 10 | }; 11 | 12 | export default NotFound; -------------------------------------------------------------------------------- /src/components/Product/Product.css: -------------------------------------------------------------------------------- 1 | .product{ 2 | display: flex; 3 | border-bottom: 1px solid lightgray; 4 | margin-bottom: 5px; 5 | margin-right: 10px; 6 | padding-bottom: 5px; 7 | } 8 | .product-name{ 9 | color: blue; 10 | font-weight: 400; 11 | } 12 | .main-button{ 13 | background-color: goldenrod; 14 | width: 150px; 15 | height: 30px; 16 | border: 1px solid darkgray; 17 | border-radius: 5px; 18 | cursor: pointer; 19 | } -------------------------------------------------------------------------------- /src/components/Product/Product.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' 3 | import { faShoppingCart } from '@fortawesome/free-solid-svg-icons' 4 | import './Product.css'; 5 | import { Link } from 'react-router-dom'; 6 | 7 | const Product = (props) => { 8 | const { img, name, seller, price, stock, key } = props.product; 9 | return ( 10 |
11 |
12 | 13 |
14 |
15 |

{name}

16 |
17 |

by: {seller}

18 |

${price}

19 |

Only {stock} left in stock - Order soon

20 | { props.showAddToCart === true && } 26 |
27 | 28 |
29 | ); 30 | }; 31 | 32 | export default Product; -------------------------------------------------------------------------------- /src/components/ProductDetail/ProductDetail.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/components/ProductDetail/ProductDetail.css -------------------------------------------------------------------------------- /src/components/ProductDetail/ProductDetail.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useParams } from 'react-router-dom'; 3 | import Product from '../Product/Product'; 4 | import { useState } from 'react'; 5 | import { useEffect } from 'react'; 6 | 7 | const ProductDetail = () => { 8 | const {productKey} = useParams(); 9 | const [product, setProduct] = useState(null); 10 | 11 | useEffect(() =>{ 12 | fetch('http://localhost:4200/product/'+ productKey) 13 | .then(res => res.json()) 14 | .then(data => { 15 | setProduct(data); 16 | }) 17 | }, [productKey]); 18 | 19 | 20 | return ( 21 |
22 |

Your Product Details.

23 | { 24 | product && 25 | } 26 |
27 | ); 28 | }; 29 | 30 | export default ProductDetail; -------------------------------------------------------------------------------- /src/components/Review/Review.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/components/Review/Review.css -------------------------------------------------------------------------------- /src/components/Review/Review.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import { getDatabaseCart, removeFromDatabaseCart } from '../../utilities/databaseManager'; 3 | import ReviewItem from '../ReviewItem/ReviewItem'; 4 | import Cart from '../Cart/Cart'; 5 | import { Link } from 'react-router-dom'; 6 | import { useAuth } from '../Login/useAuth'; 7 | 8 | const Review = () => { 9 | const [cart, setCart] = useState([]); 10 | const auth = useAuth(); 11 | 12 | const removeProduct = (productKey) => { 13 | const newCart = cart.filter(pd => pd.key !== productKey); 14 | setCart(newCart); 15 | removeFromDatabaseCart(productKey); 16 | } 17 | 18 | useEffect(()=>{ 19 | //cart 20 | const savedCart = getDatabaseCart(); 21 | const productKeys = Object.keys(savedCart); 22 | fetch('http://localhost:4200/getProductsByKey', { 23 | method: 'POST', 24 | headers: { 25 | 'Content-Type': 'application/json' 26 | }, 27 | body: JSON.stringify(productKeys) 28 | }) 29 | .then(res => res.json()) 30 | .then(data => { 31 | const cartProducts = productKeys.map( key => { 32 | const product = data.find( pd => pd.key === key); 33 | product.quantity = savedCart[key]; 34 | return product; 35 | }); 36 | setCart(cartProducts); 37 | }) 38 | 39 | }, []); 40 | 41 | 42 | return ( 43 |
44 |
45 | { 46 | cart.map(pd => ) 50 | } 51 | { 52 | !cart.length &&

Your cart is empty. Keep shopping

53 | } 54 |
55 |
56 | 57 | 58 | { 59 | auth.user ? 60 | 61 | : 62 | 63 | } 64 | 65 | 66 |
67 |
68 | ); 69 | }; 70 | 71 | export default Review; -------------------------------------------------------------------------------- /src/components/ReviewItem/ReviewItem.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const ReviewItem = (props) => { 4 | const {name, quantity, key, price} = props.product; 5 | const reviewItemStyle={ 6 | borderBottom:'1px solid lightgray', 7 | marginBottom:'5px', 8 | paddingBottom:'5px', 9 | marginLeft:'200px' 10 | }; 11 | return ( 12 |
13 |

{name}

14 |

Quantity: {quantity}

15 |

$ {price}

16 |
17 | 21 |
22 | ); 23 | }; 24 | 25 | export default ReviewItem; -------------------------------------------------------------------------------- /src/components/Shipment/Shipment.css: -------------------------------------------------------------------------------- 1 | .ship-form{ 2 | margin:30px 100px; 3 | } 4 | .ship-form input { 5 | display: block; 6 | margin-top: 30px; 7 | padding: 5px; 8 | border: 1px solid gray; 9 | border-radius: 5px; 10 | width: 300px; 11 | } 12 | .error{ 13 | color: red; 14 | } -------------------------------------------------------------------------------- /src/components/Shipment/Shipment.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { useForm } from 'react-hook-form'; 3 | import './Shipment.css'; 4 | import { useAuth } from '../Login/useAuth'; 5 | import {loadStripe} from '@stripe/stripe-js'; 6 | import { Elements } from '@stripe/react-stripe-js'; 7 | import { getDatabaseCart, clearLocalShoppingCart } from '../../utilities/databaseManager'; 8 | import CheckoutForm from '../CheckoutForm/CheckoutForm'; 9 | import { useState } from 'react'; 10 | 11 | const Shipment = () => { 12 | const { register, handleSubmit, errors } = useForm(); 13 | const [shipInfo, setShipInfo] = useState(null); 14 | const [orderId, setOrderId] = useState(null); 15 | 16 | const auth = useAuth(); 17 | 18 | const stripePromise = loadStripe('pk_test_W9dyOmILvI7JWfiVmSHcECiL00DsUn8jCz'); 19 | 20 | const onSubmit = data => { 21 | setShipInfo(data); 22 | } 23 | 24 | const handlePlaceOrder = (payment) =>{ 25 | const savedCart = getDatabaseCart(); 26 | const orderDetails = { 27 | email: auth.user.email, 28 | cart: savedCart, 29 | shipment: shipInfo, 30 | payment: payment 31 | }; 32 | fetch('http://localhost:4200/placeOrder', { 33 | method: 'POST', 34 | headers: { 35 | 'Content-Type': 'application/json' 36 | }, 37 | body: JSON.stringify(orderDetails) 38 | }) 39 | .then(res => res.json()) 40 | .then(order => { 41 | setOrderId(order._id); 42 | clearLocalShoppingCart(); 43 | }) 44 | } 45 | 46 | 47 | return ( 48 |
49 |
50 |
51 |

Shipment Information

52 |
53 | 54 | 58 | { 59 | errors.name && Name is required 60 | } 61 | 62 | 66 | { 67 | errors.email && Email is required 68 | } 69 | 70 | { 71 | errors.AddressLine1 && Address is required 72 | } 73 | 74 | 75 | { 76 | errors.city && City is required 77 | } 78 | 79 | { 80 | errors.country && Country is required 81 | } 82 | 83 | { 84 | errors.zipcode && Zip Code is required 85 | } 86 | 87 | 88 |
89 |
90 |
93 |

Payment Information

94 | 95 | 96 | 97 |
98 | { 99 | orderId &&
100 |

Thank you for shopping with us

101 |

Your order id is: {orderId}

102 |
103 | } 104 |
105 |
106 |
107 | ) 108 | }; 109 | 110 | export default Shipment; -------------------------------------------------------------------------------- /src/components/Shop/Shop.css: -------------------------------------------------------------------------------- 1 | .twin-container{ 2 | display: flex; 3 | } 4 | .product-container{ 5 | width: 70%; 6 | margin-left: 20px; 7 | margin-right: 5px; 8 | border-right: 1px solid lightgray; 9 | } -------------------------------------------------------------------------------- /src/components/Shop/Shop.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { useState } from 'react'; 3 | import './Shop.css'; 4 | import Product from '../Product/Product'; 5 | import Cart from '../Cart/Cart'; 6 | import { addToDatabaseCart, getDatabaseCart } from '../../utilities/databaseManager'; 7 | import { Link } from 'react-router-dom'; 8 | 9 | const Shop = () => { 10 | const [products, setProducts] = useState([]); 11 | const [cart, setCart] = useState([]); 12 | 13 | useEffect(()=>{ 14 | fetch('http://localhost:4200/products') 15 | .then(res => res.json()) 16 | .then(data => { 17 | setProducts(data); 18 | }) 19 | }, []) 20 | 21 | useEffect(()=>{ 22 | const savedCart = getDatabaseCart(); 23 | const productKeys = Object.keys(savedCart); 24 | if(products.length > 0){ 25 | const previousCart = productKeys.map( existingKey => { 26 | const product = products.find( pd => pd.key === existingKey); 27 | product.quantity = savedCart[existingKey]; 28 | return product; 29 | } ) 30 | setCart(previousCart); 31 | } 32 | }, [products]) 33 | 34 | const handleAddProduct = (product) =>{ 35 | const toBeAddedKey = product.key; 36 | const sameProduct = cart.find(pd => pd.key === toBeAddedKey); 37 | let count = 1; 38 | let newCart; 39 | if(sameProduct){ 40 | count = sameProduct.quantity + 1; 41 | sameProduct.quantity = count; 42 | const others = cart.filter(pd => pd.key !== toBeAddedKey); 43 | newCart = [...others, sameProduct]; 44 | } 45 | else{ 46 | product.quantity = 1; 47 | newCart = [...cart, product]; 48 | } 49 | setCart(newCart); 50 | addToDatabaseCart(product.key, count); 51 | } 52 | 53 | return ( 54 |
55 |
56 | { 57 | products.map(pd => ) 63 | } 64 |
65 |
66 | 67 | 68 | 69 | 70 | 71 |
72 | 73 |
74 | ); 75 | }; 76 | 77 | export default Shop; -------------------------------------------------------------------------------- /src/fakeData/android.js: -------------------------------------------------------------------------------- 1 | var androids = 2 | [{"key":"B00OSTKZWM","category":"android","name":"RCA M1 4.0 Unlocked Cell Phone, Dual SIM, 5MP Camera, Android 4.4, 1.3GHz (White)","seller":"RCA","wholePrice":"57","priceFraction":"99","stock":96,"star":3,"starCount":620,"img":"https://images-na.ssl-images-amazon.com/images/I/51VCP05020L._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_electronics_sr_pg1_1?ie=UTF8&adId=A03332262DHW9SCX1W5WM&url=https%3A%2F%2Fwww.amazon.com%2FRCA-M1-Unlocked-Camera-Android%2Fdp%2FB00OSTKZWM%2Fref%3Dsr_1_1%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124826%26sr%3D1-1-spons%26keywords%3Dandroid%26psc%3D1&qualifier=1499124825&id=1141793968325395&widgetName=sp_atf","features":[{"description":"Display Size","value":"4.0 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Android"},{"description":"Cpu Model Speed","value":"1.3 GHz"},{"description":"Special Feature","value":"smartphone"}],"price":57.99,"shipping":3.99},{"key":"B01H2E0J5M","category":"android","name":"BLU R1 HD - 16 GB - Black - Prime Exclusive - with Lockscreen Offers & Ads","seller":"BLU","wholePrice":"59","priceFraction":"99","stock":5,"star":3,"starCount":2318,"img":"https://images-na.ssl-images-amazon.com/images/I/416TS-ODxfL._AC_US218_.jpg","url":"https://www.amazon.com/BLU-R1-HD-Exclusive-Lockscreen/dp/B01H2E0J5M/ref=sr_1_2?s=electronics&ie=UTF8&qid=1499124822&sr=1-2&keywords=android","features":[{"description":"Display Size","value":"5.0 inches"},{"description":"Computer Memory Size","value":"16 GB"},{"description":"Operating System","value":"Android 6.0 Marshmallow"},{"description":"Display Type","value":"LCD"},{"description":"Special Feature","value":"card slots"}],"price":59.99,"shipping":7.99},{"key":"B0713WPJKX","category":"android","name":"Celltronics Micro USB Cable,10FT Nylon Braided Tangle-free Data Sync Heavy Duty Android Charging Cable Power Cord High Speed USB2.0 for Samsung HTC LG MP3 Bluetooth Speaker-3 Pack","seller":"Cell-Tronics","wholePrice":"10","priceFraction":"99","stock":87,"star":4,"starCount":3392,"img":"https://images-na.ssl-images-amazon.com/images/I/61+-qmTKy8L._AC_US218_.jpg","url":"https://www.amazon.com/Celltronics-Tangle-free-Charging-Bluetooth-Speaker-3/dp/B0713WPJKX/ref=sr_1_3?s=electronics&ie=UTF8&qid=1499124822&sr=1-3&keywords=android","features":[],"price":10.99,"shipping":3.99},{"key":"B01LPZD1N6","category":"android","name":"ATOTO 7\"HD Touchscreen 2Din Android Car Navigation Stereo - Quadcore Car Entertainment Multimedia w/ FM/RDS Radio,WIFI,BT,Mirror Link,and more(No DVD Player)M4171 (178101/16G)","seller":"ATOTO","wholePrice":"164","priceFraction":"90","stock":20,"star":3,"starCount":4029,"img":"https://images-na.ssl-images-amazon.com/images/I/51xI8gJTNYL._AC_US218_.jpg","url":"https://www.amazon.com/ATOTO-Touchscreen-Android-Navigation-Stereo/dp/B01LPZD1N6/ref=sr_1_4?s=electronics&ie=UTF8&qid=1499124822&sr=1-4&keywords=android","features":[{"description":"Display Size","value":"7.0 inches"},{"description":"Operating System","value":"Android"},{"description":"Hardware Platform","value":"Android"},{"description":"Cpu Model Manufacturer","value":"MTK"},{"description":"Wireless Communication Technology","value":"AM/FM"}],"price":164.9,"shipping":0},{"key":"B01N1SE4EP","category":"android","name":"NeuTab 7 inch Quad Core Android 5.1 Lollipop Tablet PC, Bluetooth 4.0, Dual Camera, FCC Certified(2017 Upgraded Edition)","seller":"NeuTab","wholePrice":"49","priceFraction":"99","stock":50,"star":3,"starCount":4947,"img":"https://images-na.ssl-images-amazon.com/images/I/41HNbRSKpfL._AC_US218_.jpg","url":"https://www.amazon.com/NeuTab-Lollipop-Bluetooth-Certified-Upgraded/dp/B01N1SE4EP/ref=sr_1_5?s=electronics&ie=UTF8&qid=1499124822&sr=1-5&keywords=android","features":[{"description":"Display Size","value":"7.0 inches"},{"description":"Operating System","value":"android 5.1 (Lollipop)"},{"description":"Hard Disk Size","value":"8.0 GB"},{"description":"Connectivity Technology","value":"usb"},{"description":"System Ram Type","value":"ddr3 sdram"}],"price":49.99,"shipping":7.99},{"key":"B017LDNLIG","category":"android","name":"Tracfone Alcatel Onetouch Pixi Glitz A463BG","seller":"Tracfone","wholePrice":"19","priceFraction":"94","stock":85,"star":3,"starCount":381,"img":"https://images-na.ssl-images-amazon.com/images/I/51QdgznaNTL._AC_US218_.jpg","url":"https://www.amazon.com/Tracfone-Alcatel-Onetouch-Glitz-A463BG/dp/B017LDNLIG/ref=sr_1_6?s=electronics&ie=UTF8&qid=1499124822&sr=1-6&keywords=android","features":[{"description":"Display Size","value":"3.5"},{"description":"Computer Memory Size","value":"2 GB"},{"description":"Operating System","value":"Android 4.4 KitKat"},{"description":"Display Type","value":"LCD"},{"description":"Special Feature","value":"smartphone"}],"price":19.94,"shipping":7.99},{"key":"B018IZ0SWI","category":"android","name":"BLU Advance 5.0 - Unlocked Dual Sim Smartphone - US GSM - Black","seller":"BLU","wholePrice":"59","priceFraction":"99","stock":10,"star":3,"starCount":395,"img":"https://images-na.ssl-images-amazon.com/images/I/41mXjdLezRL._AC_US218_.jpg","url":"https://www.amazon.com/BLU-Advance-5-0-Unlocked-Smartphone/dp/B018IZ0SWI/ref=sr_1_7?s=electronics&ie=UTF8&qid=1499124822&sr=1-7&keywords=android","features":[{"description":"Display Size","value":"5 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Android"},{"description":"Wireless Communication Technology","value":"GSM, 3G, 4G"},{"description":"Cpu Model Speed","value":"1 GHz"}],"price":59.99,"shipping":3.99},{"key":"B01N4HS7B8","category":"android","name":"Smart tv box Wechip V5 Android 6.0 Marshmallow 2g 16g Amlogic S905X quad core 4K Dual WiFi","seller":"Wechip","wholePrice":"53","priceFraction":"99","stock":34,"star":4,"starCount":4740,"img":"https://images-na.ssl-images-amazon.com/images/I/41q+adG0lNL._AC_US218_.jpg","url":"https://www.amazon.com/Smart-Wechip-Android-Marshmallow-Amlogic/dp/B01N4HS7B8/ref=sr_1_8?s=electronics&ie=UTF8&qid=1499124822&sr=1-8&keywords=android","features":[],"price":53.99,"shipping":7.99},{"key":"B01LX0JZUM","category":"android","name":"ONSON Android Charger Cable,3Pack 10FT Extra Long Nylon Braided High Speed 2.0 USB to Micro USB Charging Cord Fast Charger Cable for Samsung Galaxy S7/S6 Edge,Note 5/4,HTC,LG,Nexus(Gray White)","seller":"ONSON","wholePrice":"11","priceFraction":"99","stock":8,"star":3,"starCount":2636,"img":"https://images-na.ssl-images-amazon.com/images/I/51P8qI8KzNL._AC_US218_.jpg","url":"https://www.amazon.com/ONSON-Android-Charger-Braided-Charging/dp/B01LX0JZUM/ref=sr_1_9?s=electronics&ie=UTF8&qid=1499124822&sr=1-9&keywords=android","features":[],"price":11.99,"shipping":3.99},{"key":"B072NYXDLY","category":"android","name":"5.0\" Phone Unlocked Dual Sim Quad Core 8GB Android 5.1 Cellphone Gold by TIMMY","seller":"Timmy","wholePrice":"68","priceFraction":"99","stock":14,"star":5,"starCount":1182,"img":"https://images-na.ssl-images-amazon.com/images/I/411fzxxuuFL._AC_US218_.jpg","url":"https://www.amazon.com/Phone-Unlocked-Android-Cellphone-TIMMY/dp/B072NYXDLY/ref=sr_1_10?s=electronics&ie=UTF8&qid=1499124822&sr=1-10&keywords=android","features":[{"description":"Display Size","value":"5.0 inches"},{"description":"Operating System","value":"google android"}],"price":68.99,"shipping":3.99},{"key":"B071RK857H","category":"android","name":"QacQoc A12 Pro Android 6.0 TV BOX Amlogic S912 Octa-Core [2G DDR3/16G eMMC] Dual Wifi 2.4G/5G AC OTA Update 4K 1000M Android TV Box","seller":"QacQoc","wholePrice":"65","priceFraction":"99","stock":1,"star":5,"starCount":1836,"img":"https://images-na.ssl-images-amazon.com/images/I/51+GT3mluJL._AC_US218_.jpg","url":"https://www.amazon.com/QacQoc-A12-Android-Amlogic-Octa-Core/dp/B071RK857H/ref=sr_1_11?s=electronics&ie=UTF8&qid=1499124822&sr=1-11&keywords=android","features":[{"description":"Connectivity Technology","value":"wi-fi ready"},{"description":"Special Feature","value":"network ready"}],"price":65.99,"shipping":7.99},{"key":"B06XWMQRS6","category":"android","name":"QacQoc M9C max Android 6.0 Marshmallow TV Box New Amlogic S905X Chipset [2G DDR3/16G eMMC] 4K Smart Box Unlocked 2.4G WIFI Media Player","seller":"QacQoc","wholePrice":"49","priceFraction":"99","stock":54,"star":4,"starCount":2618,"img":"https://images-na.ssl-images-amazon.com/images/I/41Sx5HrzuhL._AC_US218_.jpg","url":"https://www.amazon.com/QacQoc-Android-Marshmallow-Amlogic-Unlocked/dp/B06XWMQRS6/ref=sr_1_12?s=electronics&ie=UTF8&qid=1499124822&sr=1-12&keywords=android","features":[],"price":49.99,"shipping":3.99},{"key":"B01N41AKT3","category":"android","name":"Antimi Sweatproof Smart Watch Phone for Android HTC Sony Samsung LG Google Pixel /Pixel and iPhone 5 5S 6 6 Plus 7 Smartphones Black","seller":"Antimi","wholePrice":"25","priceFraction":"99","stock":66,"star":3,"starCount":3316,"img":"https://images-na.ssl-images-amazon.com/images/I/41Z3XFc1-5L._AC_US218_.jpg","url":"https://www.amazon.com/Antimi-Sweatproof-Android-Samsung-Smartphones/dp/B01N41AKT3/ref=sr_1_13?s=electronics&ie=UTF8&qid=1499124822&sr=1-13&keywords=android","features":[{"description":"Operating System","value":"Android/iOS"},{"description":"Hardware Platform","value":"Android"}],"price":25.99,"shipping":3.99},{"key":"B06XY8W1DC","category":"android","name":"SUNNZO T2 TV Box Streaming Devices for TV/Streaming Media Players Android 6.0 4K WIFI","seller":"sunnzo","wholePrice":"29","priceFraction":"99","stock":97,"star":3,"starCount":4951,"img":"https://images-na.ssl-images-amazon.com/images/I/51sZTRzpQjL._AC_US218_.jpg","url":"https://www.amazon.com/T2-Streaming-Devices-Players-Android/dp/B06XY8W1DC/ref=sr_1_14?s=electronics&ie=UTF8&qid=1499124822&sr=1-14&keywords=android","features":[],"price":29.99,"shipping":7.99},{"key":"B01N0VVQ13","category":"android","name":"Goodsail Micro USB Cables, 3Pack 6FT/2M durable Nylon Braided High Charging Speed USB 2.0 A Male to Micro USB Cord For Samsung, HTC, Motorola, Blackberry, Tablets and Android Smartphones Blue Black","seller":"Goodsail","wholePrice":"9","priceFraction":"99","stock":80,"star":4,"starCount":4758,"img":"https://images-na.ssl-images-amazon.com/images/I/51+MK7D4pLL._AC_US218_.jpg","url":"https://www.amazon.com/Goodsail-Charging-Motorola-Blackberry-Smartphones/dp/B01N0VVQ13/ref=sr_1_15?s=electronics&ie=UTF8&qid=1499124822&sr=1-15&keywords=android","features":[],"price":9.99,"shipping":7.99},{"key":"B01JOT42JW","category":"android","name":"2017 Model GooBang Doo Android 6.0 TV Box, Abox Android TV Box Amlogic S905X 64 Bits and True 4K Playing","seller":"GooBang Doo","wholePrice":"39","priceFraction":"99","stock":54,"star":3,"starCount":856,"img":"https://images-na.ssl-images-amazon.com/images/I/41sPPh71RXL._AC_US218_.jpg","url":"https://www.amazon.com/GooBang-Doo-Android-Amlogic-Playing/dp/B01JOT42JW/ref=sr_1_16?s=electronics&ie=UTF8&qid=1499124822&sr=1-16&keywords=android","features":[],"price":39.99,"shipping":3.99},{"key":"B06Y5PY61J","category":"android","name":"RBSCH M96X Smart Tv Box Android 6.0 Amlogic S905X Quad Core 64bit 2GB / 8GB 4K HD 100Mbps LAN Wifi Mini Home player","seller":"RBSCH","wholePrice":"44","priceFraction":"99","stock":34,"star":5,"starCount":1151,"img":"https://images-na.ssl-images-amazon.com/images/I/41c3yiJtjCL._AC_US218_.jpg","url":"https://www.amazon.com/RBSCH-Android-Amlogic-100Mbps-player/dp/B06Y5PY61J/ref=sr_1_17?s=electronics&ie=UTF8&qid=1499124822&sr=1-17&keywords=android","features":[],"price":44.99,"shipping":7.99},{"key":"B0182YJ4V6","category":"android","name":"Yezz Andy 3.5E2 unlocked android phone black","seller":"Yezz","wholePrice":"37","priceFraction":"50","stock":97,"star":3,"starCount":2770,"img":"https://images-na.ssl-images-amazon.com/images/I/51PADZ7CaeL._AC_US218_.jpg","url":"https://www.amazon.com/Yezz-3-5E2-unlocked-android-phone/dp/B0182YJ4V6/ref=sr_1_18?s=electronics&ie=UTF8&qid=1499124822&sr=1-18&keywords=android","features":[{"description":"Display Size","value":"3.5 inches"},{"description":"Computer Memory Size","value":"512.0 MB"},{"description":"Operating System","value":"google android"},{"description":"Wireless Communication Technology","value":"GSM"},{"description":"Special Feature","value":"smartphone"}],"price":37.5,"shipping":7.99},{"key":"B01GL7EB50","category":"android","name":"Pandawell OTG Micro USB Mobile Phone Fan Portable Dock Cool Cooler Rotating Fan for Samsung Galaxy S7, S7 Edge, LG G5 & Other Android Smart Phone (Black)","seller":"Pandawell","wholePrice":"4","priceFraction":"99","stock":68,"star":3,"starCount":2806,"img":"https://images-na.ssl-images-amazon.com/images/I/31Q6QEVwmDL._AC_US218_.jpg","url":"https://www.amazon.com/Pandawell-Portable-Rotating-Samsung-Android/dp/B01GL7EB50/ref=sr_1_19?s=electronics&ie=UTF8&qid=1499124822&sr=1-19&keywords=android","features":[],"price":4.99,"shipping":7.99},{"key":"B06XKH29C8","category":"android","name":"TYD 10.1 inch Tablet Android 6.0 GPS Octa Core 2560X1600 IPS Bluetooth RAM 4GB ROM 64GB 13.0MP 3G Phone Call Tablets PC Dual sim card TYD-107-Black","seller":"Tianyida","wholePrice":"99","priceFraction":"00","stock":95,"star":2,"starCount":1718,"img":"https://images-na.ssl-images-amazon.com/images/I/513RoqwKmPL._AC_US218_.jpg","url":"https://www.amazon.com/Android-2560X1600-Bluetooth-Tablets-TYD-107-Black/dp/B06XKH29C8/ref=sr_1_20?s=electronics&ie=UTF8&qid=1499124822&sr=1-20&keywords=android","features":[{"description":"Display Size","value":"10.1 inches"},{"description":"Operating System","value":"Android"},{"description":"Hard Disk Size","value":"64.0 GB"},{"description":"Connectivity Technology","value":"usb"},{"description":"Hardware Platform","value":"android 6.0"}],"price":99,"shipping":3.99},{"key":"B01MG086CV","category":"android","name":"[Apple Certified] 3 Feet Coiled Charging Cable for iPhone and Android, YellowKnife 8-Pin Lightning & Micro to USB Date Wire for iPhone 5 6 7 Plus SE, iPad Mini Air iPod, Samsung Sony LG Phones, Black","seller":"Yellowknife","wholePrice":"11","priceFraction":"98","stock":3,"star":4,"starCount":103,"img":"https://images-na.ssl-images-amazon.com/images/I/41Htivct16L._AC_US218_.jpg","url":"https://www.amazon.com/Certified-Charging-Android-YellowKnife-Lightning/dp/B01MG086CV/ref=sr_1_21?s=electronics&ie=UTF8&qid=1499124822&sr=1-21&keywords=android","features":[],"price":11.98,"shipping":7.99},{"key":"B01MUA1QMU","category":"android","name":"TracFone Alcatel OneTouch Pixi Eclipse Prepaid Smartphone - Certified Preowned","seller":"Tracfone","wholePrice":"20","priceFraction":"81","stock":66,"star":3,"starCount":3507,"img":"https://images-na.ssl-images-amazon.com/images/I/41gV+33qdoL._AC_US218_.jpg","url":"https://www.amazon.com/TracFone-Alcatel-OneTouch-Pixi-Eclipse-Prepaid-Smartphone-Certified/dp/B01MUA1QMU/ref=sr_1_22?s=electronics&ie=UTF8&qid=1499124822&sr=1-22&keywords=android","features":[{"description":"Display Size","value":"4"},{"description":"Display Type","value":"LCD"}],"price":20.81,"shipping":7.99},{"key":"B015MJLEUS","category":"android","name":"Anker [3-Pack] PowerLine Micro USB (3ft) - Charging Cable for Samsung, Nexus, LG, Android Smartphones and More (Black)","seller":"Anker","wholePrice":"10","priceFraction":"99","stock":75,"star":4,"starCount":315,"img":"https://images-na.ssl-images-amazon.com/images/I/41pKUQFLc8L._AC_US218_.jpg","url":"https://www.amazon.com/Anker-3-Pack-PowerLine-Micro-USB/dp/B015MJLEUS/ref=sr_1_23?s=electronics&ie=UTF8&qid=1499124822&sr=1-23&keywords=android","features":[],"price":10.99,"shipping":3.99},{"key":"B06WWPFVNV","category":"android","name":"Antimi SmartWatch Sweatproof Smart Watch Phone for Android HTC Sony Samsung LG Google Pixel /Pixel and iPhone 5 5S 6 6 Plus 7 Smartphones Black","seller":"Antimi","wholePrice":"34","priceFraction":"99","stock":37,"star":4,"starCount":1880,"img":"https://images-na.ssl-images-amazon.com/images/I/51yaeSUl8DL._AC_US218_.jpg","url":"https://www.amazon.com/Antimi-SmartWatch-Sweatproof-Android-Smartphones/dp/B06WWPFVNV/ref=sr_1_24?s=electronics&ie=UTF8&qid=1499124822&sr=1-24&keywords=android","features":[{"description":"Operating System","value":"Android/iOS"},{"description":"Hardware Platform","value":"Android"}],"price":34.99,"shipping":7.99},{"key":"B00NH2COZC","category":"android","name":"Native Union NIGHT Cable for Android Devices 10ft Micro-USB to USB Charging Cable (Zebra)","seller":"Native Union","wholePrice":"39","priceFraction":"99","stock":73,"star":3,"starCount":1894,"img":"https://images-na.ssl-images-amazon.com/images/I/3167uhg4DPL._AC_US218_.jpg","url":"https://www.amazon.com/Native-Union-Android-Micro-USB-Charging/dp/B00NH2COZC/ref=sr_1_25?s=electronics&ie=UTF8&qid=1499124822&sr=1-25&keywords=android","features":[],"price":39.99,"shipping":7.99},{"key":"B01DMVLE7Q","category":"android","name":"Samsung Galaxy Tab E Lite 7.0\" 8GB (Wi-Fi) Black Accessory Bundle includes Tablet, Cleaning Kit, 3 Stylus Pens and Metal Ear Buds","seller":"Samsung","wholePrice":"129","priceFraction":"99","stock":14,"star":4,"starCount":1362,"img":"https://images-na.ssl-images-amazon.com/images/I/51jViuKHqdL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_1?ie=UTF8&adId=A06599961RWOD7JVO4914&url=https%3A%2F%2Fwww.amazon.com%2FSamsung-Galaxy-Accessory-Bundle-Cleaning%2Fdp%2FB01DMVLE7Q%2Fref%3Dsr_1_26%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124822%26sr%3D1-26-spons%26keywords%3Dandroid%26psc%3D1&qualifier=1499124826&id=4777421193755769&widgetName=sp_btf","features":[{"description":"Display Size","value":"7.0 inches"},{"description":"Computer Memory Size","value":"1.0 GB"},{"description":"Operating System","value":"Android"},{"description":"Connectivity Technology","value":"wi-fi"},{"description":"Wireless Communication Technology","value":"Wi-Fi"}],"price":129.99,"shipping":7.99},{"key":"B017SD8RWO","category":"android","name":"Zmodo Outdoor Wireless IP Security Surveillance Camera System - 4 Pack HD Night Vision Remote Access Motion Detection","seller":"Zmodo","wholePrice":"99","priceFraction":"99","stock":9,"star":3,"starCount":4638,"img":"https://images-na.ssl-images-amazon.com/images/I/51jegGDgy2L._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_2?ie=UTF8&adId=A07535107J9TJPUG5AAX&url=https%3A%2F%2Fwww.amazon.com%2FZmodo-Outdoor-Wireless-Security-Surveillance%2Fdp%2FB017SD8RWO%2Fref%3Dsr_1_27%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124822%26sr%3D1-27-spons%26keywords%3Dandroid%26psc%3D1&qualifier=1499124826&id=4777421193755769&widgetName=sp_btf","features":[],"price":99.99,"shipping":0},{"key":"B01N5PRSOT","category":"android","name":"EVANPO Android 6.0 TV BOX Amlogic S905X Quad Core 1GB DDR3 8GB EMMC Flash 3D 4K2K Smart Mini PC Wifi TV Player Set Top Box with Keyboard","seller":"EVANPO","wholePrice":"48","priceFraction":"98","stock":47,"star":4,"starCount":88,"img":"https://images-na.ssl-images-amazon.com/images/I/51JVSEmcsCL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_3?ie=UTF8&adId=A00155643QO9QUBJOBSJT&url=https%3A%2F%2Fwww.amazon.com%2FEVANPO-Android-Amlogic-Player-Keyboard%2Fdp%2FB01N5PRSOT%2Fref%3Dsr_1_28%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124822%26sr%3D1-28-spons%26keywords%3Dandroid%26psc%3D1&qualifier=1499124826&id=4777421193755769&widgetName=sp_btf","features":[],"price":48.98,"shipping":7.99}]; 3 | 4 | export default androids; -------------------------------------------------------------------------------- /src/fakeData/camera.js: -------------------------------------------------------------------------------- 1 | var cameras = 2 | [{"key":"B016F3M7OM","category":"camera","name":"YI Home Camera Wireless IP Security Surveillance System (US Edition) White","seller":"YI","wholePrice":"39","priceFraction":"99","stock":48,"star":4,"starCount":985,"img":"https://images-na.ssl-images-amazon.com/images/I/314hcoZg2JL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_electronics_sr_pg1_1?ie=UTF8&adId=A03127032JGFCK6OPGZQ9&url=https%3A%2F%2Fwww.amazon.com%2FYI-Wireless-Security-Surveillance-US%2Fdp%2FB016F3M7OM%2Fref%3Dsr_1_1%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124549%26sr%3D1-1-spons%26keywords%3Dcamera%26psc%3D1&qualifier=1499124549&id=8228299164163419&widgetName=sp_atf","features":[{"description":"Connectivity Technology","value":"wi-fi ready"},{"description":"Wireless Communication Technology","value":"Wireless"}],"price":39.99,"shipping":3.99},{"key":"B01MQ0FSS0","category":"camera","name":"Sony Cyber-Shot DSC-RX100 Digital Camera + 64GB SDXC Memory Dual Battery Kit + Accessory Bundle","seller":"Beach Camera","wholePrice":"499","priceFraction":"00","stock":52,"star":4,"starCount":128,"img":"https://images-na.ssl-images-amazon.com/images/I/61T6hxWFVlL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_electronics_sr_pg1_2?ie=UTF8&adId=A05196583793V13Q2RYYJ&url=https%3A%2F%2Fwww.amazon.com%2FCyber-Shot-DSC-RX100-Digital-Camera-Accessory%2Fdp%2FB01MQ0FSS0%2Fref%3Dsr_1_2%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124549%26sr%3D1-2-spons%26keywords%3Dcamera%26psc%3D1&qualifier=1499124549&id=8228299164163419&widgetName=sp_atf","features":[],"price":499,"shipping":3.99},{"key":"B01KVIN26O","category":"camera","name":"Cell Phone Camera Lens - TURATA 2 in 1 Professional HD Camera Lens Kit 0.45X Super Wide Angle & 12.5X Macro Lens for iPhone7 6s 6s plus 6 plus 5s & Most Smartphone, Tablet","seller":"TURATA","wholePrice":"11","priceFraction":"98","stock":51,"star":4,"starCount":1011,"img":"https://images-na.ssl-images-amazon.com/images/I/41wyZE9sWLL._AC_US218_.jpg","url":"https://www.amazon.com/Cell-Phone-Camera-Lens-Professional/dp/B01KVIN26O/ref=sr_1_3?s=electronics&ie=UTF8&qid=1499124549&sr=1-3&keywords=camera","features":[{"description":"Display Dimensions","value":"37mm"},{"description":"Special Feature","value":"Fit for most smartphones."}],"price":11.98,"shipping":3.99},{"key":"B00UV6I8QQ","category":"camera","name":"Nikon Coolpix L340 20.2MP Digital Camera with 28x Optical Zoom","seller":"Nikon","wholePrice":"148","priceFraction":"00","stock":7,"star":3,"starCount":1560,"img":"https://images-na.ssl-images-amazon.com/images/I/41VVqVvKuNL._AC_US218_.jpg","url":"https://www.amazon.com/Nikon-Coolpix-L340-Digital-Optical/dp/B00UV6I8QQ/ref=sr_1_4?s=electronics&ie=UTF8&qid=1499124549&sr=1-4&keywords=camera","features":[{"description":"Display Size","value":"7.6 inches"},{"description":"Computer Memory Size","value":"43.0 MB"},{"description":"Hardware Interface","value":"audio video port"},{"description":"Special Feature","value":"image-stabilization"}],"price":148,"shipping":3.99},{"key":"B00W68DSWQ","category":"camera","name":"Nikon COOLPIX L340 Digital Camera with 28x Zoom & Full HD Video (Black) International Version + 4 AA Batteries & Charger + 32GB Dlx Accessory Kit w/HeroFiber Cleaning Cloth","seller":"HeroFiber","wholePrice":"239","priceFraction":"99","stock":16,"star":4,"starCount":4472,"img":"https://images-na.ssl-images-amazon.com/images/I/61yFYo02UzL._AC_US218_.jpg","url":"https://www.amazon.com/International-Batteries-Accessory-HeroFiber-Cleaning/dp/B00W68DSWQ/ref=sr_1_5?s=electronics&ie=UTF8&qid=1499124549&sr=1-5&keywords=camera","features":[],"price":239.99,"shipping":7.99},{"key":"B01N6E66RN","category":"camera","name":"Aberg Best 18 mega pixels HD Digital Camera - Digital video camera - Students cameras - Students Camcorder - Handheld Sized Digital Camcorder Indoor Outdoor for Adult /Seniors / Kids (silver)","seller":"Aberg Best","wholePrice":"35","priceFraction":"00","stock":46,"star":2,"starCount":80,"img":"https://images-na.ssl-images-amazon.com/images/I/51AasF06FwL._AC_US218_.jpg","url":"https://www.amazon.com/Aberg-Best-pixels-Digital-Camera/dp/B01N6E66RN/ref=sr_1_6?s=electronics&ie=UTF8&qid=1499124549&sr=1-6&keywords=camera","features":[],"price":35,"shipping":3.99},{"key":"B01CG62D00","category":"camera","name":"Kodak PIXPRO Friendly Zoom FZ43 16 MP Digital Camera with 4X Optical Zoom and 2.7\" LCD Screen (Black)","seller":"Kodak","wholePrice":"66","priceFraction":"40","stock":59,"star":3,"starCount":3095,"img":"https://images-na.ssl-images-amazon.com/images/I/41XZUouAKJL._AC_US218_.jpg","url":"https://www.amazon.com/Kodak-PIXPRO-Friendly-Digital-Optical/dp/B01CG62D00/ref=sr_1_7?s=electronics&ie=UTF8&qid=1499124549&sr=1-7&keywords=camera","features":[{"description":"Display Size","value":"2.7 inches"},{"description":"Computer Memory Size","value":"8 MB"},{"description":"Hardware Interface","value":"audio video port"},{"description":"Display Technology","value":"LCD"},{"description":"Display Resolution Maximum","value":"720p"}],"price":66.4,"shipping":3.99},{"key":"B01LWPSB57","category":"camera","name":"Camera Camcorders, Besteker HD 1080P 24MP 16X Digital Zoom Video Camcorder with 2.7\" LCD and 270 Degree Rotation Screen","seller":"Besteker","wholePrice":"53","priceFraction":"99","stock":71,"star":3,"starCount":553,"img":"https://images-na.ssl-images-amazon.com/images/I/417uVGTgAlL._AC_US218_.jpg","url":"https://www.amazon.com/Camcorders-Besteker-Digital-Camcorder-Rotation/dp/B01LWPSB57/ref=sr_1_8?s=electronics&ie=UTF8&qid=1499124549&sr=1-8&keywords=camera","features":[{"description":"Display Size","value":"2.7 inches"},{"description":"Display Resolution Maximum","value":"1920X1080"},{"description":"Form Factor","value":"rotating"}],"price":53.99,"shipping":3.99},{"key":"B01D93Z89W","category":"camera","name":"Canon EOS Rebel T6 Digital SLR Camera with 18-55mm EF-S f/3.5-5.6 IS II Lens + 58mm Wide Angle Lens + 2x Telephoto Lens + Flash + 48GB SD Memory Card + UV Filter Kit + Tripod + Full Accessory Bundle","seller":"PHOTO4LESS","wholePrice":"469","priceFraction":"00","stock":10,"star":4,"starCount":2583,"img":"https://images-na.ssl-images-amazon.com/images/I/61heZtEPPBL._AC_US218_.jpg","url":"https://www.amazon.com/Canon-T6-Digital-Telephoto-Accessory/dp/B01D93Z89W/ref=sr_1_9?s=electronics&ie=UTF8&qid=1499124549&sr=1-9&keywords=camera","features":[],"price":469,"shipping":7.99},{"key":"B01N0XDRYO","category":"camera","name":"KINGEAR Pcam PDC001 2.7 inch TFT LCD HD Mini Digital Camera(black)","seller":"KINGEAR","wholePrice":"46","priceFraction":"99","stock":11,"star":4,"starCount":3908,"img":"https://images-na.ssl-images-amazon.com/images/I/51uKiDibbZL._AC_US218_.jpg","url":"https://www.amazon.com/KINGEAR-PDC001-2-7-Digital-Camera/dp/B01N0XDRYO/ref=sr_1_10?s=electronics&ie=UTF8&qid=1499124549&sr=1-10&keywords=camera","features":[],"price":46.99,"shipping":3.99},{"key":"B01MRWZ4KL","category":"camera","name":"KINGEAR KG002 2.7 inch TFT LCD HD Mini Digital Camera","seller":"GordVE","wholePrice":"45","priceFraction":"99","stock":24,"star":4,"starCount":3821,"img":"https://images-na.ssl-images-amazon.com/images/I/51fNKzDjiyL._AC_US218_.jpg","url":"https://www.amazon.com/KINGEAR-KG002-inch-Digital-Camera/dp/B01MRWZ4KL/ref=sr_1_11?s=electronics&ie=UTF8&qid=1499124549&sr=1-11&keywords=camera","features":[],"price":45.99,"shipping":7.99},{"key":"B006J0SVWE","category":"camera","name":"Vivitar 20 MP Digital Camera with 1.8\" LCD, Colors and Style May Vary","seller":"Vivitar","wholePrice":"25","priceFraction":"99","stock":17,"star":2,"starCount":4688,"img":"https://images-na.ssl-images-amazon.com/images/I/417t7EUvLpL._AC_US218_.jpg","url":"https://www.amazon.com/Vivitar-Digital-Camera-Colors-Style/dp/B006J0SVWE/ref=sr_1_12?s=electronics&ie=UTF8&qid=1499124549&sr=1-12&keywords=camera","features":[{"description":"Display Size","value":"2.4 inches"},{"description":"Display Type","value":"LCD"},{"description":"Form Factor","value":"Compact"}],"price":25.99,"shipping":7.99},{"key":"B019UDHOMO","category":"camera","name":"Canon PowerShot ELPH 180 (Silver) with 20.0 MP CCD Sensor and 8x Optical Zoom","seller":"Canon","wholePrice":"119","priceFraction":"00","stock":35,"star":4,"starCount":2898,"img":"https://images-na.ssl-images-amazon.com/images/I/418Z3vJAlEL._AC_US218_.jpg","url":"https://www.amazon.com/Canon-PowerShot-Silver-Sensor-Optical/dp/B019UDHOMO/ref=sr_1_13?s=electronics&ie=UTF8&qid=1499124549&sr=1-13&keywords=camera","features":[{"description":"Display Size","value":"5 inches"},{"description":"Hardware Interface","value":"audio video port"},{"description":"Display Technology","value":"LCD"},{"description":"Display Resolution Maximum","value":"1"},{"description":"Display Type","value":"LCD"}],"price":119,"shipping":7.99},{"key":"B01M7V2FKC","category":"camera","name":"Mini Digital Camera,KINGEAR 2.7 inch TFT LCD HD Digital Camera(Black)","seller":"KINGEAR","wholePrice":"46","priceFraction":"99","stock":29,"star":4,"starCount":1710,"img":"https://images-na.ssl-images-amazon.com/images/I/51ILz01lxmL._AC_US218_.jpg","url":"https://www.amazon.com/Mini-Digital-Camera-KINGEAR-Black/dp/B01M7V2FKC/ref=sr_1_14?s=electronics&ie=UTF8&qid=1499124549&sr=1-14&keywords=camera","features":[],"price":46.99,"shipping":3.99},{"key":"B071Z19L5T","category":"camera","name":"Nikon Coolpix L340 20.2 MP Digital Camera with 8GB memory card bundle (28x Optical Zoom, 3.0-Inch LCD, 720P Video, Black)","seller":"Nikon","wholePrice":"169","priceFraction":"99","stock":99,"star":0,"starCount":1665,"img":"https://images-na.ssl-images-amazon.com/images/I/417bGBOCqBL._AC_US218_.jpg","url":"https://www.amazon.com/Nikon-Coolpix-L340-Digital-3-0-Inch/dp/B071Z19L5T/ref=sr_1_15?s=electronics&ie=UTF8&qid=1499124549&sr=1-15&keywords=camera","features":[],"price":169.99,"shipping":3.99},{"key":"B01N6NDHPY","category":"camera","name":"PowerLead PLDH17 2.7 Inch TFT 5X Optical Zoom 15MP 1280 X 720 HD Anti-shake Smile Capture Digital Video Camera(Gold)","seller":"PowerLead","wholePrice":"65","priceFraction":"99","stock":34,"star":4,"starCount":3490,"img":"https://images-na.ssl-images-amazon.com/images/I/41lDD9GODtL._AC_US218_.jpg","url":"https://www.amazon.com/PowerLead-Optical-Anti-shake-Capture-Digital/dp/B01N6NDHPY/ref=sr_1_16?s=electronics&ie=UTF8&qid=1499124549&sr=1-16&keywords=camera","features":[],"price":65.99,"shipping":3.99},{"key":"B00THKEKEQ","category":"camera","name":"Nikon Coolpix L340 20.2 MP Digital Camera with 28x Optical Zoom and 3.0-Inch LCD (Black)","seller":"Nikon","wholePrice":"159","priceFraction":"95","stock":91,"star":4,"starCount":2620,"img":"https://images-na.ssl-images-amazon.com/images/I/41d0gUpd0eL._AC_US218_.jpg","url":"https://www.amazon.com/Nikon-Coolpix-Digital-Optical-3-0-Inch/dp/B00THKEKEQ/ref=sr_1_17?s=electronics&ie=UTF8&qid=1499124549&sr=1-17&keywords=camera","features":[{"description":"Display Size","value":"3 inches"},{"description":"Hardware Interface","value":"audio video port"},{"description":"Memory Storage Capacity","value":"74 MB"},{"description":"Display Type","value":"TFT"},{"description":"Form Factor","value":"Compact"}],"price":159.95,"shipping":7.99},{"key":"B01MQIFINS","category":"camera","name":"Canon EOS Rebel T6 DSLR Camera Bundle with Canon EF-S 18-55mm f/3.5-5.6 IS II Lens + 2pc SanDisk 32GB Memory Cards + Accessory Kit","seller":"Canon","wholePrice":"465","priceFraction":"00","stock":11,"star":4,"starCount":492,"img":"https://images-na.ssl-images-amazon.com/images/I/61j4LE9gOBL._AC_US218_.jpg","url":"https://www.amazon.com/Canon-18-55mm-3-5-5-6-SanDisk-Accessory/dp/B01MQIFINS/ref=sr_1_18?s=electronics&ie=UTF8&qid=1499124549&sr=1-18&keywords=camera","features":[],"price":465,"shipping":7.99},{"key":"B01BMFXNQE","category":"camera","name":"iGadgitz PT310 Mini Lightweight Table Top Stand Tripod and Grip Stabilizer for Digital Camera, DSLR, Video Camera & Camcorder – Black","seller":"igadgitz","wholePrice":"15","priceFraction":"99","stock":16,"star":4,"starCount":3033,"img":"https://images-na.ssl-images-amazon.com/images/I/411OpNYTMeL._AC_US218_.jpg","url":"https://www.amazon.com/iGadgitz-Lightweight-Stabilizer-Digital-Camcorder/dp/B01BMFXNQE/ref=sr_1_19?s=electronics&ie=UTF8&qid=1499124549&sr=1-19&keywords=camera","features":[],"price":15.99,"shipping":0},{"key":"B06XCMCFZW","category":"camera","name":"Digital Camera,KINGEAR 2.7 inch TFT LCD HD Digital Camera","seller":"KINGEAR","wholePrice":"43","priceFraction":"99","stock":13,"star":4,"starCount":1587,"img":"https://images-na.ssl-images-amazon.com/images/I/51OSpayWCLL._AC_US218_.jpg","url":"https://www.amazon.com/Digital-Camera-KINGEAR-2-7-inch/dp/B06XCMCFZW/ref=sr_1_20?s=electronics&ie=UTF8&qid=1499124549&sr=1-20&keywords=camera","features":[],"price":43.99,"shipping":3.99},{"key":"B071G4XXZ4","category":"camera","name":"Btopllc On Dash Video Dash Cam Car Driving Video Recorder Camera 2.5 inch TFT LCD Screen USB Charging Vehicle Video Camera Loop Recording with Night Vision Car Dashboard Camera Recorder-Black","seller":"Btopllc","wholePrice":"18","priceFraction":"95","stock":17,"star":4,"starCount":4025,"img":"https://images-na.ssl-images-amazon.com/images/I/41JPzJ2V0RL._AC_US218_.jpg","url":"https://www.amazon.com/Btopllc-Recorder-Recording-Dashboard-Recorder-Black/dp/B071G4XXZ4/ref=sr_1_21?s=electronics&ie=UTF8&qid=1499124549&sr=1-21&keywords=camera","features":[],"price":18.95,"shipping":7.99},{"key":"B00HE9G3UQ","category":"camera","name":"SGC-598 Photography Interview Shotgun MIC Microphone for Nikon Canon DSLR Camera (Need 3.5mm Interface)","seller":"TAKSTAR","wholePrice":"26","priceFraction":"90","stock":45,"star":3,"starCount":1225,"img":"https://images-na.ssl-images-amazon.com/images/I/51SRyF-I1aL._AC_US218_.jpg","url":"https://www.amazon.com/SGC-598-Photography-Interview-Microphone-Interface/dp/B00HE9G3UQ/ref=sr_1_22?s=electronics&ie=UTF8&qid=1499124549&sr=1-22&keywords=camera","features":[],"price":26.9,"shipping":3.99},{"key":"B00I8BIBCW","category":"camera","name":"Sony DSCW800/B 20.1 MP Digital Camera (Black)","seller":"Sony","wholePrice":"89","priceFraction":"98","stock":37,"star":3,"starCount":3326,"img":"https://images-na.ssl-images-amazon.com/images/I/41Huy05eJiL._AC_US218_.jpg","url":"https://www.amazon.com/Sony-DSCW800-Digital-Camera-Black/dp/B00I8BIBCW/ref=sr_1_24?s=electronics&ie=UTF8&qid=1499124549&sr=1-24&keywords=camera","features":[{"description":"Display Size","value":"2.7 inches"},{"description":"Display Fixture Type","value":"Fixed"},{"description":"Display Resolution Maximum","value":"230000"},{"description":"Memory Storage Capacity","value":"29 MB"},{"description":"Display Type","value":"LCD"}],"price":89.98,"shipping":3.99},{"key":"B01MY0HQWS","category":"camera","name":"KINGEAR KG0016 2.7 Inch TFT 3X Optical Zoom 18MP 1280 X 720 Digital Video Camera","seller":"GordVE","wholePrice":"59","priceFraction":"89","stock":97,"star":4,"starCount":2763,"img":"https://images-na.ssl-images-amazon.com/images/I/413kYxodmNL._AC_US218_.jpg","url":"https://www.amazon.com/KINGEAR-KG0016-Optical-Digital-Camera/dp/B01MY0HQWS/ref=sr_1_25?s=electronics&ie=UTF8&qid=1499124549&sr=1-25&keywords=camera","features":[],"price":59.89,"shipping":7.99},{"key":"B00RKNND2W","category":"camera","name":"Canon SX530 HS 9779B001 PowerShot","seller":"Canon","wholePrice":"249","priceFraction":"00","stock":81,"star":4,"starCount":3147,"img":"https://images-na.ssl-images-amazon.com/images/I/412kGjEHJjL._AC_US218_.jpg","url":"https://www.amazon.com/Canon-SX530-HS-9779B001-PowerShot/dp/B00RKNND2W/ref=sr_1_26?s=electronics&ie=UTF8&qid=1499124549&sr=1-26&keywords=camera","features":[{"description":"Display Size","value":"3 inches"},{"description":"Display Fixture Type","value":"Fixed"},{"description":"Hardware Interface","value":"audio video port"},{"description":"Wireless Communication Technology","value":"Yes"},{"description":"Display Resolution Maximum","value":"461000"}],"price":249,"shipping":0},{"key":"B06XGZB6P3","category":"camera","name":"Akaso EK7000 Ultra HD 4k WIFI 170 Degree Wide Waterproof Sports Action Camera Black + 32GB Outdoor Adventure Mounting Bundle","seller":"AKASO","wholePrice":"116","priceFraction":"33","stock":31,"star":4,"starCount":4896,"img":"https://images-na.ssl-images-amazon.com/images/I/51xBO1ijxWL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_1?ie=UTF8&adId=A0699155IZEFEU9092Y5&url=https%3A%2F%2Fwww.amazon.com%2FEK7000-Waterproof-Outdoor-Adventure-Mounting%2Fdp%2FB06XGZB6P3%2Fref%3Dsr_1_27%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124549%26sr%3D1-27-spons%26keywords%3Dcamera%26psc%3D1&qualifier=1499124549&id=8228299164163419&widgetName=sp_btf","features":[],"price":116.33,"shipping":0},{"key":"B06XRTN893","category":"camera","name":"Video Camera Camcorder, incoSKY 1080P 24MP 16X Digital Zoom Camera with 2.7\" TFT LCD 270 Degree Rotation Screen, Black","seller":"incoSKY","wholePrice":"49","priceFraction":"99","stock":96,"star":3,"starCount":4565,"img":"https://images-na.ssl-images-amazon.com/images/I/41Ql6BycBCL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_2?ie=UTF8&adId=A1008791K1VQMNSWD4IF&url=https%3A%2F%2Fwww.amazon.com%2FCamera-Camcorder-incoSKY-Digital-Rotation%2Fdp%2FB06XRTN893%2Fref%3Dsr_1_28%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124549%26sr%3D1-28-spons%26keywords%3Dcamera%26psc%3D1&qualifier=1499124549&id=8228299164163419&widgetName=sp_btf","features":[{"description":"Display Size","value":"2.7 inches"},{"description":"Form Factor","value":"rotating"}],"price":49.99,"shipping":7.99}]; 3 | 4 | export default cameras; -------------------------------------------------------------------------------- /src/fakeData/index.js: -------------------------------------------------------------------------------- 1 | import androids from './android'; 2 | import cameras from './camera'; 3 | import laptops from './laptop'; 4 | 5 | const fakeData = [...androids, ...cameras, ...laptops]; 6 | 7 | 8 | const shuffle = a => { 9 | for (let i = a.length; i; i--) { 10 | let j = Math.floor(Math.random() * i); 11 | [a[i - 1], a[j]] = [a[j], a[i - 1]]; 12 | } 13 | } 14 | 15 | shuffle(fakeData); 16 | 17 | export default fakeData; -------------------------------------------------------------------------------- /src/fakeData/laptop.js: -------------------------------------------------------------------------------- 1 | var laptops = 2 | [{"key":"B002RL8IYK","category":"laptop","name":"3M Gold Privacy Filter for 17\" Widescreen Laptop (16:10) (GF170W1B)","seller":"3M","wholePrice":"68","priceFraction":"36","stock":36,"star":3,"starCount":3245,"img":"https://images-na.ssl-images-amazon.com/images/I/415oziPFA0L._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_electronics_sr_pg1_1?ie=UTF8&adId=A03956601N6RBLKGAP4W1&url=https%3A%2F%2Fwww.amazon.com%2F3M-Privacy-Filter-Widescreen-Laptop%2Fdp%2FB002RL8IYK%2Fref%3Dsr_1_1%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124890%26sr%3D1-1-spons%26keywords%3Dlaptop%26psc%3D1&qualifier=1499124889&id=6267744216991374&widgetName=sp_atf","features":[{"description":"Display Size","value":"17 inches"},{"description":"Hardware Platform","value":"PC"}],"price":68.36,"shipping":7.99},{"key":"B01LZ2WZGH","category":"laptop","name":"Manfrotto MB LF-WN-BP camera & laptop backpack for DSLR Lifestyle Windsor, grey","seller":"Manfrotto","wholePrice":"169","priceFraction":"88","stock":55,"star":2,"starCount":2899,"img":"https://images-na.ssl-images-amazon.com/images/I/51mEVhwXGKL._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_electronics_sr_pg1_2?ie=UTF8&adId=A04941221ULRUNSJPY1RW&url=https%3A%2F%2Fwww.amazon.com%2FManfrotto-MB-LF-WN-BP-backpack-Lifestyle%2Fdp%2FB01LZ2WZGH%2Fref%3Dsr_1_2%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124890%26sr%3D1-2-spons%26keywords%3Dlaptop%26psc%3D1&qualifier=1499124889&id=6267744216991374&widgetName=sp_atf","features":[],"price":169.88,"shipping":3.99},{"key":"B01K1IO3QW","category":"laptop","name":"Acer Aspire E 15 E5-575-33BM 15.6-Inch Full HD Notebook (Intel Core i3-7100U Processor 7th Generation , 4GB DDR4, 1TB 5400RPM Hard Drive, Intel HD Graphics 620, Windows 10 Home), Obsidian Black","seller":"Acer","wholePrice":"349","priceFraction":"99","stock":3,"star":3,"starCount":3525,"img":"https://images-na.ssl-images-amazon.com/images/I/41HfDkXXyeL._AC_US218_.jpg","url":"https://www.amazon.com/Acer-E5-575-33BM-15-6-Inch-Processor-Generation/dp/B01K1IO3QW/ref=sr_1_3?s=electronics&ie=UTF8&qid=1499124890&sr=1-3&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"1000 GB"},{"description":"Cpu Model Family","value":"core i3"}],"price":349.99,"shipping":3.99},{"key":"B01LD4MGY4","category":"laptop","name":"Acer Aspire E 15 E5-575G-57D4 15.6-Inches Full HD Notebook (i5-7200U, 8GB DDR4 SDRAM, 256GB SSD, Windows 10 Home), Obsidian Black","seller":"Acer","wholePrice":"579","priceFraction":"99","stock":49,"star":4,"starCount":4232,"img":"https://images-na.ssl-images-amazon.com/images/I/41HfDkXXyeL._AC_US218_.jpg","url":"https://www.amazon.com/Acer-E5-575G-57D4-15-6-Inches-Notebook-i5-7200U/dp/B01LD4MGY4/ref=sr_1_4?s=electronics&ie=UTF8&qid=1499124890&sr=1-4&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"8 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Cpu Model Family","value":"core i5"},{"description":"Display Technology","value":"LED-Lit"}],"price":579.99,"shipping":7.99},{"key":"B01M18UZF5","category":"laptop","name":"ASUS ZenBook UX330UA-AH54 13.3-inch Ultra-Slim Laptop (Core i5 Processor, 8GB DDR3, 256GB SSD, Windows 10) With Harman Kardon Audio, Backlit keyboard, Fingerprint Reader","seller":"Asus","wholePrice":"699","priceFraction":"00","stock":23,"star":4,"starCount":2457,"img":"https://images-na.ssl-images-amazon.com/images/I/417yCr3mvYL._AC_US218_.jpg","url":"https://www.amazon.com/UX330UA-AH54-13-3-inch-Ultra-Slim-Processor-Fingerprint/dp/B01M18UZF5/ref=sr_1_5?s=electronics&ie=UTF8&qid=1499124890&sr=1-5&keywords=laptop","features":[{"description":"Display Size","value":"13.3 inches"},{"description":"Computer Memory Size","value":"8 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"256 GB"},{"description":"Cpu Model Family","value":"core i5 7200u"}],"price":699,"shipping":3.99},{"key":"B01DBGVB7K","category":"laptop","name":"ASUS Chromebook C202SA-YS02 11.6\" Ruggedized and Water Resistant Design with 180 Degree (Intel Celeron 4 GB, 16GB eMMC, Dark Blue)","seller":"Asus","wholePrice":220,"priceFraction":49,"stock":54,"star":4,"starCount":2777,"img":"https://images-na.ssl-images-amazon.com/images/I/31inMpRxCFL._AC_US218_.jpg","url":"https://www.amazon.com/Chromebook-C202SA-YS02-Ruggedized-Resistant-Celeron/dp/B01DBGVB7K/ref=sr_1_6?s=electronics&ie=UTF8&qid=1499124890&sr=1-6&keywords=laptop","features":[{"description":"Display Size","value":"11.6 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome"},{"description":"Hard Disk Size","value":"16 GB"},{"description":"Cpu Model Family","value":"celeron"}],"price":220.49,"shipping":3.99},{"key":"B015WXL0C6","category":"laptop","name":"Apple MacBook Air 13.3-Inch Laptop (Intel Core i5 1.6GHz, 128GB Flash, 8GB RAM, OS X El Capitan)","seller":"Apple","wholePrice":"848","priceFraction":"99","stock":22,"star":4,"starCount":2830,"img":"https://images-na.ssl-images-amazon.com/images/I/51GRACqhHbL._AC_US218_.jpg","url":"https://www.amazon.com/Apple-MacBook-13-3-Inch-Laptop-Capitan/dp/B015WXL0C6/ref=sr_1_7?s=electronics&ie=UTF8&qid=1499124890&sr=1-7&keywords=laptop","features":[{"description":"Display Size","value":"13.3 inches"},{"description":"Computer Memory Size","value":"8.0 GB"},{"description":"Operating System","value":"Mac OS X"},{"description":"Hard Disk Size","value":"128 GB"},{"description":"Cpu Model Family","value":"core i5"}],"price":848.99,"shipping":7.99},{"key":"B06Y4GZS9C","category":"laptop","name":"Acer Predator Helios 300 Gaming Laptop, Intel Core i7, GeForce GTX 1 060, 15.6\" Full HD, 16GB DDR4, 256GB SSD, G3-571-77QK","seller":"Acer","wholePrice":"1,049","priceFraction":"99","stock":22,"star":3,"starCount":257,"img":"https://images-na.ssl-images-amazon.com/images/I/41v2oytxs9L._AC_US218_.jpg","url":"https://www.amazon.com/Acer-Predator-Helios-GeForce-G3-571-77QK/dp/B06Y4GZS9C/ref=sr_1_8?s=electronics&ie=UTF8&qid=1499124890&sr=1-8&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"16 GB"},{"description":"Operating System","value":"Windows 10 Home"},{"description":"Cpu Model Family","value":"core i7"},{"description":"Cpu Model Manufacturer","value":"Intel"}],"price":1,"shipping":7.99},{"key":"B06XJJG4PD","category":"laptop","name":"ASUS P-Series P2540UA-AB51 business standard Laptop, 7th Gen Intel Core i5, 2.5GHz (3M Cache, up to 3.1GHz), FHD Display, 8GB RAM, 1TB HDD, Windows 10 Home, Fingerprint, TPM, 9hrs battery life","seller":"Asus","wholePrice":"499","priceFraction":"00","stock":35,"star":3,"starCount":599,"img":"https://images-na.ssl-images-amazon.com/images/I/41PUHRFGpvL._AC_US218_.jpg","url":"https://www.amazon.com/P2540UA-AB51-business-standard-Display-Fingerprint/dp/B06XJJG4PD/ref=sr_1_9?s=electronics&ie=UTF8&qid=1499124890&sr=1-9&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"8 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"1000 GB"},{"description":"Cpu Model Family","value":"core i5 7200u"}],"price":499,"shipping":7.99},{"key":"B01NBE6Y5D","category":"laptop","name":"HP 15.6\" HD WLED Backlit Display Laptop, AMD A6-7310 Quad-Core APU 2GHz, 4GB RAM, 500GB HDD WiFi, DVD+/-RW, Webcam, Windows 10, Black","seller":"HP","wholePrice":"247","priceFraction":"98","stock":74,"star":3,"starCount":4293,"img":"https://images-na.ssl-images-amazon.com/images/I/51-2Z4ZWimL._AC_US218_.jpg","url":"https://www.amazon.com/HP-Backlit-Display-A6-7310-Quad-Core/dp/B01NBE6Y5D/ref=sr_1_10?s=electronics&ie=UTF8&qid=1499124890&sr=1-10&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"4.0 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"500.0 GB"},{"description":"Cpu Model Family","value":"amd a series"}],"price":247.98,"shipping":7.99},{"key":"B01J42JPJG","category":"laptop","name":"Acer Chromebook R 11 Convertible, 11.6-Inch HD Touch, Intel Celeron N3150, 4GB DDR3L, 32GB, Chrome, CB5-132T-C1LK","seller":"Acer","wholePrice":"279","priceFraction":"99","stock":19,"star":4,"starCount":4646,"img":"https://images-na.ssl-images-amazon.com/images/I/51xMqkFZ+RL._AC_US218_.jpg","url":"https://www.amazon.com/Acer-Chromebook-Convertible-11-6-Inch-CB5-132T-C1LK/dp/B01J42JPJG/ref=sr_1_11?s=electronics&ie=UTF8&qid=1499124890&sr=1-11&keywords=laptop","features":[{"description":"Display Size","value":"11.6 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome"},{"description":"Hard Disk Size","value":"32 GB"},{"description":"Cpu Model Family","value":"celeron"}],"price":279.99,"shipping":3.99},{"key":"B01F4ZG68A","category":"laptop","name":"HP 14-inch Laptop, AMD E2-7110, 4GB RAM, 32GB eMMC, Windows 10 (14-an013nr, Silver)","seller":"HP","wholePrice":"212","priceFraction":"33","stock":33,"star":3,"starCount":2066,"img":"https://images-na.ssl-images-amazon.com/images/I/414egKO4O3L._AC_US218_.jpg","url":"https://www.amazon.com/HP-14-inch-E2-7110-Windows-14-an013nr/dp/B01F4ZG68A/ref=sr_1_13?s=electronics&ie=UTF8&qid=1499124890&sr=1-13&keywords=laptop","features":[{"description":"Display Size","value":"14 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Windows 10 Home"},{"description":"Hard Disk Size","value":"32 GB"},{"description":"Cpu Model Family","value":"e2 7110"}],"price":212.33,"shipping":7.99},{"key":"B01D27ERMO","category":"laptop","name":"Dell Inspiron Flagship 15.6-Inch FHD Touchscreen Backlit Keyboard Laptop PC (Intel Core i5-6200U, 8GB RAM, 1TB HDD, RealSense 3D Camera, DVD +/- RW, Bluetooth, Windows 10), Silver","seller":"Dell","wholePrice":"498","priceFraction":"94","stock":14,"star":3,"starCount":3141,"img":"https://images-na.ssl-images-amazon.com/images/I/51xk4birT2L._AC_US218_.jpg","url":"https://www.amazon.com/Dell-15-6-Inch-Touchscreen-RealSense-Bluetooth/dp/B01D27ERMO/ref=sr_1_14?s=electronics&ie=UTF8&qid=1499124890&sr=1-14&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"8.0 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"1.0 TB"},{"description":"Cpu Model Family","value":"core i5"}],"price":498.94,"shipping":3.99},{"key":"B06X6J2RLY","category":"laptop","name":"HP 15.6-Inch HD Touchscreen Laptop (Intel Quad Core Pentium N3540 2.16 GHz, 4GB DDR3L-1600 Memory, 500 GB HDD, DVD Burner, HDMI, HD Webcam, Win 10)","seller":"HP","wholePrice":"287","priceFraction":"94","stock":85,"star":4,"starCount":149,"img":"https://images-na.ssl-images-amazon.com/images/I/416UTZJ0FbL._AC_US218_.jpg","url":"https://www.amazon.com/HP-15-6-Inch-Touchscreen-Pentium-DDR3L-1600/dp/B06X6J2RLY/ref=sr_1_15?s=electronics&ie=UTF8&qid=1499124890&sr=1-15&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"4.0 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"500.0 GB"},{"description":"Cpu Model Family","value":"pentium"}],"price":287.94,"shipping":7.99},{"key":"B01N5G5PG2","category":"laptop","name":"ASUS Chromebook Flip C302CA-DHM4 12.5-Inch Touchscreen Intel Core m3 with 64GB storage and 4GB RAM","seller":"Asus","wholePrice":"499","priceFraction":"00","stock":52,"star":4,"starCount":1146,"img":"https://images-na.ssl-images-amazon.com/images/I/41LBkDN-S3L._AC_US218_.jpg","url":"https://www.amazon.com/Chromebook-C302CA-DHM4-12-5-Inch-Touchscreen-storage/dp/B01N5G5PG2/ref=sr_1_16?s=electronics&ie=UTF8&qid=1499124890&sr=1-16&keywords=laptop","features":[{"description":"Display Size","value":"12.5 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome"},{"description":"Hard Disk Size","value":"64 GB"},{"description":"Cpu Model Family","value":"core m"}],"price":499,"shipping":0},{"key":"B01LZ6XKS6","category":"laptop","name":"Samsung Chromebook Plus Convertible Touch Laptop (XE513C24-K01US)","seller":"Samsung","wholePrice":"408","priceFraction":"45","stock":96,"star":4,"starCount":3742,"img":"https://images-na.ssl-images-amazon.com/images/I/41Ux4186xoL._AC_US218_.jpg","url":"https://www.amazon.com/Samsung-Chromebook-Convertible-Laptop-XE513C24-K01US/dp/B01LZ6XKS6/ref=sr_1_17?s=electronics&ie=UTF8&qid=1499124890&sr=1-17&keywords=laptop","features":[{"description":"Display Size","value":"12.3 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome"},{"description":"Hard Disk Size","value":"32 GB"},{"description":"Connectivity Technology","value":"wireless"}],"price":408.45,"shipping":3.99},{"key":"B06XFGF7SN","category":"laptop","name":"Dell Inspiron 15.6\" Gaming Laptop (7th Gen Intel Core i7, 8 GB RAM, 1000 GB HDD + 128GB SSD), NVIDIA GTX 1050) (i5577-7359BLK-PUS)","seller":"Dell","wholePrice":"899","priceFraction":"99","stock":57,"star":3,"starCount":3972,"img":"https://images-na.ssl-images-amazon.com/images/I/41zfabBnrLL._AC_US218_.jpg","url":"https://www.amazon.com/Dell-Inspiron-Gaming-Laptop-i5577-7359BLK-PUS/dp/B06XFGF7SN/ref=sr_1_18?s=electronics&ie=UTF8&qid=1499124890&sr=1-18&keywords=laptop","features":[{"description":"Display Size","value":"15.6 inches"},{"description":"Computer Memory Size","value":"8 GB"},{"description":"Operating System","value":"Windows 10 Home 64-bit English"},{"description":"Hard Disk Size","value":"1000 GB"},{"description":"Cpu Model Family","value":"core i5 6300hq"}],"price":899.99,"shipping":3.99},{"key":"B01LT692RK","category":"laptop","name":"ASUS E200HA Portable Lightweight 11.6-inch Intel Quad-Core Laptop, 4GB RAM, 32GB Storage, Windows 10 with 1 Year Microsoft Office 365 Subscription","seller":"Asus","wholePrice":"199","priceFraction":"00","stock":41,"star":3,"starCount":4074,"img":"https://images-na.ssl-images-amazon.com/images/I/51zIMkOI70L._AC_US218_.jpg","url":"https://www.amazon.com/Lightweight-11-6-inch-Quad-Core-Microsoft-Subscription/dp/B01LT692RK/ref=sr_1_19?s=electronics&ie=UTF8&qid=1499124890&sr=1-19&keywords=laptop","features":[{"description":"Display Size","value":"11.6 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"32 GB"},{"description":"Cpu Model Family","value":"intel atom"}],"price":199,"shipping":3.99},{"key":"B071LB1GG4","category":"laptop","name":"Samsung XE510C24-K01US Chromebook Pro","seller":"Samsung","wholePrice":"549","priceFraction":"99","stock":91,"star":4,"starCount":1157,"img":"https://images-na.ssl-images-amazon.com/images/I/41QCsi3gCrL._AC_US218_.jpg","url":"https://www.amazon.com/Samsung-XE510C24-K01US-Chromebook-Pro/dp/B071LB1GG4/ref=sr_1_20?s=electronics&ie=UTF8&qid=1499124890&sr=1-20&keywords=laptop","features":[{"description":"Display Size","value":"12.3 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome"},{"description":"Connectivity Technology","value":"wireless"},{"description":"Hardware Platform","value":"Chrome"}],"price":549.99,"shipping":0},{"key":"B01CVOLVPA","category":"laptop","name":"Acer Chromebook 14, Aluminum, 14-inch Full HD, Intel Celeron Quad-Core N3160, 4GB LPDDR3, 32GB, Chrome, CB3-431-C5FM","seller":"Acer","wholePrice":"294","priceFraction":"98","stock":57,"star":4,"starCount":678,"img":"https://images-na.ssl-images-amazon.com/images/I/518PvURfFsL._AC_US218_.jpg","url":"https://www.amazon.com/Acer-Chromebook-Aluminum-Quad-Core-CB3-431-C5FM/dp/B01CVOLVPA/ref=sr_1_21?s=electronics&ie=UTF8&qid=1499124890&sr=1-21&keywords=laptop","features":[{"description":"Display Size","value":"14 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome"},{"description":"Hard Disk Size","value":"32 GB"},{"description":"Cpu Model Family","value":"celeron"}],"price":294.98,"shipping":7.99},{"key":"B01EIUOSRS","category":"laptop","name":"Apple MMGF2LL/A MacBook Air 13.3-Inch Laptop (8GB RAM 128 GB SSD) MMGF2","seller":"Apple","wholePrice":"799","priceFraction":"99","stock":51,"star":4,"starCount":3295,"img":"https://images-na.ssl-images-amazon.com/images/I/41AerRC5u6L._AC_US218_.jpg","url":"https://www.amazon.com/Apple-MMGF2LL-MacBook-13-3-Inch-Laptop/dp/B01EIUOSRS/ref=sr_1_22?s=electronics&ie=UTF8&qid=1499124890&sr=1-22&keywords=laptop","features":[{"description":"Display Size","value":"13.3 inches"},{"description":"Computer Memory Size","value":"8 GB"},{"description":"Operating System","value":"Mac OS X"},{"description":"Hard Disk Size","value":"128 GB"},{"description":"Cpu Model Family","value":"core i5"}],"price":799.99,"shipping":7.99},{"key":"B01JLCKP34","category":"laptop","name":"HP Stream Laptop PC 14-ax010nr (Intel Celeron N3060, 4 GB RAM, 32 GB eMMC) with Office 365 Personal for one year","seller":"HP","wholePrice":"219","priceFraction":"99","stock":62,"star":3,"starCount":2286,"img":"https://images-na.ssl-images-amazon.com/images/I/51h+5rcpStL._AC_US218_.jpg","url":"https://www.amazon.com/HP-Stream-14-ax010nr-Celeron-Personal/dp/B01JLCKP34/ref=sr_1_23?s=electronics&ie=UTF8&qid=1499124890&sr=1-23&keywords=laptop","features":[{"description":"Display Size","value":"14 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Windows 10"},{"description":"Hard Disk Size","value":"32 GB"},{"description":"Cpu Model Family","value":"celeron"}],"price":219.99,"shipping":7.99},{"key":"B071SF41Y9","category":"laptop","name":"Microsoft Surface Pro (Intel Core i5, 8GB RAM, 256GB)","seller":"Microsoft","wholePrice":"1,294","priceFraction":"99","stock":99,"star":3,"starCount":461,"img":"https://images-na.ssl-images-amazon.com/images/I/418g6Q3eTHL._AC_US218_.jpg","url":"https://www.amazon.com/Microsoft-Surface-Intel-Core-256GB/dp/B071SF41Y9/ref=sr_1_25?s=electronics&ie=UTF8&qid=1499124890&sr=1-25&keywords=laptop","features":[{"description":"Display Size","value":"12.3 inches"},{"description":"Computer Memory Size","value":"8 GB"},{"description":"Operating System","value":"Windows 10 Pro"},{"description":"Cpu Model Family","value":"8032"},{"description":"Display Technology","value":"LCD"}],"price":1,"shipping":7.99},{"key":"B01N5P6TJW","category":"laptop","name":"Samsung Chromebook 3, 11.6\", 4GB RAM, 16GB eMMC, Chromebook (XE500C13-K04US)","seller":"Samsung","wholePrice":"169","priceFraction":"00","stock":36,"star":3,"starCount":2527,"img":"https://images-na.ssl-images-amazon.com/images/I/41XCWymAVaL._AC_US218_.jpg","url":"https://www.amazon.com/Samsung-Chromebook-11-6-16GB-XE500C13-K04US/dp/B01N5P6TJW/ref=sr_1_26?s=electronics&ie=UTF8&qid=1499124890&sr=1-26&keywords=laptop","features":[{"description":"Display Size","value":"11.6 inches"},{"description":"Computer Memory Size","value":"4 GB"},{"description":"Operating System","value":"Chrome OS"},{"description":"Hard Disk Size","value":"16 GB"},{"description":"Cpu Model Family","value":"8032"}],"price":169,"shipping":7.99},{"key":"B01M8J68W0","category":"laptop","name":"Kayond Bule Rose Pattern 12-13 inch Canvas laptop sleeve with pocket 12.5inch 13.3 inch laptop case macbook air 13 case macbook pro 13 sleeve","seller":"kayond","wholePrice":"11","priceFraction":"99","stock":86,"star":4,"starCount":2359,"img":"https://images-na.ssl-images-amazon.com/images/I/51zDiHyaE1L._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_1?ie=UTF8&adId=A03286941HBVHVI1MCDYH&url=https%3A%2F%2Fwww.amazon.com%2FKayond-Pattern-Canvas-12-5inch-macbook%2Fdp%2FB01M8J68W0%2Fref%3Dsr_1_27%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124890%26sr%3D1-27-spons%26keywords%3Dlaptop%26psc%3D1&qualifier=1499124889&id=6267744216991374&widgetName=sp_btf","features":[],"price":11.99,"shipping":3.99},{"key":"B072TY6LZL","category":"laptop","name":"Microsoft Surface Laptop 13.5 inch Screen Protector, Megoo Premium [Tempered Glass] Anti-scratch bubble free Screen Protector for Microsoft Surface Laptop (2017 Release)","seller":"Megoo","wholePrice":"17","priceFraction":"77","stock":75,"star":0,"starCount":3019,"img":"https://images-na.ssl-images-amazon.com/images/I/51YGz9inR9L._AC_US218_.jpg","url":"https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_btf_electronics_sr_pg1_2?ie=UTF8&adId=A08835611S2XQ8K5PH7WW&url=https%3A%2F%2Fwww.amazon.com%2FMicrosoft-Protector-Megoo-Tempered-Anti-scratch%2Fdp%2FB072TY6LZL%2Fref%3Dsr_1_28%3Fs%3Delectronics%26ie%3DUTF8%26qid%3D1499124890%26sr%3D1-28-spons%26keywords%3Dlaptop%26psc%3D1&qualifier=1499124889&id=6267744216991374&widgetName=sp_btf","features":[],"price":17.77,"shipping":3.99}]; 3 | 4 | export default laptops; -------------------------------------------------------------------------------- /src/fakeData/shippingCosts.js: -------------------------------------------------------------------------------- 1 | var shippingCost = [ 2 | { 3 | price: 0, 4 | days: '8-10', 5 | type: 'Free', 6 | isSelected:false 7 | }, 8 | { 9 | price: 3.99, 10 | days: '5-7', 11 | type: 'Regular', 12 | isSelected:false 13 | }, 14 | { 15 | price: 7.99, 16 | days: '2-4', 17 | type: 'Standard', 18 | isSelected:false 19 | } 20 | ]; 21 | 22 | export default shippingCost; -------------------------------------------------------------------------------- /src/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/images/favicon.ico -------------------------------------------------------------------------------- /src/images/giphy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/images/giphy.gif -------------------------------------------------------------------------------- /src/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProgrammingHero1/ema-john-simple-initial/6f763c4f9b99b2ce7b7e59945e48e11046a364b0/src/images/logo.png -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl, { 104 | headers: { 'Service-Worker': 'script' } 105 | }) 106 | .then(response => { 107 | // Ensure service worker exists, and that we really are getting a JS file. 108 | const contentType = response.headers.get('content-type'); 109 | if ( 110 | response.status === 404 || 111 | (contentType != null && contentType.indexOf('javascript') === -1) 112 | ) { 113 | // No service worker found. Probably a different app. Reload the page. 114 | navigator.serviceWorker.ready.then(registration => { 115 | registration.unregister().then(() => { 116 | window.location.reload(); 117 | }); 118 | }); 119 | } else { 120 | // Service worker found. Proceed as normal. 121 | registerValidSW(swUrl, config); 122 | } 123 | }) 124 | .catch(() => { 125 | console.log( 126 | 'No internet connection found. App is running in offline mode.' 127 | ); 128 | }); 129 | } 130 | 131 | export function unregister() { 132 | if ('serviceWorker' in navigator) { 133 | navigator.serviceWorker.ready 134 | .then(registration => { 135 | registration.unregister(); 136 | }) 137 | .catch(error => { 138 | console.error(error.message); 139 | }); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /src/utilities/databaseManager.js: -------------------------------------------------------------------------------- 1 | const getUser = () => { 2 | const existingUser = localStorage.getItem('userId'); 3 | if (existingUser) { 4 | return existingUser; 5 | } else { 6 | const newUser = 'user-' + new Date().getTime(); 7 | localStorage.setItem('userId', newUser) 8 | return newUser; 9 | } 10 | } 11 | 12 | 13 | const getDataKey = () => { 14 | const userId = getUser(); 15 | return `emaJohn/carts/${userId}` 16 | } 17 | 18 | // push to local storage: a temporary place for database 19 | const getDatabaseCart = () => { 20 | const dataKey = getDataKey(); 21 | const data = localStorage.getItem(dataKey) || "{}"; 22 | return JSON.parse(data); 23 | } 24 | 25 | const addToDatabaseCart = (key, count) => { 26 | const currentCart = getDatabaseCart(); 27 | currentCart[key] = count; 28 | localStorage.setItem(getDataKey(), JSON.stringify(currentCart)); 29 | } 30 | 31 | const removeFromDatabaseCart = key => { 32 | const currentCart = getDatabaseCart(); 33 | delete currentCart[key]; 34 | localStorage.setItem(getDataKey(), JSON.stringify(currentCart)); 35 | } 36 | 37 | const clearLocalShoppingCart = (cart) => { 38 | localStorage.removeItem(getDataKey()); 39 | } 40 | 41 | 42 | export { addToDatabaseCart, getDatabaseCart, removeFromDatabaseCart, clearLocalShoppingCart}; 43 | 44 | 45 | // polyfill to support older browser 46 | const localStorage = window.localStorage || (() => { 47 | let store = {} 48 | return { 49 | getItem(key) { 50 | return store[key] 51 | }, 52 | setItem(key, value) { 53 | store[key] = value.toString() 54 | }, 55 | clear() { 56 | store = {} 57 | } 58 | }; 59 | })() 60 | 61 | // end of poly fill --------------------------------------------------------------------------------