From 7157ae5d213a733936d3b62296588be518bb8efb Mon Sep 17 00:00:00 2001 From: Yojita Sharma Date: Sun, 3 Apr 2022 20:15:11 -0700 Subject: [PATCH 1/9] fixed user + admin navbars --- client/src/pages/MobileUserNavbar.js | 54 ++++++++++++++++++++++++++++ client/src/pages/UserNavbar.js | 17 +++++++++ 2 files changed, 71 insertions(+) create mode 100644 client/src/pages/MobileUserNavbar.js create mode 100644 client/src/pages/UserNavbar.js diff --git a/client/src/pages/MobileUserNavbar.js b/client/src/pages/MobileUserNavbar.js new file mode 100644 index 00000000..a4d8fed3 --- /dev/null +++ b/client/src/pages/MobileUserNavbar.js @@ -0,0 +1,54 @@ +import './MobNavbar.css'; +import bfpLogo from './../images/bfpLogo.svg'; +import xButton from './../images/isbees-x-symbol.svg'; +import groceries from './../images/navBarImage.png'; +import React, { useState } from 'react'; +import dropdownIcon from './../images/dropdown-icon.svg' +import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom"; + +function MobNavbar() { + const [dropdown, setDropdown] = useState(0); + function setTrue() { + setDropdown(true) + } + function setFalse() { + setDropdown(false) + } + if (dropdown) { + return ( +
+
+ + +
+
+ +
+ About the Pantry + View Today's Stock + Schedule Appointment + Login + {/* Edit Today's Stock + View Appointments + Logout */} +
+
+
+ ) + } + return ( +
+ + +
+ + ) + +} + +export default MobNavbar; \ No newline at end of file diff --git a/client/src/pages/UserNavbar.js b/client/src/pages/UserNavbar.js new file mode 100644 index 00000000..0f053b29 --- /dev/null +++ b/client/src/pages/UserNavbar.js @@ -0,0 +1,17 @@ +import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom"; +import './Navbar.css'; +import berkeleyfoodpantrylogo from './../images/berkeley-food-pantry-logo.png'; + +export default function AdminLoginNavbar() { + return( +
+ navbar logo + +
+ ) +} From c43a943a66001ef0d85e4c6dd60024c85bdfcc13 Mon Sep 17 00:00:00 2001 From: Yojita Sharma Date: Thu, 7 Apr 2022 13:53:18 -0700 Subject: [PATCH 2/9] working on refactoring addFood component --- client/src/pages/AddFood.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/pages/AddFood.js b/client/src/pages/AddFood.js index 1af02898..e58a2870 100644 --- a/client/src/pages/AddFood.js +++ b/client/src/pages/AddFood.js @@ -5,6 +5,8 @@ import makeAnimated from 'react-select/animated'; import React, { useState } from 'react'; import UploadImageButton from './../components/UploadImageButton.js'; + + const todayStock = [ { value: 'in stock', label: 'In stock today' }, { value: 'out of stock', label: 'Out of stock today' } @@ -62,6 +64,16 @@ const customStyles = { } export default function AddFood() { + + const [edit, setEdit] = useState(true); + + function editDisplay() {} + if (edit) { + + } + + } + return(
From ca58ff3900206db33571791a8044cda05b365f82 Mon Sep 17 00:00:00 2001 From: Yojita Sharma Date: Thu, 7 Apr 2022 21:23:27 -0700 Subject: [PATCH 3/9] need to fix wrapping the tags --- client/src/App.js | 2 +- client/src/components/Food.js | 8 +++-- client/src/pages/AddFood.css | 6 ++++ client/src/pages/AddFood.js | 62 +++++++++++++++++++++++++++-------- 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index 725eeab8..ed2e90b8 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -24,7 +24,7 @@ function App() { }/> - }/> + } /> diff --git a/client/src/components/Food.js b/client/src/components/Food.js index d2897442..8c6aa699 100644 --- a/client/src/components/Food.js +++ b/client/src/components/Food.js @@ -3,6 +3,8 @@ import './Food.css' import Tags from './Tags.js' import edit_item from './../images/edit_item.png' import pen from './../images/pen.svg' +import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom"; + function Food(props) { function editItem () { @@ -25,13 +27,15 @@ function Food(props) {
+ {/* Submit */}
- +
In Stock diff --git a/client/src/pages/AddFood.css b/client/src/pages/AddFood.css index 9134f2e5..ed9c5949 100644 --- a/client/src/pages/AddFood.css +++ b/client/src/pages/AddFood.css @@ -210,6 +210,12 @@ label, input { } +.custom-dropdown { + display: flex; + flex-direction: column; + overflow-x: auto; +} + @media screen and (orientation: portrait) { .add-food-component-container { flex-direction: column; diff --git a/client/src/pages/AddFood.js b/client/src/pages/AddFood.js index e58a2870..9d1afd3f 100644 --- a/client/src/pages/AddFood.js +++ b/client/src/pages/AddFood.js @@ -2,10 +2,10 @@ import './AddFood.css'; import saveitembutton from './../images/saveitembutton.png'; import Select, { NonceProvider } from 'react-select'; import makeAnimated from 'react-select/animated'; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import UploadImageButton from './../components/UploadImageButton.js'; - - +import { useLocation } from "react-router-dom"; +import Tags from '../components/Tags.js' const todayStock = [ { value: 'in stock', label: 'In stock today' }, @@ -65,22 +65,52 @@ const customStyles = { export default function AddFood() { + const location = useLocation(); const [edit, setEdit] = useState(true); + const [itemName, setItemName] = useState(""); + // const [stockAvailability, setStockAvailability] = useState(""); + const [tags, setTags] = useState([]); - function editDisplay() {} - if (edit) { + useEffect(() => { + setItemName(location.state.name); + setTags(location.state.tags); - } + // setStockAvailability(location.state.name); + console.log(tags); + //console.log(stockAvailability); + }); + + function headerDisplay() { + if (edit) { + return ( +
+

Edit Item

+

Edit an existing item in the stock directory.

+
+ ) + } + return ( +
+

Add Item

+

Add a new item to the stock directory.

+
+ ) + } - } + // const colourStyles = { + // placeholder: (defaultStyles) => { + // return { + // ...defaultStyles, + // display: flex, + // flexDirection: row, + // } + // } + // } return(
-
-

Add Item

-

Add a new item to the stock directory.

-
+ {headerDisplay()}
@@ -89,7 +119,7 @@ export default function AddFood() { - +
@@ -102,7 +132,7 @@ export default function AddFood() { styles={customStyles} closeMenuOnSelect={true} components={animatedComponents} - placeholder="Select..." + defaultValue="select..." options={todayStock} />
@@ -112,9 +142,13 @@ export default function AddFood() {
{ From 210e72b6c2cc9ea090a0502b5268786f81c6fa4c Mon Sep 17 00:00:00 2001 From: Yojita Sharma Date: Thu, 14 Apr 2022 15:17:05 -0700 Subject: [PATCH 5/9] fix scrolling issue --- client/src/components/Food.js | 2 +- client/src/pages/AddFood.css | 11 ++++++++--- client/src/pages/AddFood.js | 26 ++++++++++---------------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/client/src/components/Food.js b/client/src/components/Food.js index 8c6aa699..f1d0f2e8 100644 --- a/client/src/components/Food.js +++ b/client/src/components/Food.js @@ -30,7 +30,7 @@ function Food(props) { {/* Submit */}
{/* @@ -155,22 +171,22 @@ export function StockListingAdmin() {
Show
-
-
-
@@ -179,7 +195,7 @@ export function StockListingAdmin() {
- + @@ -253,8 +269,8 @@ export function StockListingUser() {
-