diff --git a/client/src/App.tsx b/client/src/App.tsx index 94e49b8..50e1a66 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -12,6 +12,7 @@ import ProductPage from './components/Products/ProductPage'; import Cart from './components/Cart/Cart'; import './App.scss' +import AdminHome from './components/AdminPortal/AdminHome'; function App() { const [state, dispatch] = useReducer(reducer, initialState); @@ -29,6 +30,8 @@ function App() { } /> } /> } /> + + } /> diff --git a/client/src/components/AdminPortal/AdminHome.tsx b/client/src/components/AdminPortal/AdminHome.tsx new file mode 100644 index 0000000..eee0a27 --- /dev/null +++ b/client/src/components/AdminPortal/AdminHome.tsx @@ -0,0 +1,33 @@ +import { useContext } from "react"; +import { AppContext } from "../../store/store"; +import Page from "../../util/Page"; + +export default function AdminHome() { + const [state, dispatch] = useContext(AppContext); + + // to do: provide protected access based on a list of approved admin users + if (state.user.name) return ( + + Admin Management Portal + Welcome, {state.user.name || ''} + + + This is where administrative tasks will be supported for the store. + Choose from the options below: + + + Access product listings and inventory + Manage registered users + Database options + + + + ) + + return ( + + Administrative access required to view this page. + Please click here to return home. + + ) +} \ No newline at end of file diff --git a/client/src/main.tsx b/client/src/main.tsx index c2f5663..ef0538a 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -1,10 +1,5 @@ -import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' import './index.scss' -ReactDOM.createRoot(document.getElementById('root')!).render( - - - -) +ReactDOM.createRoot(document.getElementById('root')!).render(); diff --git a/db/Seed.js b/db/Seed.js index 06d3782..c45f58d 100644 --- a/db/Seed.js +++ b/db/Seed.js @@ -37,7 +37,8 @@ require('dotenv').config({ path: "../.env" }); CREATE TABLE IF NOT EXISTS category ( id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY NOT NULL, name VARCHAR NOT NULL, - description VARCHAR NOT NULL + description VARCHAR NOT NULL, + is_product_subset BOOLEAN NOT NULL ); `; @@ -63,6 +64,8 @@ require('dotenv').config({ path: "../.env" }); let status; try { + await client.query("DROP SCHEMA public CASCADE; CREATE SCHEMA public;"); + for (let q of allQueries) { await client.query(q); } diff --git a/package.json b/package.json index a03db0b..4dc2994 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "nodemon server.js", - "seed": "cd db && node Seed.js" + "seed": "cd db && node seed.js" }, "engines": { "node": "v16.13.1"
Choose from the options below:
Please click here to return home.