From cf559d48a2c535317abc8d3dedede42dc4827c74 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Fri, 28 Feb 2025 14:50:36 -0600 Subject: [PATCH 1/6] using json-2-csv package for the csv export now since the old package has not been updated in 4 years --- package-lock.json | 43 ++++++++++++++++++++++++++++ package.json | 2 ++ src/component/ExportDataSettings.tsx | 3 -- src/utils/download.ts | 39 ++++++++++++------------- 4 files changed, 64 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 18ff646..a73ab95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "axios": "^1.7.7", "dayjs": "^1.11.13", "deep-object-diff": "^1.1.9", + "json-2-csv": "^5.5.8", "lodash": "^4.17.21", "moment": "^2.30.1", "moment-timezone": "^0.5.46", @@ -44,6 +45,7 @@ "devDependencies": { "@babel/types": "^7.25.8", "@eslint/js": "^9.11.1", + "@types/jsonexport": "^3.0.5", "@types/lodash": "^4.17.13", "@types/react": "^18.3.10", "@types/react-color": "^3.0.13", @@ -3544,6 +3546,16 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, + "node_modules/@types/jsonexport": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/jsonexport/-/jsonexport-3.0.5.tgz", + "integrity": "sha512-+zDVaDqNguePOU11YNEsuf/ZRS1ciHeKVYGjfvDFmgG6aCy/s4W4Wy1MiXJIbiyMJLuakGLENCndvmGZpVTV1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/lodash": { "version": "4.17.13", "integrity": "sha512-lfx+dftrEZcdBPczf9d0Qv0x+j/rfNCMuC6OcfXmO8gkfeNAY88PgKUbvG56whcN23gc27yenwF6oJZXGFpYxg==", @@ -4787,6 +4799,15 @@ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", "license": "MIT" }, + "node_modules/deeks": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/deeks/-/deeks-3.1.0.tgz", + "integrity": "sha512-e7oWH1LzIdv/prMQ7pmlDlaVoL64glqzvNgkgQNgyec9ORPHrT2jaOqMtRyqJuwWjtfb6v+2rk9pmaHj+F137A==", + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, "node_modules/deep-eql": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", @@ -4878,6 +4899,15 @@ "node": ">=0.4.0" } }, + "node_modules/doc-path": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/doc-path/-/doc-path-4.1.1.tgz", + "integrity": "sha512-h1ErTglQAVv2gCnOpD3sFS6uolDbOKHDU1BZq+Kl3npPqroU3dYL42lUgMfd5UimlwtRgp7C9dLGwqQ5D2HYgQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, "node_modules/dom-helpers": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", @@ -6479,6 +6509,19 @@ "node": ">=6" } }, + "node_modules/json-2-csv": { + "version": "5.5.8", + "resolved": "https://registry.npmjs.org/json-2-csv/-/json-2-csv-5.5.8.tgz", + "integrity": "sha512-eMQHOwV+av8Sgo+fkbEbQWOw/kwh89AZ5fNA8TYfcooG6TG1ZOL2WcPUrngIMIK8dBJitQ8QEU0zbncQ0CX4CQ==", + "license": "MIT", + "dependencies": { + "deeks": "3.1.0", + "doc-path": "4.1.1" + }, + "engines": { + "node": ">= 16" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", diff --git a/package.json b/package.json index ccd03b9..93fb8d2 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "axios": "^1.7.7", "dayjs": "^1.11.13", "deep-object-diff": "^1.1.9", + "json-2-csv": "^5.5.8", "lodash": "^4.17.21", "moment": "^2.30.1", "moment-timezone": "^0.5.46", @@ -54,6 +55,7 @@ "devDependencies": { "@babel/types": "^7.25.8", "@eslint/js": "^9.11.1", + "@types/jsonexport": "^3.0.5", "@types/lodash": "^4.17.13", "@types/react": "^18.3.10", "@types/react-color": "^3.0.13", diff --git a/src/component/ExportDataSettings.tsx b/src/component/ExportDataSettings.tsx index 417c8d1..b433d43 100644 --- a/src/component/ExportDataSettings.tsx +++ b/src/component/ExportDataSettings.tsx @@ -93,14 +93,11 @@ class ExportDataSettings extends React.Component { }; submit = () => { - console.log("submit export request") const { device, component, newMeasurements, user } = this.props; const { startDate, endDate } = this.state; const { sampleMeasurements, listUnitMeasurements } = this.context; this.setState({ isLoading: true }); - console.log("Device") - console.log(device) // if (newMeasurements) { listUnitMeasurements( device.id(), diff --git a/src/utils/download.ts b/src/utils/download.ts index 812112d..14804fd 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -1,8 +1,7 @@ // import * as save from "save-svg-as-png"; -// import * as jsonexport from "jsonexport"; import { or } from "./types"; -// const jsonexport = require("jsonexport"); // const save = require("save-svg-as-png") +import { json2csv } from 'json-2-csv'; export function saveSVG(element: string, filename: string, options: Object) { // save.saveSvgAsPng(document.getElementById(element), filename, options); @@ -52,25 +51,25 @@ export function exportDataToCSV(filename: string, data: Array) { return; } - // jsonexport(data, function(err: any, csv: any) { - // if (err) return console.log(err); - // var blob = new Blob([csv], { type: "text/csv;charset=utf-8;" }); - // var link = document.createElement("a"); - // link.href = window.URL.createObjectURL(blob); - // link.download = or(filename, "generated") + ".csv"; - // document.body.appendChild(link); - // link.click(); - // setTimeout(function() { - // document.body.removeChild(link); - // window.URL.revokeObjectURL(link.href); - // }, 100); - // }); + let csv = json2csv(data) + //console.log(csv) + var blob = new Blob([csv], { type: "text/csv;charset=utf-8;" }); + var link = document.createElement("a"); + link.href = window.URL.createObjectURL(blob); + link.download = or(filename, "generated") + ".csv"; + document.body.appendChild(link); + link.click(); + setTimeout(function() { + document.body.removeChild(link); + window.URL.revokeObjectURL(link.href); + }, 100); } -export function exportJSON(filename: string, data: Array) { - if (!data || !data.length) { - return; - } +//deprecated function +// export function exportJSON(filename: string, data: Array) { +// if (!data || !data.length) { +// return; +// } // jsonexport(data, function(err: any, csv: any) { // if (err) return console.log(err); @@ -85,4 +84,4 @@ export function exportJSON(filename: string, data: Array) { // window.URL.revokeObjectURL(link.href); // }, 100); // }); -} +//} From 9b274b9e1625a3e2f05c6394a9064e0d59a7e90d Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 3 Mar 2025 11:28:37 -0600 Subject: [PATCH 2/6] adhusted the breadcrumb to have the last one highlighted again --- package-lock.json | 9 --------- package.json | 2 -- src/common/SmartBreadcrumb.tsx | 9 +++++++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index a73ab95..b70900f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,6 @@ "react-router-dom": "^6.28.0", "react-virtualized-auto-sizer": "^1.0.25", "recharts": "^2.15.1", - "save-svg-as-png": "^1.4.17", "victory": "^37.3.6" }, "devDependencies": { @@ -56,7 +55,6 @@ "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.12", "globals": "^15.9.0", - "save-svg-as-png": "^1.4.17", "typescript": "^5.5.3", "typescript-eslint": "^8.7.0", "vite": "^6.2.0", @@ -7910,13 +7908,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/save-svg-as-png": { - "version": "1.4.17", - "resolved": "https://registry.npmjs.org/save-svg-as-png/-/save-svg-as-png-1.4.17.tgz", - "integrity": "sha512-7QDaqJsVhdFPwviCxkgHiGm9omeaMBe1VKbHySWU6oFB2LtnGCcYS13eVoslUgq6VZC6Tjq/HddBd1K6p2PGpA==", - "dev": true, - "license": "MIT" - }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", diff --git a/package.json b/package.json index 93fb8d2..b82915d 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "react-router-dom": "^6.28.0", "react-virtualized-auto-sizer": "^1.0.25", "recharts": "^2.15.1", - "save-svg-as-png": "^1.4.17", "victory": "^37.3.6" }, "devDependencies": { @@ -66,7 +65,6 @@ "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.12", "globals": "^15.9.0", - "save-svg-as-png": "^1.4.17", "typescript": "^5.5.3", "typescript-eslint": "^8.7.0", "vite": "^6.2.0", diff --git a/src/common/SmartBreadcrumb.tsx b/src/common/SmartBreadcrumb.tsx index 4fd8f4a..a46c454 100644 --- a/src/common/SmartBreadcrumb.tsx +++ b/src/common/SmartBreadcrumb.tsx @@ -270,9 +270,12 @@ export default function SmartBreadcrumb(props: Props) { if (prependPaths) pathnames.unshift(...prependPaths) + console.log(pathnames) + pathnames.forEach((_value: any, index: any) => { const lastPath = index === pathnames.length - 1; + console.log(lastPath) const to = `/${pathnames.slice(0, index + 1).join("/")}`; let label = breadcrumbMap[to]; @@ -304,10 +307,12 @@ export default function SmartBreadcrumb(props: Props) { variant={lastPath ? "filled" : "outlined"} label={ {label} From 44a31dcd2bdcc9f47a4d3a3b3c5d064093897902 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 3 Mar 2025 12:06:53 -0600 Subject: [PATCH 3/6] change the starting page to 0 for the table --- src/common/SmartBreadcrumb.tsx | 4 ++-- src/pages/DeviceComponent.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/SmartBreadcrumb.tsx b/src/common/SmartBreadcrumb.tsx index a46c454..aa0202c 100644 --- a/src/common/SmartBreadcrumb.tsx +++ b/src/common/SmartBreadcrumb.tsx @@ -270,12 +270,12 @@ export default function SmartBreadcrumb(props: Props) { if (prependPaths) pathnames.unshift(...prependPaths) - console.log(pathnames) + //console.log(pathnames) pathnames.forEach((_value: any, index: any) => { const lastPath = index === pathnames.length - 1; - console.log(lastPath) + //console.log(lastPath) const to = `/${pathnames.slice(0, index + 1).join("/")}`; let label = breadcrumbMap[to]; diff --git a/src/pages/DeviceComponent.tsx b/src/pages/DeviceComponent.tsx index 9bff22a..117d8b7 100644 --- a/src/pages/DeviceComponent.tsx +++ b/src/pages/DeviceComponent.tsx @@ -120,7 +120,7 @@ export default function DeviceComponent() { getDefaultInteraction() ); const [pageSize, setPageSize] = useState(5); - const [page, setPage] = useState(1) + const [page, setPage] = useState(0) const [order, setOrder] = useState("desc") const [rows, setRows] = useState([]) const [total, setTotal] = useState(0) From 14904d8eb31a154138152bdf6f28326dd5e69038 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 3 Mar 2025 13:42:37 -0600 Subject: [PATCH 4/6] add margin="dense" to the properties of the TextField to give the label room on the top so as to not get cut off --- src/common/TagSettings.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/TagSettings.tsx b/src/common/TagSettings.tsx index aced335..4ee03e5 100644 --- a/src/common/TagSettings.tsx +++ b/src/common/TagSettings.tsx @@ -174,6 +174,7 @@ export default function TagSettings(props: Props) { { From f2cf950a6bbdd25d6a675ec7326764761e9d6813 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 4 Mar 2025 12:35:36 -0600 Subject: [PATCH 5/6] updated the material ui imports for existing files that had not been updated yet --- src/common/NotificationButton.tsx | 2 +- src/component/ComponentOrder.tsx | 20 +++--- src/component/GPS.tsx | 4 +- src/component/SensorLight.tsx | 6 +- src/fans/fanPicker.tsx | 31 +++++---- src/grain/GrainInventory.tsx | 2 +- src/grain/GrainTransaction.tsx | 2 +- src/objects/ObjectAlerts.tsx | 63 ++++++++++--------- src/objects/bulkEditForms/bulkBinSettings.tsx | 3 +- .../bulkEditForms/bulkGrainBagSettings.tsx | 3 +- src/products/ProductTabChip.tsx | 12 ++-- 11 files changed, 82 insertions(+), 66 deletions(-) diff --git a/src/common/NotificationButton.tsx b/src/common/NotificationButton.tsx index 33e5089..cf1297a 100644 --- a/src/common/NotificationButton.tsx +++ b/src/common/NotificationButton.tsx @@ -1,5 +1,5 @@ import { IconButton, Tooltip } from "@mui/material"; -// import { Theme } from "@material-ui/core/styles/createMuiTheme"; +// import { Theme } from "@/styles/createMuiTheme"; // import withStyles, { WithStyles } from "@material-ui/core/styles/withStyles"; import NotificationsEnabledIcon from "@mui/icons-material/NotificationsActive"; import NotificationsDisabledIcon from "@mui/icons-material/NotificationsOff"; diff --git a/src/component/ComponentOrder.tsx b/src/component/ComponentOrder.tsx index 3b8329e..95d03aa 100644 --- a/src/component/ComponentOrder.tsx +++ b/src/component/ComponentOrder.tsx @@ -11,10 +11,12 @@ import { ListItemIcon, ListItemText, ListSubheader, - Typography -} from "@material-ui/core"; -import { createStyles, makeStyles, Theme } from "@material-ui/core/styles"; -import DragIcon from "@material-ui/icons/DragHandle"; + Typography, + Theme +} from "@mui/material"; +import { makeStyles } from "@mui/styles"; +//import DragIcon from "@material-ui/icons/DragHandle"; +import { DragHandle as DragIcon } from "@mui/icons-material"; import ResponsiveDialog from "common/ResponsiveDialog"; import { useDeviceAPI, usePrevious, useSnackbar } from "hooks"; import { cloneDeep } from "lodash"; @@ -23,17 +25,19 @@ import { sortComponents } from "pbHelpers/Component"; import { pond, quack } from "protobuf-ts/pond"; import React, { useEffect, useState } from "react"; import { DragDropContext, Draggable, Droppable, DropResult } from "react-beautiful-dnd"; +import { useThemeType } from "../hooks/useThemeType"; -const useStyles = makeStyles((theme: Theme) => - createStyles({ +const useStyles = makeStyles((theme: Theme) => { + const themeType = useThemeType() + return ({ item: { backgroundColor: "rgba(0,0,0,0)", "&:hover": { backgroundColor: - theme.palette.type === "light" ? "rgba(0,0,0,0.07)" : "rgba(255,255,255,0.07)" + themeType === "light" ? "rgba(0,0,0,0.07)" : "rgba(255,255,255,0.07)" } } - }) + })} ); interface ItemProps { diff --git a/src/component/GPS.tsx b/src/component/GPS.tsx index aa94941..985d17c 100644 --- a/src/component/GPS.tsx +++ b/src/component/GPS.tsx @@ -1,4 +1,6 @@ -import { withStyles, Theme, WithTheme, createStyles, WithStyles } from "@material-ui/core/styles"; +//import { withStyles, Theme, WithTheme, createStyles, WithStyles } from "@material-ui/core/styles"; +import { Theme } from "@mui/material" +import { withStyles, createStyles, WithTheme, WithStyles } from "@mui/styles"; import React from "react"; import { parseGPS } from "services/google/mapHelpers"; import { geolocate } from "services/google/googleAPI"; diff --git a/src/component/SensorLight.tsx b/src/component/SensorLight.tsx index 7192f48..167bb6c 100644 --- a/src/component/SensorLight.tsx +++ b/src/component/SensorLight.tsx @@ -1,4 +1,6 @@ -import { Box, createStyles, makeStyles, Theme } from "@material-ui/core"; +//import { Box, createStyles, makeStyles, Theme } from "@material-ui/core"; +import { Box, Theme } from "@mui/material"; +import { makeStyles } from "@mui/styles"; import { Component } from "models"; import { getMeasurementSummary } from "pbHelpers/ComponentType"; import { pond } from "protobuf-ts/pond"; @@ -14,7 +16,7 @@ interface Props { } const useStyles = makeStyles((theme: Theme) => - createStyles({ + ({ "@keyframes ripple": { from: { transform: "scale(.8)", diff --git a/src/fans/fanPicker.tsx b/src/fans/fanPicker.tsx index 30f70d2..bf8ea96 100644 --- a/src/fans/fanPicker.tsx +++ b/src/fans/fanPicker.tsx @@ -1,5 +1,5 @@ import { - Grid, + Grid2 as Grid, Button, Typography, DialogTitle, @@ -12,8 +12,9 @@ import { RadioGroup, Radio, Box -} from "@material-ui/core"; -import { blue } from "@material-ui/core/colors"; +} from "@mui/material"; +//import { blue } from "@material-ui/core/colors"; +import { blue } from "@mui/material/colors"; import ResponsiveDialog from "common/ResponsiveDialog"; import React, { useState, useEffect } from "react"; import fans from "fans/fans_client.json"; @@ -203,13 +204,12 @@ export default function FanPicker(props: Props) { alignItems="center" container direction="row" - justify="space-between" key={type} style={{ marginTop: 20 }}> - + } label={type} /> - + fanimg @@ -245,9 +245,8 @@ export default function FanPicker(props: Props) { - + - - Select Fan - + + Select Fan + {selector()} - + - + {displayFan} @@ -387,8 +386,8 @@ export default function FanPicker(props: Props) { Current Fan {displayFan} - - + + ; @@ -65,7 +70,7 @@ interface Alert { } const useStyles = makeStyles((theme: Theme) => { - return createStyles({ + return ({ borderedContainer: { padding: theme.spacing(1), marginBottom: theme.spacing(2), @@ -327,7 +332,7 @@ export default function ObjectAlerts(props: Props) { }> {alert.conditions.map((condition, i) => ( - + {readableCondition(condition)} ))} @@ -448,15 +453,14 @@ export default function ObjectAlerts(props: Props) { key={"interaction"} container direction="row" - justify="center" alignItems="center" spacing={2}> {index > 0 && ( - + AND )} - + - + - + - + {index === 0 ? ( - + - + {(subtypeDropdown === 2 || subtypeDropdown === 3 || subtypeDropdown === 4) && ( )} - + {subtypeDropdown === 3 && ( { //const schedule = or(interaction.settings.schedule, pond.InteractionSchedule.create()); return ( - + Schedule - + {daySelector("sunday", 3)} {daySelector("monday", 3)} {daySelector("tuesday", 3)} @@ -802,7 +805,7 @@ export default function ObjectAlerts(props: Props) { {daySelector("saturday", 4)} - + {showStart && ( - + } + //renderInput={props => } value={start} onChange={(event: any) => setScheduleTime("start", event)} /> )} {showBoth && ( - + )} {showEnd && ( - + } + //renderInput={props => } value={end} onChange={(event: any) => setScheduleTime("end", event)} /> diff --git a/src/objects/bulkEditForms/bulkBinSettings.tsx b/src/objects/bulkEditForms/bulkBinSettings.tsx index 933e0b5..8809ad2 100644 --- a/src/objects/bulkEditForms/bulkBinSettings.tsx +++ b/src/objects/bulkEditForms/bulkBinSettings.tsx @@ -1,4 +1,5 @@ -import { Button, Grid, InputAdornment, TextField } from "@material-ui/core"; +//import { Button, Grid, InputAdornment, TextField } from "@material-ui/core"; +import { Button, Grid, InputAdornment, TextField } from "@mui/material"; import SearchSelect, { Option } from "common/SearchSelect"; import { GrainOptions } from "grain"; import { pond } from "protobuf-ts/pond"; diff --git a/src/objects/bulkEditForms/bulkGrainBagSettings.tsx b/src/objects/bulkEditForms/bulkGrainBagSettings.tsx index f4937ad..b91b556 100644 --- a/src/objects/bulkEditForms/bulkGrainBagSettings.tsx +++ b/src/objects/bulkEditForms/bulkGrainBagSettings.tsx @@ -1,4 +1,5 @@ -import { Button, Grid, TextField } from "@material-ui/core"; +//import { Button, Grid, TextField } from "@material-ui/core"; +import { Button, Grid, TextField } from "@mui/material"; import SearchSelect, { Option } from "common/SearchSelect"; import { GrainOptions } from "grain"; import { GrainBag } from "models/GrainBag"; diff --git a/src/products/ProductTabChip.tsx b/src/products/ProductTabChip.tsx index 29d9099..1fad36e 100644 --- a/src/products/ProductTabChip.tsx +++ b/src/products/ProductTabChip.tsx @@ -1,14 +1,18 @@ -import { Avatar, ButtonBase, createStyles, makeStyles, Theme, Tooltip } from "@material-ui/core"; -import { Tune as PresetsIcon, ViewList as ComponentsIcon } from "@material-ui/icons"; +//import { Avatar, ButtonBase, createStyles, makeStyles, Theme, Tooltip } from "@material-ui/core"; +//import { Tune as PresetsIcon, ViewList as ComponentsIcon } from "@material-ui/icons"; +import { Avatar, ButtonBase, Theme, Tooltip } from "@mui/material"; +import { Tune as PresetsIcon, ViewList as ComponentsIcon } from "@mui/icons-material"; +import { makeStyles } from "@mui/styles"; +import { useThemeType } from "../hooks/useThemeType"; import classnames from "classnames"; import { capitalize } from "lodash"; import React from "react"; import { ProductTab } from "./DeviceProduct"; const useStyles = makeStyles((theme: Theme) => { - const themeType = theme.palette.type; + const themeType = useThemeType(); const activeBG = theme.palette.secondary.main; - return createStyles({ + return ({ avatar: { color: themeType === "light" ? theme.palette.common.black : theme.palette.common.white, backgroundColor: "transparent", From 1982a93bf053bba65ea7c810a558e5e58ea0b3fb Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 4 Mar 2025 13:44:13 -0600 Subject: [PATCH 6/6] updated the dialog actions for the submit and cancel buttons --- src/common/TagSettings.tsx | 6 +++-- src/component/ComponentSettings.tsx | 12 ++++++---- src/device/DeviceSettings.tsx | 12 ++++++---- src/group/GroupSettings.tsx | 12 +++++++--- src/interactions/InteractionSettings.tsx | 8 ++++--- .../bulkEditForms/bulkGrainBagSettings.tsx | 24 +++++++++---------- 6 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/common/TagSettings.tsx b/src/common/TagSettings.tsx index 4ee03e5..6a80452 100644 --- a/src/common/TagSettings.tsx +++ b/src/common/TagSettings.tsx @@ -17,6 +17,7 @@ import { useState } from "react"; import { Tag as TagUI } from "./Tag"; import { red } from "@mui/material/colors"; import { makeStyles, withStyles } from "@mui/styles"; +import CancelSubmit from "./CancelSubmit"; const useStyles = makeStyles((theme: Theme) => { return ({ @@ -72,12 +73,13 @@ function ConfirmDeleteTag(props: ConfirmDeleteTagProps) { - + */} ); diff --git a/src/component/ComponentSettings.tsx b/src/component/ComponentSettings.tsx index 5eb2b84..1fbd4fa 100644 --- a/src/component/ComponentSettings.tsx +++ b/src/component/ComponentSettings.tsx @@ -67,6 +67,7 @@ import { Add as AddIcon, } from "@mui/icons-material" +import CancelSubmit from "common/CancelSubmit"; const useStyles = makeStyles((theme: Theme) => { return ({ @@ -820,7 +821,7 @@ export default function ComponentSettings(props: Props) { const actions = () => { return ( - + {mode === "add" ? ( {activeStep === steps.length - 1 ? ( {canEdit && ( - )} + )} */} )} diff --git a/src/device/DeviceSettings.tsx b/src/device/DeviceSettings.tsx index a2c5221..e8afc5f 100644 --- a/src/device/DeviceSettings.tsx +++ b/src/device/DeviceSettings.tsx @@ -32,6 +32,7 @@ import { quack } from "protobuf-ts/quack"; import LinearMutationBuilder from "common/LinearMutationBuilder"; import { makeStyles } from "@mui/styles"; import { useNavigate } from "react-router-dom"; +import CancelSubmit from "common/CancelSubmit"; interface TabPanelProps { children?: React.ReactNode; @@ -584,17 +585,18 @@ export default function DeviceSettings(props: Props) { const actions = () => { return ( - - + + {canRemove() && Delete} - - + */} ); diff --git a/src/group/GroupSettings.tsx b/src/group/GroupSettings.tsx index 9081a0c..e063591 100644 --- a/src/group/GroupSettings.tsx +++ b/src/group/GroupSettings.tsx @@ -23,6 +23,7 @@ import { Typography } from "@mui/material"; import { makeStyles } from "@mui/styles"; +import CancelSubmit from "common/CancelSubmit"; // import { darken, lighten } from "@material-ui/core/styles/colorManipulator"; // import { Theme } from "@material-ui/core/styles/createMuiTheme"; import DeleteButton from "common/DeleteButton"; @@ -435,7 +436,7 @@ export default function GroupSettings(props: Props) { const actions = () => { return ( - + {mode === "add" ? ( {(mode === "add" && tabIndex === steps.length - 1) || mode === "update" @@ -460,7 +466,7 @@ export default function GroupSettings(props: Props) { - )} + )} */} ); diff --git a/src/interactions/InteractionSettings.tsx b/src/interactions/InteractionSettings.tsx index c72de0d..d46c8b3 100644 --- a/src/interactions/InteractionSettings.tsx +++ b/src/interactions/InteractionSettings.tsx @@ -64,6 +64,7 @@ import { green, red } from "@mui/material/colors"; import { LocalizationProvider, TimePicker } from "@mui/x-date-pickers"; import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment"; import dayjs from "dayjs"; +import CancelSubmit from "common/CancelSubmit"; // import { Sensor } from "ventilation/drawable/Sensor"; @@ -1555,14 +1556,15 @@ export default function InteractionSettings(props: Props) { const actions = () => { return ( - + {mode === "update" && canEdit && ( Delete )} - {canEdit && ( @@ -1572,7 +1574,7 @@ export default function InteractionSettings(props: Props) { disabled={!isInteractionValid(interaction) || invalidConditionValues()}> Submit - )} + )} */} ); diff --git a/src/objects/bulkEditForms/bulkGrainBagSettings.tsx b/src/objects/bulkEditForms/bulkGrainBagSettings.tsx index b91b556..87a3ee6 100644 --- a/src/objects/bulkEditForms/bulkGrainBagSettings.tsx +++ b/src/objects/bulkEditForms/bulkGrainBagSettings.tsx @@ -1,5 +1,5 @@ //import { Button, Grid, TextField } from "@material-ui/core"; -import { Button, Grid, TextField } from "@mui/material"; +import { Button, Grid2 as Grid, TextField } from "@mui/material"; import SearchSelect, { Option } from "common/SearchSelect"; import { GrainOptions } from "grain"; import { GrainBag } from "models/GrainBag"; @@ -77,7 +77,7 @@ export default function BulkGrainBagSettings(props: Props) { {/* first row */} - + - + - + - + {/* second row */} - + - + - + - + {/* last row */} - + setFillDate(e.target.value)} /> - + - +