From 0fdf3e6bed8fd9b3a5fdfe13629c4aa1f942d2f4 Mon Sep 17 00:00:00 2001 From: Sunrise Date: Sat, 29 Apr 2023 22:51:57 -0400 Subject: [PATCH] working on page formatting --- db_app/src/components/Plan.js | 100 ++++++++++++++++++++++++++++++---- 1 file changed, 88 insertions(+), 12 deletions(-) diff --git a/db_app/src/components/Plan.js b/db_app/src/components/Plan.js index 6023ab1..809eedb 100644 --- a/db_app/src/components/Plan.js +++ b/db_app/src/components/Plan.js @@ -1,4 +1,4 @@ -import React,{useState} from 'react'; +import React,{useState, useReducer} from 'react'; import {Routes, Route, useNavigate} from 'react-router-dom'; import './Login.css'; import Button from "@mui/material/Button"; @@ -21,6 +21,7 @@ import MenuIcon from '@mui/material/Menu' import MenuItem from '@mui/material/MenuItem'; import {red, green, lightBlue, lightGreen} from '@mui/material/colors'; import { ThemeProvider, createTheme } from '@mui/material/styles'; +import { Axios } from 'axios'; const theme = createTheme({ palette: { @@ -61,6 +62,28 @@ function weekStart(){ return db_date; } +const [goalInput, setGoalInput] = useReducer( + (state, newState) => ({ ...state, ...newState }), + { + total_cal: "", + total_fat: "", + total_sat_fat: "", + total_trans_fat: "", + total_carbs: "", + total_fiber: "", + total_sugar: "", + total_protein: "", + total_sodium: "", + total_potassium: "", + total_cholesterol: "", + } +); + +const handleSubmit = evt => { + let data = {goalInput} + + Axios.post() +} return ( @@ -86,57 +109,110 @@ function weekStart(){ +

  Your Plan

+

   Goal for the week of:

+ <>    + <>    + <>    + <>    + <>    +

+ <>    + <>    + <>    + <>    + <>    + <>    +

+

+ <>    + +
+

+ +
+

+     + So Far This Week: +

+
+
+

+     + Add to Food Journal +

+

      + On-Campus +

+

      + Off-Campus +

+