= new Map([
v2Cell: "N/A",
v2WifiS3: "N/A",
v2CellS3: "N/A",
- v2CellBlack: "2.1.6",
+ v2CellBlack: "2.1.7",
v2CellGreen: "N/A",
- v2WifiBlue: "2.1.6",
- v2CellBlue: "2.1.6",
- v2EthBlue: "2.1.6"
+ v2WifiBlue: "2.1.7",
+ v2CellBlue: "2.1.7",
+ v2EthBlue: "2.1.7"
}
]
]);
diff --git a/src/pages/Field.tsx b/src/pages/Field.tsx
index f4291dd..19472ae 100644
--- a/src/pages/Field.tsx
+++ b/src/pages/Field.tsx
@@ -1,10 +1,10 @@
import { Field, fieldScope, HarvestPlan, teamScope } from "models";
import { useFieldAPI, useGlobalState, useHarvestPlanAPI } from "providers";
import React, { useCallback, useEffect, useState } from "react";
-import { useLocation, useParams } from "react-router-dom";
+import { useLocation, useNavigate, useParams } from "react-router-dom";
import PageContainer from "./PageContainer";
import { useMobile, useSnackbar, useUserAPI } from "hooks";
-import { Box, Card, Grid2, IconButton } from "@mui/material";
+import { Box, Card, Grid2, IconButton, Tab, Tabs, Theme, Typography, darken } from "@mui/material";
import FieldActions from "field/FieldActions";
import { Settings } from "@mui/icons-material";
import { pond } from "protobuf-ts/pond";
@@ -14,10 +14,47 @@ import TaskViewer from "tasks/TaskViewer";
import HarvestPlanDisplay from "harvestPlan/HarvestPlanDisplay";
import { cloneDeep } from "lodash";
import HarvestPlanTable from "harvestPlan/HarvestPlanTable";
+import { makeStyles } from "@mui/styles";
+import FieldSettings from "field/FieldSettings";
+
+const useStyles = makeStyles((theme: Theme) => {
+ return ({
+ card: {
+ height: "100%",
+ bgcolor: darken(theme.palette.background.paper, 0.05),
+ },
+ sectionHeader: {
+ fontSize: 35,
+ fontWeight: 650
+ }
+ })
+})
+
+interface TabPanelProps {
+ children?: React.ReactNode;
+ index: any;
+ value: any;
+}
+
+function TabPanel(props: TabPanelProps) {
+ const { children, value, index, ...other } = props;
+
+ return (
+
+ {value === index && {children}}
+
+ );
+}
export default function FieldPage() {
const { state } = useLocation();
//const [{ as }] = useGlobalState()
+ const classes = useStyles();
const fieldAPI = useFieldAPI();
const userAPI = useUserAPI();
const [{as, user}] = useGlobalState();
@@ -31,11 +68,23 @@ export default function FieldPage() {
const [hPlan, setHPlan] = useState(HarvestPlan.create());
const [loading, setLoading] = useState(false)
const hPlanAPI = useHarvestPlanAPI();
+ const [tabVal, setTabVal] = useState(0)
+ const navigate = useNavigate()
const loadField = useCallback(() => {
-
+ if(state.field){
+ fieldAPI.getField(state.field).then(resp => {
+ setField(Field.create(resp.data))
+ }).catch(err => {
+
+ })
+ }
},[as])
+ const goTo = () => {
+ navigate("/fields");
+ }
+
useEffect(()=>{
// if already loading do nothing
if(loading) return
@@ -91,13 +140,20 @@ export default function FieldPage() {
const fieldActions = () => {
return (
-
- {
- setOpenFieldSettings(true)
- }}>
- {}}/>
-
+
+
+
+ {field.name()}
+
+
+
+ {
+ setOpenFieldSettings(true)
+ }}>
+ {}}/>
+
+
)
}
@@ -134,43 +190,44 @@ export default function FieldPage() {
field.key() !== "" && taskLoadKeys.push(field.key());
//hPlan.key() !== "" && taskLoadKeys.push(hPlan.key());
}
- return ()
+ return ()
}
const desktopView = () => {
return (
- {field.name()}
-
+
{map()}
-
- {weather()}
+
+ {weather()}
-
- {tasks()}
+
+ {tasks()}
- Harvest Overview
+
+ Harvest Overview
+
-
- {harvestPlans()}
+
+ {harvestPlans()}
-
-
+
+
@@ -181,12 +238,68 @@ export default function FieldPage() {
const mobileView = () => {
return (
- Mobile will just be the drawer view
+
+ {
+ setTabVal(val)
+ }}
+ TabIndicatorProps={{ style: { background: "rgba(255,255,0,255)" } }}>
+
+
+
+
+
+
+
+
+ {map()}
+
+
+
+
+ {weather()}
+
+
+
+
+
+
+ {tasks()}
+
+
+
+
+
+
+ {harvestPlans()}
+
+
+
+
+
+
+
+
)
}
const fieldSettings = () => {
-
+ return (
+ {
+ setOpenFieldSettings(false)
+ }}
+ selectedField={field}
+ updateFields={() => {
+ loadField()
+ }}
+ removeField={()=>{
+ goTo()
+ }}
+ />
+ )
}
return (
@@ -195,6 +308,7 @@ export default function FieldPage() {
{fieldActions()}
{isMobile ? mobileView() : desktopView()}
+ {fieldSettings()}
)
}
\ No newline at end of file