diff --git a/package-lock.json b/package-lock.json
index f93a167..f205360 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,10 @@
"react-router-dom": "5.3",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
+ },
+ "devDependencies": {
+ "eslint": "^7.32.0",
+ "eslint-plugin-react": "^7.27.1"
}
},
"node_modules/@babel/code-frame": {
@@ -6141,9 +6145,9 @@
}
},
"node_modules/confusing-browser-globals": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz",
- "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA=="
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz",
+ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA=="
},
"node_modules/connect-history-api-fallback": {
"version": "1.6.0",
@@ -26267,9 +26271,9 @@
}
},
"confusing-browser-globals": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz",
- "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA=="
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz",
+ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA=="
},
"connect-history-api-fallback": {
"version": "1.6.0",
diff --git a/package.json b/package.json
index 22103cf..c8f4e86 100644
--- a/package.json
+++ b/package.json
@@ -35,5 +35,9 @@
"last 1 firefox version",
"last 1 safari version"
]
+ },
+ "devDependencies": {
+ "eslint": "^7.32.0",
+ "eslint-plugin-react": "^7.27.1"
}
}
diff --git a/src/components/ApplicationViews.js b/src/components/ApplicationViews.js
index f89353c..f2a8b36 100644
--- a/src/components/ApplicationViews.js
+++ b/src/components/ApplicationViews.js
@@ -3,6 +3,7 @@ import { Route } from "react-router-dom"
import { GraphicsBayTrackerHome } from "./home/GraphicsBayTrackerHome"
import { Profile } from "./profile/Profile"
import { GPUDataInterface } from "./pricing/GPUDataInterface"
+import { HomepageBanner } from "./home/HomepageBanner"
@@ -19,6 +20,9 @@ export const ApplicationViews = () => {
+
+
+
>
)
diff --git a/src/components/GraphicsBayTracker.js b/src/components/GraphicsBayTracker.js
index 578180b..a35fec9 100644
--- a/src/components/GraphicsBayTracker.js
+++ b/src/components/GraphicsBayTracker.js
@@ -4,6 +4,7 @@ import { ApplicationViews } from "./ApplicationViews";
import { NavBar } from "./nav/NavBar";
import { Login } from "./auth/Login";
import { Register } from "./auth/Register";
+import { HomepageBanner } from "./home/HomepageBanner";
export const GraphicsBayTracker = () => {
return ( <>
@@ -13,6 +14,7 @@ export const GraphicsBayTracker = () => {
if (localStorage.getItem("graphicsbaytracker_customer")) {
return (
<>
+
>
diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js
index 6cdeb24..8e5e7b9 100644
--- a/src/components/home/GraphicsBayTrackerHome.js
+++ b/src/components/home/GraphicsBayTrackerHome.js
@@ -22,7 +22,7 @@ export const GraphicsBayTrackerHome = () => {
return ( <>
-
GraphicsBay Tracker
+
{NewsStories()}
diff --git a/src/components/nav/NavBar.js b/src/components/nav/NavBar.js
index c84527c..860fcbc 100644
--- a/src/components/nav/NavBar.js
+++ b/src/components/nav/NavBar.js
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react"
import { Link, useHistory } from "react-router-dom"
import { Login } from "../auth/Login"
+
import { Profile } from "../profile/Profile"
import { GPUDataInterface } from "../pricing/GPUDataInterface"
import { Props } from "react"
@@ -10,6 +11,7 @@ import "./NavBar.css"
export const NavBar = (props) => {
+ const history = useHistory()
@@ -24,10 +26,10 @@ export const NavBar = (props) => {
-
-
+
-
-
+
diff --git a/src/components/pricing/GPUDataInterface.js b/src/components/pricing/GPUDataInterface.js
index af8f2b4..11d5106 100644
--- a/src/components/pricing/GPUDataInterface.js
+++ b/src/components/pricing/GPUDataInterface.js
@@ -1,8 +1,13 @@
import { React } from "react"
-import { useState,useEffect } from "react"
+import { useState, useEffect, } from "react"
import { Link } from "react-router-dom"
export const GPUDataInterface = () => {
const [gpucarddata, fetchgpucarddata] = useState([])
+ const [addedtrackedcards, addtotrackedcards] = useState(0)
+ const [currentUser, setcurrentuser] = useState(parseInt(localStorage.getItem("graphicsbaytracker_customer")))
+
+
+ // const [selectedOEM, setselectedOEM]= useState("")
useEffect(
() => {
fetch("http://localhost:8088/cardData")
@@ -13,19 +18,98 @@ export const GPUDataInterface = () => {
},
[]
)
- return (
- <>
- GPUDataInterface
+
+
+ const selectOEM = (event) => {
+ if (event.target.value === "1") {
+ return (fetchgpucarddata(gpucarddata.filter((gpudataobj) => gpudataobj.oem === "AMD")))
+ } else if (event.target.value === "2") {
+ return (fetchgpucarddata(gpucarddata.filter((gpudataobj) => gpudataobj.oem === "NVIDIA")))
+ }
+ }
+
+
+ const saveTrackedCards = (gpudataobj) => {
-
+
+ const trackedCardOBJ = {
+ userId: currentUser,
+ cardDataId: gpudataobj.id
+ }
+ const postfetchfortrackedcards = {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(trackedCardOBJ),
+ }
+ return fetch("http://localhost:8088/trackedCards", postfetchfortrackedcards)
+ }
+
+
+ return(
+ <>
+ Graphics Card Prices
+ <>
+
+
+
+
+ >
+
| Brand |
Model |
Price |
- {gpucarddata.map(gpudataobj => {return ( {gpudataobj.brand} {gpudataobj.model} {gpudataobj.price.toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
)})}
-
-
+ < tr >
+
+
+ {
+ gpucarddata.map(
+ gpudataobj => {
+
+ return ( <>
+ {
+ gpudataobj.oem
+ } {
+ gpudataobj.brand
+ } {
+ gpudataobj.model
+ } {
+ gpudataobj.price.toLocaleString('en-US', {
+ style: 'currency',
+ currency: 'USD'
+ })
+ }
{
+
+ }
+ >
+ )
+
+ } )
+ }
+
+
+
- >
- )}
\ No newline at end of file
+ >
+ )
+}
+
+
+
+
+
+
+
diff --git a/src/components/pricing/OEMSelector.js b/src/components/pricing/OEMSelector.js
index e69de29..d6882b1 100644
--- a/src/components/pricing/OEMSelector.js
+++ b/src/components/pricing/OEMSelector.js
@@ -0,0 +1,2 @@
+import react from "react";
+import { useEffect,useState,useHistory } from "react";
diff --git a/src/components/profile/Profile.js b/src/components/profile/Profile.js
index e69de29..accffb9 100644
--- a/src/components/profile/Profile.js
+++ b/src/components/profile/Profile.js
@@ -0,0 +1,19 @@
+import react from "react";
+import { useState, useEffect } from "react";
+
+export const Profile = () => {
+ const [currentUser, changecurrentUser] = useState(localStorage.getItem("graphicsbaytracker_customer"))
+ const [currentUsertrackedcards, setcurrentUsertrackedcards] = useState(localStorage.getItem("graphicsbaytracker_customer"))
+
+ useEffect(
+ () => {
+ fetch("http://localhost:8088/trackedCards?_expand=cardDataId")
+ .then(res => res.json())
+ .then(setcurrentUsertrackedcards)
+ },[])
+
+ return(
+
+ My Tracked Cards
+ )
+}
\ No newline at end of file