From a33ccddeb2ad49610e55083ded81877509fc30d6 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Sun, 12 Dec 2021 19:11:55 -0600 Subject: [PATCH 1/3] GBT home is now displaying as the default page --- src/components/ApplicationViews.js | 5 +++++ src/components/home/GraphicsBayTrackerHome.js | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/ApplicationViews.js b/src/components/ApplicationViews.js index 32486ed..12bfc58 100644 --- a/src/components/ApplicationViews.js +++ b/src/components/ApplicationViews.js @@ -7,6 +7,11 @@ import { Profile } from "./profile/Profile" export const ApplicationViews = () => { return ( <> + + + + + diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js index 9148378..ad4e68d 100644 --- a/src/components/home/GraphicsBayTrackerHome.js +++ b/src/components/home/GraphicsBayTrackerHome.js @@ -1,15 +1,16 @@ import React from "react" +import { Route } from "react-router-dom/cjs/react-router-dom.min" import { useState, useEffect } from "react" import { NewsStories } from "./NewsStories" export const GraphicsBayTrackerHome = () => { - const [ keyprices, setkeyprices] = useState({}) + // const [ keyprices, setkeyprices] = useState({}) return ( - <> - -
- -
- ) + <> + {/* */} +

Display

+ + + ) } \ No newline at end of file -- 2.47.3 From 80033a15dd9d995b7b37da17a88bb51965ca6e02 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Mon, 13 Dec 2021 21:18:24 -0600 Subject: [PATCH 2/3] Homepage content completeexcept for logout button and CSS --- src/components/ApplicationViews.js | 4 ++ src/components/auth/Logout.js | 8 ++- src/components/home/GraphicsBayTrackerHome.js | 56 ++++++++++++++++--- src/components/home/NewsStories.js | 34 ++++++++++- src/components/nav/NavBar.js | 19 ++----- src/components/pricing/GPUDataInterface.js | 25 +++++++++ 6 files changed, 120 insertions(+), 26 deletions(-) diff --git a/src/components/ApplicationViews.js b/src/components/ApplicationViews.js index 12bfc58..b8ebf48 100644 --- a/src/components/ApplicationViews.js +++ b/src/components/ApplicationViews.js @@ -2,6 +2,7 @@ import React from "react" import { Route } from "react-router-dom" import { GraphicsBayTrackerHome } from "./home/GraphicsBayTrackerHome" import { Profile } from "./profile/Profile" +import { GPUDataInterface } from "./pricing/GPUDataInterface" export const ApplicationViews = () => { @@ -18,6 +19,9 @@ export const ApplicationViews = () => { + + + ) } diff --git a/src/components/auth/Logout.js b/src/components/auth/Logout.js index 1a3f6dd..3738f08 100644 --- a/src/components/auth/Logout.js +++ b/src/components/auth/Logout.js @@ -3,11 +3,15 @@ import {useState, useEffect} from "react" import { useHistory } from "react-router-dom" export const Logout = () => { - const [loggedincustomer, setloggedincustomer] = useState(localStorage.graphicsbaytracker_customer) + const [loggedincustomer, setloggedincustomer] = useState(localStorage.getItem("graphicsbaytracker_customer")) + + const setItemFromLocalStorage = () => { + setloggedincustomer() + } return ( <>
- +
) diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js index ad4e68d..70358ae 100644 --- a/src/components/home/GraphicsBayTrackerHome.js +++ b/src/components/home/GraphicsBayTrackerHome.js @@ -1,16 +1,54 @@ import React from "react" -import { Route } from "react-router-dom/cjs/react-router-dom.min" -import { useState, useEffect } from "react" -import { NewsStories } from "./NewsStories" +import { Link } from "react-router-dom" +import { + Route +} from "react-router-dom/cjs/react-router-dom.min" +import { + useState, + useEffect +} from "react" +import { + NewsStories +} from "./NewsStories" export const GraphicsBayTrackerHome = () => { - // const [ keyprices, setkeyprices] = useState({}) - return ( - <> - {/* */} -

Display

+ const [keyprices, fetchkeyprices] = useState([]) + + useEffect( + () => { + fetch("http://localhost:8088/cardData") + .then(res => res.json()) + .then(fetchkeyprices) + },[]) + + + + return ( <> + +

GraphicsBay Tracker

+ + {NewsStories()} +
+ + - ) } \ No newline at end of file diff --git a/src/components/home/NewsStories.js b/src/components/home/NewsStories.js index 18ee440..b94a3f1 100644 --- a/src/components/home/NewsStories.js +++ b/src/components/home/NewsStories.js @@ -1,4 +1,34 @@ - +import { + useEffect, + useState +} from "react" export const NewsStories = () => { - return

This is a news story

+ const [newsstories, setNewsStories] = useState([]) + + + + useEffect( + () => { + fetch("http://localhost:8088/newsstories") + .then(res => res.json()) + .then((data) => { + setNewsStories(data) + }) + }, + [] + ) + + + return ( <> +
{newsstories.map( + (newsOBJ) => { + return

{newsOBJ.storyText}

+ {newsOBJ.link} +
+ } + )} +
+ + + ) } \ No newline at end of file diff --git a/src/components/nav/NavBar.js b/src/components/nav/NavBar.js index 3c1468c..59a636d 100644 --- a/src/components/nav/NavBar.js +++ b/src/components/nav/NavBar.js @@ -2,44 +2,37 @@ import React, { useEffect, useState } from "react" import { Link, useHistory } from "react-router-dom" import { Login } from "../auth/Login" import { Logout } from "../auth/Logout" +import { Profile } from "../profile/Profile" +import { GPUDataInterface } from "../pricing/GPUDataInterface" import "./NavBar.css" export const NavBar = () => { - const history = useHistory() return (
diff --git a/src/components/pricing/GPUDataInterface.js b/src/components/pricing/GPUDataInterface.js index e69de29..d87dca5 100644 --- a/src/components/pricing/GPUDataInterface.js +++ b/src/components/pricing/GPUDataInterface.js @@ -0,0 +1,25 @@ +import { React } from "react" +import { useState,useEffect } from "react" +import { Link } from "react-router-dom" +export const GPUDataInterface = () => { + const [gpucarddata, fetchgpucarddata] = useState([]) + useEffect( + () => { + fetch("http://localhost:8088/cardData") + .then(res => res.json()) + .then((data) => { + fetchgpucarddata(data) + }) + }, + [] + ) + return ( + <> +

GPUDataInterface

+
+ + +
+
+ + )} \ No newline at end of file -- 2.47.3 From 2ea3c951cd51441b4e5c478b5b4c53cd68c35472 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Wed, 15 Dec 2021 11:22:30 -0600 Subject: [PATCH 3/3] Completed Home page, some progress done on main priciingview --- src/components/ApplicationViews.js | 10 +++--- src/components/auth/Login.js | 10 ++---- src/components/auth/Logout.js | 29 ++++++++------- src/components/home/GraphicsBayTrackerHome.js | 22 +++++------- src/components/nav/NavBar.js | 36 +++++++++++-------- src/components/pricing/GPUDataInterface.js | 12 +++++-- 6 files changed, 63 insertions(+), 56 deletions(-) diff --git a/src/components/ApplicationViews.js b/src/components/ApplicationViews.js index b8ebf48..f89353c 100644 --- a/src/components/ApplicationViews.js +++ b/src/components/ApplicationViews.js @@ -5,6 +5,7 @@ import { Profile } from "./profile/Profile" import { GPUDataInterface } from "./pricing/GPUDataInterface" + export const ApplicationViews = () => { return ( <> @@ -12,16 +13,13 @@ export const ApplicationViews = () => { - - - - - + - + + ) } diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 49538a0..d584ebf 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js @@ -42,7 +42,7 @@ const redirectToRegister = () => { } return ( - + <>
User does not exist
@@ -68,13 +68,9 @@ const redirectToRegister = () => { -
-
- - - -
+ + ) } diff --git a/src/components/auth/Logout.js b/src/components/auth/Logout.js index 3738f08..d3229c4 100644 --- a/src/components/auth/Logout.js +++ b/src/components/auth/Logout.js @@ -1,20 +1,25 @@ import React from "react" import {useState, useEffect} from "react" import { useHistory } from "react-router-dom" +import { props } from "react" -export const Logout = () => { - const [loggedincustomer, setloggedincustomer] = useState(localStorage.getItem("graphicsbaytracker_customer")) +export const Logout = (props) => { + const [loggedIn, setLoggedIn] = useState(true) - const setItemFromLocalStorage = () => { - setloggedincustomer() - } - return ( - <> -
- -
- - ) + + + useEffect(() => { + if (localStorage.getItem("graphicsbaytracker_customer") !== "1") { + setLoggedIn(true) + } + }, []); + + const logOutCustomer = () => { + localStorage.removeItem("graphicsbaytracker_customer"); + setLoggedIn(false) + + } + } \ No newline at end of file diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js index 70358ae..6cdeb24 100644 --- a/src/components/home/GraphicsBayTrackerHome.js +++ b/src/components/home/GraphicsBayTrackerHome.js @@ -1,19 +1,15 @@ import React from "react" import { Link } from "react-router-dom" -import { - Route -} from "react-router-dom/cjs/react-router-dom.min" -import { - useState, - useEffect -} from "react" -import { - NewsStories -} from "./NewsStories" +import {Route} from "react-router-dom/cjs/react-router-dom.min" +import {useState,useEffect } from "react" +import {NewsStories} from "./NewsStories" +import { GPUDataInterface } from "../pricing/GPUDataInterface" +import { useHistory } from "react-router-dom/cjs/react-router-dom.min" export const GraphicsBayTrackerHome = () => { const [keyprices, fetchkeyprices] = useState([]) + const history = useHistory() useEffect( () => { @@ -26,8 +22,8 @@ export const GraphicsBayTrackerHome = () => { return ( <> -

GraphicsBay Tracker

- +

GraphicsBay Tracker

+ {NewsStories()}
+ ) } diff --git a/src/components/pricing/GPUDataInterface.js b/src/components/pricing/GPUDataInterface.js index d87dca5..af8f2b4 100644 --- a/src/components/pricing/GPUDataInterface.js +++ b/src/components/pricing/GPUDataInterface.js @@ -16,10 +16,16 @@ export const GPUDataInterface = () => { return ( <>

GPUDataInterface

-
+ - + + + + + + {gpucarddata.map(gpudataobj => {return (

{gpudataobj.brand} {gpudataobj.model} {gpudataobj.price.toLocaleString('en-US', { style: 'currency', currency: 'USD' })}

)})} +
BrandModelPrice
-
+ )} \ No newline at end of file -- 2.47.3