}
\ No newline at end of file
diff --git a/src/components/EditButton.jsx b/src/components/EditButton.jsx
index 950032a..534178f 100644
--- a/src/components/EditButton.jsx
+++ b/src/components/EditButton.jsx
@@ -1,7 +1,6 @@
import styles from '../css/Buttons.module.css';
-export default function EditButton(props){
- return (
-
-
- )
+export default function EditButton({...props}){
+ return
+
+
}
\ No newline at end of file
diff --git a/src/components/ItemHeader.jsx b/src/components/ItemHeader.jsx
index e3f68b8..2abd622 100644
--- a/src/components/ItemHeader.jsx
+++ b/src/components/ItemHeader.jsx
@@ -1,12 +1,9 @@
import styles from '../css/ItemHeader.module.css';
-export default function ItemHeader(props){
- return(
-
-
{props.title}
-
-
-
-
-
- )
+export default function ItemHeader({ name, image, alt }){
+ return
+
+
{name}
+
+
+
}
\ No newline at end of file
diff --git a/src/components/ItemHeaderEditable.jsx b/src/components/ItemHeaderEditable.jsx
index c41474f..0984bc9 100644
--- a/src/components/ItemHeaderEditable.jsx
+++ b/src/components/ItemHeaderEditable.jsx
@@ -1,17 +1,11 @@
import styles from '../css/ItemHeader.module.css';
-export default function ItemHeaderEditable(props){
- return(
- )
-
- }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/components/ListItem.jsx b/src/components/ListItem.jsx
index 2fc57cf..0aaf7d7 100644
--- a/src/components/ListItem.jsx
+++ b/src/components/ListItem.jsx
@@ -6,14 +6,14 @@ import styles from '../css/ListItem.module.css'
export default function ListItem({name, description, image, viewLink, editLink}) {
const navigate = useNavigate()
return (
- navigate(viewLink)}>
+
{image ?
-
+
navigate(viewLink)}>
: <>>}
-
{name}
-
{description}
+
navigate(viewLink)}>{name}
+
navigate(viewLink)}>{description}
Edit
diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx
index 435483b..659f84e 100644
--- a/src/components/NavBar.jsx
+++ b/src/components/NavBar.jsx
@@ -1,20 +1,19 @@
import Nav from 'react-bootstrap/Nav';
import Navbar from 'react-bootstrap/Navbar';
import { Link } from 'react-router-dom';
-import 'bootstrap/dist/css/bootstrap.min.css';
import styles from "../css/NavBar.module.css"
function NavBar() {
return (
-
-
-
+
+
+ Food
+ Recipe
+ Queue
+ My Account
+
+
);
}
diff --git a/src/components/NavBarOld2.jsx b/src/components/NavBarOld2.jsx
new file mode 100644
index 0000000..435483b
--- /dev/null
+++ b/src/components/NavBarOld2.jsx
@@ -0,0 +1,22 @@
+import Nav from 'react-bootstrap/Nav';
+import Navbar from 'react-bootstrap/Navbar';
+import { Link } from 'react-router-dom';
+import 'bootstrap/dist/css/bootstrap.min.css';
+import styles from "../css/NavBar.module.css"
+
+function NavBar() {
+ return (
+
+
+
+
+
+ );
+}
+
+export default NavBar;
\ No newline at end of file
diff --git a/src/components/QueueItem.jsx b/src/components/QueueItem.jsx
index 19a39d4..4529f0e 100644
--- a/src/components/QueueItem.jsx
+++ b/src/components/QueueItem.jsx
@@ -1,7 +1,5 @@
export default function Queue(props){
- return(
+ return
-
-
- )
+
}
\ No newline at end of file
diff --git a/src/components/RemoveButton.jsx b/src/components/RemoveButton.jsx
index 4e548aa..76fde36 100644
--- a/src/components/RemoveButton.jsx
+++ b/src/components/RemoveButton.jsx
@@ -1,8 +1,6 @@
import styles from '../css/Buttons.module.css';
export default function RemoveButton(props){
- return(
-
+ return
-
- )
+
}
\ No newline at end of file
diff --git a/src/components/SaveButton.jsx b/src/components/SaveButton.jsx
index c49fac6..eb07025 100644
--- a/src/components/SaveButton.jsx
+++ b/src/components/SaveButton.jsx
@@ -1,7 +1,6 @@
import styles from '../css/Buttons.module.css';
-export default function SaveButton(props) {
- return (
-
-
- )
+export default function SaveButton({...props}) {
+ return
+
+
}
\ No newline at end of file
diff --git a/src/components/SearchButton.jsx b/src/components/SearchButton.jsx
index 9c0c9a3..d67ae8b 100644
--- a/src/components/SearchButton.jsx
+++ b/src/components/SearchButton.jsx
@@ -1,7 +1,5 @@
export default function SearchButton(props){
- return(
+ return
-
-
- )
+
}
\ No newline at end of file
diff --git a/src/css/Login.module.css b/src/css/Login.module.css
new file mode 100644
index 0000000..6cb9d5f
--- /dev/null
+++ b/src/css/Login.module.css
@@ -0,0 +1,13 @@
+.button {
+ padding: 0.5em;
+ margin: 0.5em;
+ margin-left: auto;
+ margin-right: auto;
+ border: none;
+ border-radius: 5px ;
+ width: 8em;
+}
+
+.google {
+
+}
\ No newline at end of file
diff --git a/src/css/Search.module.css b/src/css/Search.module.css
new file mode 100644
index 0000000..d56d994
--- /dev/null
+++ b/src/css/Search.module.css
@@ -0,0 +1,14 @@
+.searchicon{
+ height: 2em;
+ width: 2em;
+
+}
+.searchIconContainer{
+ border:none;
+ background-color: #00000000;
+}
+.container{
+ border: 1px solid #000000;
+ border-radius: 5px;
+ width:14.5em;
+}
diff --git a/src/index.js b/src/index.js
index 80d3058..67c3510 100644
--- a/src/index.js
+++ b/src/index.js
@@ -7,7 +7,6 @@ import {
redirect
} from "react-router-dom";
import Login, { authLoader as loginAuthLoader } from './pages/Login'
-import loginRedirectLoader from './pages/LoginRedirectLoader'
import Landing from './pages/Landing'
import Foods from './pages/food/Foods'
import Food from './pages/food/Food'
@@ -29,6 +28,13 @@ async function authLoader() {
return redirect('/login')
}
+async function loginRedirectLoader() {
+ // check user first time login
+ const res = await fetch('/api/login', { method: "GET" })
+ console.log("Logging in: ", res)
+ return redirect('/')
+}
+
const router = createBrowserRouter([
{
path: "/",
diff --git a/src/pages/Login.js b/src/pages/Login.js
index bc1be1a..404af58 100644
--- a/src/pages/Login.js
+++ b/src/pages/Login.js
@@ -1,4 +1,6 @@
import { redirect } from 'react-router-dom'
+import Stack from 'react-bootstrap/Stack'
+import styles from '../css/Login.module.css';
export async function authLoader() {
const res = await fetch("/.auth/me")
@@ -13,12 +15,19 @@ export async function authLoader() {
const loginBaseUrl = '/.auth/login/'
const redirectParam = '?post_login_redirect_uri=/login/redirect'
+function loginOnClick(url) {
+ return () => window.location.href = loginBaseUrl+url+redirectParam
+}
+
export default function Login() {
- return
{ results && results.length !== 0 ?
results.map((e,i) =>
// using array index as keys here is fine so long as there is no way to add/remove elements from the array
@@ -46,5 +51,5 @@ export default function CreateFood() {
{ e.name }
) : <>> }
- >
+
)
}
\ No newline at end of file
diff --git a/src/pages/food/EditFood.js b/src/pages/food/EditFood.js
index 086e789..36e1a8f 100644
--- a/src/pages/food/EditFood.js
+++ b/src/pages/food/EditFood.js
@@ -1,14 +1,45 @@
-import { useParams } from 'react-router-dom'
+import { useState } from 'react'
+import { useParams, useNavigate } from 'react-router-dom'
import SaveButton from '../../components/SaveButton'
-export default function EditFood() {
- const { id } = useParams()
+import ItemHeaderEditable from '../../components/ItemHeaderEditable'
- function editFood() {
+export default function EditFood() {
+ const navigate = useNavigate()
+ const { id: _id } = useParams()
+ const [name, setName] = useState("")
+ const image = useState("")
+ const [quantity, setQuantity] = useState(0)
+ const [expirationDate, setExpirationDate] = useState("")
+ async function editFood() {
+ const res = await fetch('/api/food/edit/'+_id, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify({
+ name,
+ image,
+ quantity,
+ expirationDate
+ })
+ })
+ console.log('Editing Food', res)
+ if (!res.ok) {
+ window.alert("Failed editing food!")
+ return
+ }
+ navigate('/food/' + _id)
}
return