Commit 5d30b80a authored by Julius Wu's avatar Julius Wu

fix merge conflict

parents 71d6d576 290c7a9b
......@@ -23,3 +23,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
This diff is collapsed.
......@@ -9,6 +9,8 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-google-login": "^5.2.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
......
......@@ -2,6 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0"
crossorigin="anonymous"
/>
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
......
import './App.css';
import Login from './component/session/Login'
import Logout from './component/session/Logout'
import "./App.css";
import Header from "./component/Header";
import Main from "./component/Main";
import AuthRoute from "./component/AuthRoute";
import { Switch } from "react-router";
import Login from "./component/Login";
function App() {
return (
<div className="App">
<Login/>
<Logout/>
<div>
<Switch>
<AuthRoute path="/login">
<Login />
</AuthRoute>
<AuthRoute>
<Header />
<Main />
</AuthRoute>
</Switch>
</div>
);
}
......
import React from "react";
import { Redirect, Route } from "react-router";
export default function AuthRoute({ children, ...rest }) {
// TODO: replace with actual Auth data from redux later
const auth = true;
return (
<Route
{...rest}
render={({ location }) => {
console.log(location);
if (auth) {
if (location.pathname === "/login") {
return <Redirect to="/" />;
} else {
return children;
}
} else if (location.pathname !== "/login") {
return <Redirect to="/login" />;
}
return children;
}}
/>
);
}
import React, { useState } from "react";
import { Link } from "react-router-dom";
const Header = () => {
const [show, setShow] = useState(false);
return (
<nav className="navbar navbar-expand-lg navbar-dark bg-dark">
<div className="container-fluid">
<Link className="navbar-brand" to="/">
Ascend Inventory
</Link>
<button
className="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
onClick={() => setShow((prev) => !prev)}
>
<span className="navbar-toggler-icon"></span>
</button>
<div
className={`collapse navbar-collapse ${show ? "show" : ""}`}
id="navbarSupportedContent"
>
<ul className="navbar-nav me-auto mb-2 mb-lg-0">
<li className="nav-item">
<Link className="nav-link" to="/products">
Products
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/promos">
Promotions
</Link>
</li>
</ul>
<form className="d-flex">
<input
type="search"
className="form-control me-2"
placeholder="search"
/>
<button className="btn btn-light" type="submit">
GO
</button>
</form>
</div>
</div>
</nav>
);
};
export default Header;
import React from 'react'
export default function Login() {
return (
<div>
LOGIN
</div>
)
}
import React from "react";
import { Redirect, Switch } from "react-router";
import AuthRoute from "./AuthRoute";
import ProductForm from "./ProductForm";
export default function Main() {
return (
<div>
<Switch>
<AuthRoute exact path="/products/new">
<ProductForm />
</AuthRoute>
<AuthRoute exact path="/promos/new">NEW PROMO</AuthRoute>
<AuthRoute exact path="/products">PRODUCTS</AuthRoute>
<AuthRoute path="/promos">PROMOS</AuthRoute>
<AuthRoute exact path="/">
<Redirect to="/products" />
</AuthRoute>
<AuthRoute >404 PAGE</AuthRoute>
</Switch>
</div>
);
}
import React from 'react'
export default function ProductForm({ product }) {
return (
<div>
PRODUCT FORM
</div>
)
}
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter } from "react-router-dom";
ReactDOM.render(
<React.StrictMode>
<App />
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
document.getElementById("root")
);
// If you want to start measuring performance in your app, pass a function
......
......@@ -1063,7 +1063,7 @@
"core-js-pure" "^3.0.0"
"regenerator-runtime" "^0.13.4"
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
"integrity" "sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA=="
"resolved" "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.0.tgz"
"version" "7.14.0"
......@@ -5478,6 +5478,18 @@
"resolved" "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz"
"version" "1.1.0"
"history@^4.9.0":
"integrity" "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew=="
"resolved" "https://registry.npmjs.org/history/-/history-4.10.1.tgz"
"version" "4.10.1"
dependencies:
"@babel/runtime" "^7.1.2"
"loose-envify" "^1.2.0"
"resolve-pathname" "^3.0.0"
"tiny-invariant" "^1.0.2"
"tiny-warning" "^1.0.0"
"value-equal" "^1.0.1"
"hmac-drbg@^1.0.1":
"integrity" "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE="
"resolved" "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz"
......@@ -5487,6 +5499,13 @@
"minimalistic-assert" "^1.0.0"
"minimalistic-crypto-utils" "^1.0.1"
"hoist-non-react-statics@^3.1.0":
"integrity" "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw=="
"resolved" "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz"
"version" "3.3.2"
dependencies:
"react-is" "^16.7.0"
"hoopy@^0.1.4":
"integrity" "sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ=="
"resolved" "https://registry.npmjs.org/hoopy/-/hoopy-0.1.4.tgz"
......@@ -6156,6 +6175,11 @@
"resolved" "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
"version" "1.0.0"
"isarray@0.0.1":
"integrity" "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
"resolved" "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
"version" "0.0.1"
"isexe@^2.0.0":
"integrity" "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
"resolved" "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"
......@@ -7022,7 +7046,7 @@
"resolved" "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz"
"version" "1.7.1"
"loose-envify@^1.1.0", "loose-envify@^1.4.0":
"loose-envify@^1.1.0", "loose-envify@^1.2.0", "loose-envify@^1.3.1", "loose-envify@^1.4.0":
"integrity" "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="
"resolved" "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz"
"version" "1.4.0"
......@@ -7235,6 +7259,14 @@
"resolved" "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz"
"version" "1.0.1"
"mini-create-react-context@^0.4.0":
"integrity" "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ=="
"resolved" "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz"
"version" "0.4.1"
dependencies:
"@babel/runtime" "^7.12.1"
"tiny-warning" "^1.0.3"
"mini-css-extract-plugin@0.11.3":
"integrity" "sha512-n9BA8LonkOkW1/zn+IbLPQmovsL0wMb9yx75fMJQZf2X1Zoec9yTZtyMePcyu19wPkmFbzZZA6fLTotpFhQsOA=="
"resolved" "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz"
......@@ -7989,6 +8021,13 @@
"resolved" "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz"
"version" "1.0.6"
"path-to-regexp@^1.7.0":
"integrity" "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA=="
"resolved" "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz"
"version" "1.8.0"
dependencies:
"isarray" "0.0.1"
"path-to-regexp@0.1.7":
"integrity" "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
"resolved" "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz"
......@@ -8865,7 +8904,7 @@
"kleur" "^3.0.3"
"sisteransi" "^1.0.5"
"prop-types@^15.6.0", "prop-types@^15.7.2":
"prop-types@^15.0.0", "prop-types@^15.6.0", "prop-types@^15.6.2", "prop-types@^15.7.2":
"integrity" "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ=="
"resolved" "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz"
"version" "15.7.2"
......@@ -9093,6 +9132,16 @@
"@types/react" "*"
"prop-types" "^15.6.0"
"react-is@^16.6.0":
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
"version" "16.13.1"
"react-is@^16.7.0":
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
"version" "16.13.1"
"react-is@^16.8.1":
"integrity" "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
"resolved" "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
......@@ -9108,6 +9157,35 @@
"resolved" "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"
"version" "0.8.3"
"react-router-dom@^5.2.0":
"integrity" "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA=="
"resolved" "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz"
"version" "5.2.0"
dependencies:
"@babel/runtime" "^7.1.2"
"history" "^4.9.0"
"loose-envify" "^1.3.1"
"prop-types" "^15.6.2"
"react-router" "5.2.0"
"tiny-invariant" "^1.0.2"
"tiny-warning" "^1.0.0"
"react-router@^5.2.0", "react-router@5.2.0":
"integrity" "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw=="
"resolved" "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz"
"version" "5.2.0"
dependencies:
"@babel/runtime" "^7.1.2"
"history" "^4.9.0"
"hoist-non-react-statics" "^3.1.0"
"loose-envify" "^1.3.1"
"mini-create-react-context" "^0.4.0"
"path-to-regexp" "^1.7.0"
"prop-types" "^15.6.2"
"react-is" "^16.6.0"
"tiny-invariant" "^1.0.2"
"tiny-warning" "^1.0.0"
"react-scripts@4.0.3":
"integrity" "sha512-S5eO4vjUzUisvkIPB7jVsKtuH2HhWcASREYWHAQ1FP5HyCv3xgn+wpILAEWkmy+A+tTNbSZClhxjT3qz6g4L1A=="
"resolved" "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz"
......@@ -9174,7 +9252,7 @@
optionalDependencies:
"fsevents" "^2.1.3"
"react@*", "react@^16 || ^17", "react@^17.0.2", "react@>= 16", "react@17.0.2":
"react@*", "react@^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0", "react@^16 || ^17", "react@^17.0.2", "react@>= 16", "react@>=15", "react@17.0.2":
"integrity" "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA=="
"resolved" "https://registry.npmjs.org/react/-/react-17.0.2.tgz"
"version" "17.0.2"
......@@ -9576,6 +9654,11 @@
"resolved" "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz"
"version" "5.0.0"
"resolve-pathname@^3.0.0":
"integrity" "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
"resolved" "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz"
"version" "3.0.0"
"resolve-url-loader@^3.1.2":
"integrity" "sha512-QEb4A76c8Mi7I3xNKXlRKQSlLBwjUV/ULFMP+G7n3/7tJZ8MG5wsZ3ucxP1Jz8Vevn6fnJsxDx9cIls+utGzPQ=="
"resolved" "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-3.1.2.tgz"
......@@ -10735,6 +10818,16 @@
"resolved" "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz"
"version" "0.3.0"
"tiny-invariant@^1.0.2":
"integrity" "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
"resolved" "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz"
"version" "1.1.0"
"tiny-warning@^1.0.0", "tiny-warning@^1.0.3":
"integrity" "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
"resolved" "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz"
"version" "1.0.3"
"tmpl@1.0.x":
"integrity" "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE="
"resolved" "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz"
......@@ -11165,6 +11258,11 @@
"spdx-correct" "^3.0.0"
"spdx-expression-parse" "^3.0.0"
"value-equal@^1.0.1":
"integrity" "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
"resolved" "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz"
"version" "1.0.1"
"vary@~1.1.2":
"integrity" "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
"resolved" "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment