From d10da2257d96c53867a66baea1e81b81d5873a1e Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Sat, 11 Dec 2021 13:56:37 -0600 Subject: [PATCH 1/3] saving progress with work done with Jon --- src/components/GraphicsBayTracker.js | 10 +++++----- src/components/auth/Login.js | 15 +++++++++++---- src/components/home/GraphicsBayTrackerHome.js | 6 +++--- src/components/nav/NavBar.js | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/components/GraphicsBayTracker.js b/src/components/GraphicsBayTracker.js index 33d63e6..efdfe76 100644 --- a/src/components/GraphicsBayTracker.js +++ b/src/components/GraphicsBayTracker.js @@ -9,7 +9,7 @@ export const GraphicsBayTracker = () => ( <> { - if (localStorage.getItem("graphicsbaytracker_customer")) { + if (localStorage.getItem("graphicsbaytracker_customer") === 1 ) { return ( <> @@ -17,10 +17,10 @@ export const GraphicsBayTracker = () => ( ); } else { - return ; - } - }} - /> + return( + ); + }}} + /> diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 4eb4724..d3cfc07 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js @@ -1,4 +1,4 @@ -import React, { useRef, useState } from "react" +import React, { useCallback, useRef, useState } from "react" import { Link } from "react-router-dom"; import { useHistory } from "react-router-dom" import "./Login.css" @@ -7,6 +7,10 @@ export const Login = () => { const [email, set] = useState("") const existDialog = useRef() const history = useHistory() + let [gbt_customer, setgbt_customer] = useState(1) + + + const existingUserCheck = () => { return fetch(`http://localhost:8088/users?email=${email}`) @@ -27,7 +31,10 @@ export const Login = () => { }) } + + return ( +
User does not exist
@@ -56,9 +63,9 @@ export const Login = () => {
Not a member yet?
-
- Skip Login -
+ + +
) } diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js index e2a5b05..5642a7a 100644 --- a/src/components/home/GraphicsBayTrackerHome.js +++ b/src/components/home/GraphicsBayTrackerHome.js @@ -1,10 +1,10 @@ import React from "react" -import { NavBar } from "../nav/NavBar" + export const GraphicsBayTrackerHome =()=>{ - const displayNavBar = NavBar() + return
- {displayNavBar} +
} \ No newline at end of file diff --git a/src/components/nav/NavBar.js b/src/components/nav/NavBar.js index e600cd3..4abddf0 100644 --- a/src/components/nav/NavBar.js +++ b/src/components/nav/NavBar.js @@ -29,7 +29,7 @@ export const NavBar = () => {
  • { - localStorage.graphicsbaytracker_customer >= 1 ? Logout : Login + localStorage.graphicsbaytracker_customer == true ? Logout : Login } From 6c23b98f908e55131e001ec42ac7c7fc5458ce1c Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Sun, 12 Dec 2021 16:29:38 -0600 Subject: [PATCH 2/3] completed issue with login user being set incorrectly --- src/components/auth/Login.js | 16 ++++++++++++---- src/components/home/GraphicsBayTrackerHome.js | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index d3cfc07..0801237 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js @@ -7,7 +7,7 @@ export const Login = () => { const [email, set] = useState("") const existDialog = useRef() const history = useHistory() - let [gbt_customer, setgbt_customer] = useState(1) + @@ -21,7 +21,7 @@ export const Login = () => { const handleLogin = (e) => { e.preventDefault() existingUserCheck() - .then(exists => { + .then (exists => { if (exists) { localStorage.setItem("graphicsbaytracker_customer", exists.id) history.push("") @@ -31,7 +31,15 @@ export const Login = () => { }) } +const skipLogin = () => { + const setLocalStorageUser = () => localStorage.setItem("graphicsbaytracker_customer", 1) + const skipToHome = () => history.replace('./GraphicsBayTrackerHome') + return (setLocalStorageUser(), skipToHome()) +} +const redirectToRegister = () => { + history.replace("./Register") +} return ( @@ -61,9 +69,9 @@ export const Login = () => {
    - Not a member yet? +
    - + diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js index 5642a7a..e918d93 100644 --- a/src/components/home/GraphicsBayTrackerHome.js +++ b/src/components/home/GraphicsBayTrackerHome.js @@ -5,6 +5,6 @@ export const GraphicsBayTrackerHome =()=>{ return
    - +

    GraphicsBayTrackerHome

    } \ No newline at end of file From 4ab2c15760343f34450b590093f125b5a3534027 Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Sun, 12 Dec 2021 18:20:44 -0600 Subject: [PATCH 3/3] fixed navbar display problem --- src/components/GraphicsBayTracker.js | 13 +++++++------ src/components/auth/Login.js | 2 +- src/components/home/GraphicsBayTrackerHome.js | 13 +++++++++---- src/components/home/NewsStories.js | 2 +- src/components/nav/NavBar.js | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/GraphicsBayTracker.js b/src/components/GraphicsBayTracker.js index efdfe76..578180b 100644 --- a/src/components/GraphicsBayTracker.js +++ b/src/components/GraphicsBayTracker.js @@ -5,11 +5,12 @@ import { NavBar } from "./nav/NavBar"; import { Login } from "./auth/Login"; import { Register } from "./auth/Register"; -export const GraphicsBayTracker = () => ( - <> - { + return ( <> + { - if (localStorage.getItem("graphicsbaytracker_customer") === 1 ) { + + if (localStorage.getItem("graphicsbaytracker_customer")) { return ( <> @@ -20,7 +21,7 @@ export const GraphicsBayTracker = () => ( return( ); }}} - /> + /> @@ -29,4 +30,4 @@ export const GraphicsBayTracker = () => ( -); +)}; diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 0801237..49538a0 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js @@ -69,7 +69,7 @@ const redirectToRegister = () => {
    - +
    diff --git a/src/components/home/GraphicsBayTrackerHome.js b/src/components/home/GraphicsBayTrackerHome.js index e918d93..9148378 100644 --- a/src/components/home/GraphicsBayTrackerHome.js +++ b/src/components/home/GraphicsBayTrackerHome.js @@ -1,10 +1,15 @@ import React from "react" +import { useState, useEffect } from "react" +import { NewsStories } from "./NewsStories" -export const GraphicsBayTrackerHome =()=>{ +export const GraphicsBayTrackerHome = () => { + const [ keyprices, setkeyprices] = useState({}) + return ( + <> - - return
    -

    GraphicsBayTrackerHome

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

    This is a news story

    } \ No newline at end of file diff --git a/src/components/nav/NavBar.js b/src/components/nav/NavBar.js index 4abddf0..3c1468c 100644 --- a/src/components/nav/NavBar.js +++ b/src/components/nav/NavBar.js @@ -29,7 +29,7 @@ export const NavBar = () => {
    • { - localStorage.graphicsbaytracker_customer == true ? Logout : Login + localStorage.graphicsbaytracker_customer !== 1 ? Logout : Login }