got rid of material-ui references and fixed fan icon import

This commit is contained in:
Carter 2025-03-18 11:40:16 -06:00
parent c84f6194fa
commit 65eeb9e8b4
20 changed files with 163 additions and 94 deletions

View file

@ -13,7 +13,6 @@ import {
Radio, Radio,
Box Box
} from "@mui/material"; } from "@mui/material";
//import { blue } from "@material-ui/core/colors";
import { blue } from "@mui/material/colors"; import { blue } from "@mui/material/colors";
import ResponsiveDialog from "common/ResponsiveDialog"; import ResponsiveDialog from "common/ResponsiveDialog";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";

View file

@ -19,7 +19,6 @@ import {
Theme, Theme,
Typography Typography
} from "@mui/material"; } from "@mui/material";
// import { Alert, AlertTitle, Skeleton } from "@material-ui/lab";
import { GrainOptions, MoistureToHumidity } from "grain"; import { GrainOptions, MoistureToHumidity } from "grain";
import GrainDryingChart, { GrainDryingPoint } from "charts/GrainDryingChart"; import GrainDryingChart, { GrainDryingPoint } from "charts/GrainDryingChart";
import SearchSelect, { Option } from "common/SearchSelect"; import SearchSelect, { Option } from "common/SearchSelect";

View file

@ -1,32 +1,31 @@
import { import {
createStyles,
IconButton, IconButton,
ListItemIcon, ListItemIcon,
ListItemText, ListItemText,
makeStyles,
Menu, Menu,
MenuItem, MenuItem,
Tooltip Tooltip
} from "@material-ui/core"; } from "@mui/material";
import SettingsIcon from "@material-ui/icons/Settings"; import SettingsIcon from "@mui/icons-material/Settings";
import MoreIcon from "@material-ui/icons/MoreVert"; import MoreIcon from "@mui/icons-material/MoreVert";
import React, { useState } from "react"; import React, { useState } from "react";
import ObjectUsersIcon from "@material-ui/icons/AccountCircle"; import ObjectUsersIcon from "@mui/icons-material/AccountCircle";
import ObjectTeamsIcon from "@material-ui/icons/SupervisedUserCircle"; import ObjectTeamsIcon from "@mui/icons-material/SupervisedUserCircle";
import ObjectUsers from "user/ObjectUsers"; import ObjectUsers from "user/ObjectUsers";
import { pond } from "protobuf-ts/pond"; import { pond } from "protobuf-ts/pond";
import { Scope } from "models"; import { Scope } from "models";
import ObjectTeams from "teams/ObjectTeams"; import ObjectTeams from "teams/ObjectTeams";
import RemoveSelfFromObject from "user/RemoveSelfFromObject"; import RemoveSelfFromObject from "user/RemoveSelfFromObject";
import ShareObject from "user/ShareObject"; import ShareObject from "user/ShareObject";
import { blue } from "@material-ui/core/colors"; import { blue } from "@mui/material/colors";
import RemoveSelfIcon from "@material-ui/icons/ExitToApp"; import RemoveSelfIcon from "@mui/icons-material/ExitToApp";
import { Share } from "@material-ui/icons"; import { Share } from "@mui/icons-material";
import { GrainBag } from "models/GrainBag"; import { GrainBag } from "models/GrainBag";
import GrainBagSettings from "./grainBagSettings"; import GrainBagSettings from "./grainBagSettings";
import { makeStyles } from "@mui/styles";
const useStyles = makeStyles(() => { const useStyles = makeStyles(() => {
return createStyles({ return ({
shareIcon: { shareIcon: {
color: blue["500"], color: blue["500"],
"&:hover": { "&:hover": {
@ -87,7 +86,6 @@ export default function GrainBagActions(props: Props) {
setOpenState({ ...openState, share: true }); setOpenState({ ...openState, share: true });
setAnchorEl(null); setAnchorEl(null);
}} }}
button
dense> dense>
<ListItemIcon> <ListItemIcon>
<Share className={classes.blueIcon} /> <Share className={classes.blueIcon} />
@ -99,8 +97,7 @@ export default function GrainBagActions(props: Props) {
onClick={() => { onClick={() => {
setOpenState({ ...openState, users: true }); setOpenState({ ...openState, users: true });
setAnchorEl(null); setAnchorEl(null);
}} }}>
button>
<ListItemIcon> <ListItemIcon>
<ObjectUsersIcon /> <ObjectUsersIcon />
</ListItemIcon> </ListItemIcon>
@ -111,8 +108,7 @@ export default function GrainBagActions(props: Props) {
onClick={() => { onClick={() => {
setOpenState({ ...openState, teams: true }); setOpenState({ ...openState, teams: true });
setAnchorEl(null); setAnchorEl(null);
}} }}>
button>
<ListItemIcon> <ListItemIcon>
<ObjectTeamsIcon /> <ObjectTeamsIcon />
</ListItemIcon> </ListItemIcon>
@ -123,8 +119,7 @@ export default function GrainBagActions(props: Props) {
onClick={() => { onClick={() => {
setOpenState({ ...openState, removeSelf: true }); setOpenState({ ...openState, removeSelf: true });
setAnchorEl(null); setAnchorEl(null);
}} }}>
button>
<ListItemIcon> <ListItemIcon>
<RemoveSelfIcon className={classes.red} /> <RemoveSelfIcon className={classes.red} />
</ListItemIcon> </ListItemIcon>

View file

@ -1,11 +1,11 @@
import { Box, Card, CircularProgress, Typography } from "@material-ui/core"; import { Box, Card, CircularProgress, Typography } from "@mui/material";
import BarGraph, { BarData } from "charts/BarGraph"; import BarGraph, { BarData } from "charts/BarGraph";
import GrainDescriber from "grain/GrainDescriber"; import GrainDescriber from "grain/GrainDescriber";
import { GrainBag } from "models/GrainBag"; import { GrainBag } from "models/GrainBag";
import moment, { Moment } from "moment"; import moment, { Moment } from "moment";
import { pond } from "protobuf-ts/pond"; import { pond } from "protobuf-ts/pond";
import { useGrainBagAPI, useSnackbar } from "providers"; import { useGrainBagAPI, useSnackbar } from "providers";
import React, { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { getGrainUnit } from "utils"; import { getGrainUnit } from "utils";
interface Props { interface Props {
@ -61,7 +61,7 @@ export default function GrainBagInventoryGraph(props: Props) {
} }
setData(barData); setData(barData);
}) })
.catch(err => { .catch(_err => {
openSnack("There was a problem retrieving inventory information"); openSnack("There was a problem retrieving inventory information");
}) })
.finally(() => { .finally(() => {

View file

@ -1,16 +1,14 @@
import { import {
Box, Box,
Card, Card,
Grid, Grid2 as Grid,
Slider, Slider,
makeStyles,
createStyles,
Typography, Typography,
IconButton, IconButton,
Theme, Theme,
useTheme, useTheme,
darken darken
} from "@material-ui/core"; } from "@mui/material";
import GrainDescriber from "grain/GrainDescriber"; import GrainDescriber from "grain/GrainDescriber";
import GrainTransaction from "grain/GrainTransaction"; import GrainTransaction from "grain/GrainTransaction";
import { useMobile } from "hooks"; import { useMobile } from "hooks";
@ -19,10 +17,11 @@ import { round } from "lodash";
import { GrainBag } from "models/GrainBag"; import { GrainBag } from "models/GrainBag";
import moment from "moment"; import moment from "moment";
import { pond } from "protobuf-ts/pond"; import { pond } from "protobuf-ts/pond";
import React, { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { getThemeType } from "theme"; import { getThemeType } from "theme";
import { getGrainUnit } from "utils"; import { getGrainUnit } from "utils";
import GrainBagSVG from "./grainBagSVG"; import GrainBagSVG from "./grainBagSVG";
import { makeStyles } from "@mui/styles";
interface Props { interface Props {
grainBag: GrainBag; grainBag: GrainBag;
@ -36,7 +35,7 @@ enum zIndexPriority {
} }
const useStyles = makeStyles((theme: Theme) => { const useStyles = makeStyles((theme: Theme) => {
return createStyles({ return ({
grainOVerlay: { grainOVerlay: {
position: "absolute", position: "absolute",
height: "10%", height: "10%",
@ -293,14 +292,14 @@ export default function GrainBagVisualizer(props: Props) {
return ( return (
<Card raised className={classes.cardContent}> <Card raised className={classes.cardContent}>
<Grid container justify="flex-start" alignItems="stretch"> <Grid container justifyContent="flex-start" alignItems="stretch">
<Grid item xs sm md style={{ position: "relative" }}> <Grid style={{ position: "relative" }}>
{overview()} {overview()}
</Grid> </Grid>
<Grid item style={{ position: "relative" }}> <Grid style={{ position: "relative" }}>
{visual()} {visual()}
</Grid> </Grid>
<Grid item>{controls()}</Grid> <Grid>{controls()}</Grid>
</Grid> </Grid>
{/* dialog for grain inventory transactions */} {/* dialog for grain inventory transactions */}
<GrainTransaction <GrainTransaction

View file

@ -24,14 +24,10 @@ import {
} from "@mui/material"; } from "@mui/material";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
import CancelSubmit from "common/CancelSubmit"; 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"; import DeleteButton from "common/DeleteButton";
import Loader from "common/Loader"; import Loader from "common/Loader";
import ResponsiveDialog from "common/ResponsiveDialog"; import ResponsiveDialog from "common/ResponsiveDialog";
import SearchBar from "common/SearchBar"; import SearchBar from "common/SearchBar";
// import SearchBar from "common/SearchBar";
// import RemoveGroup from "group/RemoveGroup";
import { useDeviceAPI, useGroupAPI, usePrevious, useSnackbar } from "hooks"; import { useDeviceAPI, useGroupAPI, usePrevious, useSnackbar } from "hooks";
import { Device, Group } from "models"; import { Device, Group } from "models";
import { filterDevices } from "pbHelpers/Device"; import { filterDevices } from "pbHelpers/Device";

View file

@ -1,5 +1,3 @@
// import { useTheme, Theme } from "@material-ui/core";
import { Theme, useTheme } from "@mui/material"; import { Theme, useTheme } from "@mui/material";
export function useThemeType() { export function useThemeType() {

View file

@ -22,7 +22,6 @@ import {
} from "@mui/material"; } from "@mui/material";
import AddIcon from "@mui/icons-material/AddCircle"; import AddIcon from "@mui/icons-material/AddCircle";
import RemoveIcon from "@mui/icons-material/RemoveCircle"; import RemoveIcon from "@mui/icons-material/RemoveCircle";
// import { TimePicker } from "@material-ui/pickers";
import classNames from "classnames"; import classNames from "classnames";
import DeleteButton from "common/DeleteButton"; import DeleteButton from "common/DeleteButton";
import ResponsiveDialog from "common/ResponsiveDialog"; import ResponsiveDialog from "common/ResponsiveDialog";
@ -557,7 +556,7 @@ export default function InteractionSettings(props: Props) {
setInteraction(updatedInteraction); setInteraction(updatedInteraction);
}; };
const toggleReport = (event: any) => { const toggleReport = (_event: any) => {
let updatedInteraction = Interaction.clone(interaction); let updatedInteraction = Interaction.clone(interaction);
let notifications = or( let notifications = or(
interaction.settings.notifications, interaction.settings.notifications,
@ -568,7 +567,7 @@ export default function InteractionSettings(props: Props) {
setInteraction(updatedInteraction); setInteraction(updatedInteraction);
}; };
const toggleNotify = (event: any) => { const toggleNotify = (_event: any) => {
let updatedInteraction = Interaction.clone(interaction); let updatedInteraction = Interaction.clone(interaction);
let notifications = or( let notifications = or(
updatedInteraction.settings.notifications, updatedInteraction.settings.notifications,

View file

@ -15,7 +15,6 @@ import {
Typography Typography
} from "@mui/material"; } from "@mui/material";
import { Settings } from "@mui/icons-material"; import { Settings } from "@mui/icons-material";
// import { ToggleButton, ToggleButtonGroup } from "@material-ui/lab";
import { useInteractionsAPI, usePrevious, useSnackbar } from "hooks"; import { useInteractionsAPI, usePrevious, useSnackbar } from "hooks";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import { Component, Device, Interaction } from "models"; import { Component, Device, Interaction } from "models";
@ -156,7 +155,7 @@ export default function InteractionsOverview(props: Props) {
step={measurement.step()} step={measurement.step()}
track={false} track={false}
value={measurement.toDisplay(condition.value ? condition.value : 0)} value={measurement.toDisplay(condition.value ? condition.value : 0)}
onChange={(event, value) => onChange={(_event, value) =>
updateConditionValue(source, interactionIndex, conditionIndex, value) updateConditionValue(source, interactionIndex, conditionIndex, value)
} }
/> />
@ -202,14 +201,14 @@ export default function InteractionsOverview(props: Props) {
) => { ) => {
interactionsAPI interactionsAPI
.updateInteraction(Number(deviceID), settings) .updateInteraction(Number(deviceID), settings)
.then((response: any) => { .then((_response: any) => {
let updatedDirtyInteractions = cloneDeep(dirtyInteractions); let updatedDirtyInteractions = cloneDeep(dirtyInteractions);
updatedDirtyInteractions.set(index, false); updatedDirtyInteractions.set(index, false);
setDirtyInteractions(updatedDirtyInteractions); setDirtyInteractions(updatedDirtyInteractions);
success("Successfully updated the interaction for " + component.name()); success("Successfully updated the interaction for " + component.name());
refreshCallback(); refreshCallback();
}) })
.catch((err: any) => { .catch((_err: any) => {
error("Error occurred while updating the interaction for " + component.name()); error("Error occurred while updating the interaction for " + component.name());
}); });
}; };

View file

@ -29,9 +29,6 @@ import {
Typography Typography
} from "@mui/material"; } from "@mui/material";
import { ExpandMore, RemoveCircle as RemoveIcon, AddCircle as AddIcon } from "@mui/icons-material"; import { ExpandMore, RemoveCircle as RemoveIcon, AddCircle as AddIcon } from "@mui/icons-material";
//import RemoveIcon from "@material-ui/icons/RemoveCircle";
//import { ExpandMore } from "@material-ui/icons";
//import AddIcon from "@material-ui/icons/AddCircle";
import ResponsiveDialog from "common/ResponsiveDialog"; import ResponsiveDialog from "common/ResponsiveDialog";
import { Option } from "common/SearchSelect"; import { Option } from "common/SearchSelect";
import classNames from "classnames"; import classNames from "classnames";
@ -47,11 +44,8 @@ import { useNotificationAPI } from "providers/pond/notificationAPI";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { capitalize, cloneDeep } from "lodash"; import { capitalize, cloneDeep } from "lodash";
import { timeOfDayDescriptor } from "pbHelpers/Interaction"; import { timeOfDayDescriptor } from "pbHelpers/Interaction";
//import { TimePicker } from "@material-ui/pickers";
import { TimePicker } from "@mui/x-date-pickers"; import { TimePicker } from "@mui/x-date-pickers";
//import { getThemeType } from "theme";
import { getThemeType } from "theme/themeType"; import { getThemeType } from "theme/themeType";
//import { green, red } from "@material-ui/core/colors";
import { green, red } from "@mui/material/colors"; import { green, red } from "@mui/material/colors";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
@ -251,7 +245,7 @@ export default function ObjectAlerts(props: Props) {
setRecentNotifications(resp.data.notifications); setRecentNotifications(resp.data.notifications);
setTotalNotifications(resp.data.total); setTotalNotifications(resp.data.total);
}) })
.catch(err => {}) .catch(_err => {})
.finally(() => { .finally(() => {
setNotificationsLoading(false); setNotificationsLoading(false);
}); });
@ -303,7 +297,7 @@ export default function ObjectAlerts(props: Props) {
setRecentNotifications([...c]); setRecentNotifications([...c]);
} }
}) })
.catch(err => {}) .catch(_err => {})
.finally(() => { .finally(() => {
setNotificationsLoading(false); setNotificationsLoading(false);
}); });
@ -373,10 +367,10 @@ export default function ObjectAlerts(props: Props) {
}); });
interactionsAPI interactionsAPI
.addInteractionToComponents(compIds, newAlert) .addInteractionToComponents(compIds, newAlert)
.then(resp => { .then(_resp => {
openSnack("interaction added to selected components"); openSnack("interaction added to selected components");
}) })
.catch(err => { .catch(_err => {
openSnack("there was a problem adding the interaction to the selected components"); openSnack("there was a problem adding the interaction to the selected components");
}); });
setNewAlertOpen(false); setNewAlertOpen(false);

View file

@ -1,5 +1,4 @@
//import { Button, Grid, InputAdornment, TextField } from "@material-ui/core"; import { Button, Grid2 as Grid, InputAdornment, TextField } from "@mui/material";
import { Button, Grid, InputAdornment, TextField } from "@mui/material";
import SearchSelect, { Option } from "common/SearchSelect"; import SearchSelect, { Option } from "common/SearchSelect";
import { GrainOptions } from "grain"; import { GrainOptions } from "grain";
import { pond } from "protobuf-ts/pond"; import { pond } from "protobuf-ts/pond";
@ -77,7 +76,7 @@ export default function BulkBinSettings(props: Props) {
openSnack("Successfully updated " + resp.data.successfull + " bins"); openSnack("Successfully updated " + resp.data.successfull + " bins");
} }
}) })
.catch(err => { .catch(_err => {
openSnack("Failed to update bins"); openSnack("Failed to update bins");
}); });
}; };
@ -86,7 +85,7 @@ export default function BulkBinSettings(props: Props) {
<React.Fragment> <React.Fragment>
<Grid container direction="row" spacing={2} alignContent="center" alignItems="center"> <Grid container direction="row" spacing={2} alignContent="center" alignItems="center">
{/* first row */} {/* first row */}
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Bin Name" label="Bin Name"
@ -96,7 +95,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<SearchSelect <SearchSelect
label="Grain Type" label="Grain Type"
selected={grainOption} selected={grainOption}
@ -111,7 +110,7 @@ export default function BulkBinSettings(props: Props) {
options={GrainOptions()} options={GrainOptions()}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Grain Variant" label="Grain Variant"
@ -122,7 +121,7 @@ export default function BulkBinSettings(props: Props) {
/> />
</Grid> </Grid>
{/* second row */} {/* second row */}
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Custom Grain" label="Custom Grain"
@ -132,7 +131,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Bushels" label="Bushels"
@ -143,7 +142,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Capacity" label="Capacity"
@ -155,7 +154,7 @@ export default function BulkBinSettings(props: Props) {
/> />
</Grid> </Grid>
{/* last row */} {/* last row */}
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Bin Height" label="Bin Height"
@ -173,7 +172,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Bin Diameter" label="Bin Diameter"
@ -191,7 +190,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="High Temp Warning" label="High Temp Warning"
@ -211,7 +210,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<TextField <TextField
fullWidth fullWidth
label="Low Temp Warning" label="Low Temp Warning"
@ -231,7 +230,7 @@ export default function BulkBinSettings(props: Props) {
}} }}
/> />
</Grid> </Grid>
<Grid item xs={gridItemWidth}> <Grid size={{ xs: gridItemWidth }}>
<Button <Button
variant="contained" variant="contained"
color="primary" color="primary"

View file

@ -1,4 +1,3 @@
//import { Button, Grid, TextField } from "@material-ui/core";
import { Button, Grid2 as Grid, TextField } from "@mui/material"; import { Button, Grid2 as Grid, TextField } from "@mui/material";
import SearchSelect, { Option } from "common/SearchSelect"; import SearchSelect, { Option } from "common/SearchSelect";
import { GrainOptions } from "grain"; import { GrainOptions } from "grain";
@ -68,7 +67,7 @@ export default function BulkGrainBagSettings(props: Props) {
openSnack("Successfully updated " + resp.data.successfull + " bins"); openSnack("Successfully updated " + resp.data.successfull + " bins");
} }
}) })
.catch(err => { .catch(_err => {
openSnack("Failed to update bins"); openSnack("Failed to update bins");
}); });
}; };

View file

@ -28,16 +28,12 @@ import {
import BinActions from "bin/BinActions"; import BinActions from "bin/BinActions";
import BinHistory from "bin/BinHistory"; import BinHistory from "bin/BinHistory";
import { useComponentAPI, useMobile } from "hooks"; import { useComponentAPI, useMobile } from "hooks";
// import { useHistory } from "react-router";
import { Bin as IBin, binScope } from "models"; import { Bin as IBin, binScope } from "models";
// import { MatchParams } from "navigation/Routes";
import { pond, quack } from "protobuf-ts/pond"; import { pond, quack } from "protobuf-ts/pond";
import { useBinAPI, useGlobalState } from "providers"; import { useBinAPI, useGlobalState } from "providers";
import React, { useCallback, useEffect, useRef, useState } from "react"; import React, { useCallback, useEffect, useRef, useState } from "react";
// import { useRouteMatch } from "react-router";
import PageContainer from "./PageContainer"; import PageContainer from "./PageContainer";
import { Component, Device, Interaction } from "models"; import { Component, Device, Interaction } from "models";
// import { ToggleButton, ToggleButtonGroup } from "@material-ui/lab";
import BinLightIcon from "assets/products/bindapt/binLight.png"; import BinLightIcon from "assets/products/bindapt/binLight.png";
import BinDarkIcon from "assets/products/bindapt/binDark.png"; import BinDarkIcon from "assets/products/bindapt/binDark.png";
import NotesIcon from "@mui/icons-material/Notes"; import NotesIcon from "@mui/icons-material/Notes";
@ -214,7 +210,7 @@ export default function Bin(props: Props) {
const [binPresets, setBinPresets] = useState<DevicePreset[]>([]); const [binPresets, setBinPresets] = useState<DevicePreset[]>([]);
const [missedCableReadings, setMissedCableReadings] = useState(0); const [missedCableReadings, setMissedCableReadings] = useState(0);
const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => { const handleChange = (_event: React.ChangeEvent<{}>, newValue: number) => {
setValue(newValue); setValue(newValue);
}; };
@ -482,7 +478,7 @@ export default function Bin(props: Props) {
// return true; // return true;
// }; // };
const refresh = (showSnack?: boolean) => { const refresh = (_showSnack?: boolean) => {
// binAPI.getBin(bin.key()).then(resp => { // binAPI.getBin(bin.key()).then(resp => {
// let bin = IBin.any(resp.data); // let bin = IBin.any(resp.data);
// setBin(bin); // setBin(bin);

View file

@ -51,7 +51,6 @@ import BinUtilizationChart from "charts/BinUtilizationChart";
import GrainDescriber, { grainName } from "grain/GrainDescriber"; import GrainDescriber, { grainName } from "grain/GrainDescriber";
// import GrainBagList from "grainBag/grainBagList"; // import GrainBagList from "grainBag/grainBagList";
// import GrainBagSettings from "grainBag/grainBagSettings"; // import GrainBagSettings from "grainBag/grainBagSettings";
// import { ToggleButton, ToggleButtonGroup } from "@material-ui/lab";
import { useMobile, useWidth } from "hooks"; import { useMobile, useWidth } from "hooks";
import { Dictionary } from "lodash"; import { Dictionary } from "lodash";
// import { Bin, Interaction, BinYard as BinYardModel } from "models"; // import { Bin, Interaction, BinYard as BinYardModel } from "models";

View file

@ -1,5 +1,4 @@
// import Grid2 from "@material-ui/core/Grid2"; import {
import Graph, {
GraphComponent, GraphComponent,
GraphOrientation, GraphOrientation,
GraphPoint, GraphPoint,
@ -8,7 +7,6 @@ import Graph, {
} from "common/Graph"; } from "common/Graph";
import { Range } from "common/RangeInput"; import { Range } from "common/RangeInput";
import { Option } from "common/SearchSelect"; import { Option } from "common/SearchSelect";
import GPSMap from "component/GPS";
import { Interaction } from "models"; import { Interaction } from "models";
import { import {
AirQuality, AirQuality,
@ -48,7 +46,6 @@ import { multilineCapCableData } from "./ComponentTypes/CapacitorCable";
import { findInteractionsAsSource } from "pbHelpers/Interaction"; import { findInteractionsAsSource } from "pbHelpers/Interaction";
import { pond } from "protobuf-ts/pond"; import { pond } from "protobuf-ts/pond";
import { quack } from "protobuf-ts/quack"; import { quack } from "protobuf-ts/quack";
import React from "react";
import { notNull, or } from "utils/types"; import { notNull, or } from "utils/types";
import { emptyComponentId } from "./Component"; import { emptyComponentId } from "./Component";
@ -63,7 +60,6 @@ import { LineData, Point } from "charts/measurementCharts/MultiLineGraph";
import moment, { Moment } from "moment"; import moment, { Moment } from "moment";
import { avg } from "utils"; import { avg } from "utils";
import { Airflow } from "./ComponentTypes/Airflow"; import { Airflow } from "./ComponentTypes/Airflow";
import { Grid2 } from "@mui/material";
const COMPONENT_TYPE_MAP = new Map<quack.ComponentType, Function>([ const COMPONENT_TYPE_MAP = new Map<quack.ComponentType, Function>([
[quack.ComponentType.COMPONENT_TYPE_INVALID, Invalid], [quack.ComponentType.COMPONENT_TYPE_INVALID, Invalid],
@ -240,7 +236,7 @@ export function unitMeasurementSummary(
}); });
//if nodes are excluded splice them out of the val array so they are not displayed in the summary //if nodes are excluded splice them out of the val array so they are not displayed in the summary
if (excludedNodes) { if (excludedNodes) {
vals.forEach((val, i) => { vals.forEach((_val, i) => {
if (excludedNodes.includes(i)) { if (excludedNodes.includes(i)) {
vals.splice(i, 1); vals.splice(i, 1);
} }

110
src/pbHelpers/Fan.ts Normal file
View file

@ -0,0 +1,110 @@
import { pond } from "protobuf-ts/pond";
import { getThemeType } from "theme";
import inLineDarkIcon from "assets/components/inLineAerationDark.png";
import inLineLightIcon from "assets/components/inLineAerationLight.png";
import lowSpeedDark from "assets/components/lowSpeedCentrifugalFanDark.png";
import lowSpeedLight from "assets/components/lowSpeedCentrifugalFanLight.png";
import highSpeedDark from "assets/components/fullCentrifugalFanDark.png";
import highSpeedLight from "assets/components/fullCentrifugalFanLight.png";
interface FanSizeDescriber {
key: pond.FanHp;
label: string;
numerical: number;
}
const getFanSizeDescribers = (): FanSizeDescriber[] => {
return [
{ key: pond.FanHp.FAN_HP_UNKNOWN, label: "Unknown", numerical: 0 },
{ key: pond.FanHp.FAN_HP_THREE, label: "3HP", numerical: 3 },
{ key: pond.FanHp.FAN_HP_FIVE, label: "5HP", numerical: 5 },
{ key: pond.FanHp.FAN_HP_SEVENPOINTFIVE, label: "7HP", numerical: 7 },
{ key: pond.FanHp.FAN_HP_SEVEN, label: "7.5HP", numerical: 7.5 },
{ key: pond.FanHp.FAN_HP_TEN, label: "10HP", numerical: 10 },
{ key: pond.FanHp.FAN_HP_FIFTEEN, label: "15HP", numerical: 15 },
{ key: pond.FanHp.FAN_HP_TWENTY, label: "20HP", numerical: 20 },
{ key: pond.FanHp.FAN_HP_TWENTYFIVE, label: "25HP", numerical: 25 },
{ key: pond.FanHp.FAN_HP_THIRTY, label: "30HP", numerical: 30 }
];
};
interface FanTypeDescriber {
key: pond.FanType;
label: string;
sizes: pond.FanHp[];
}
const getFanTypeDescribers = (): FanTypeDescriber[] => {
return [
{ key: pond.FanType.FAN_TYPE_UNKNOWN, label: "Unknown", sizes: [] },
{
key: pond.FanType.FAN_TYPE_CENTRIFUGAL_INLINE,
label: "In-line Aeration",
sizes: [
pond.FanHp.FAN_HP_THREE,
pond.FanHp.FAN_HP_FIVE,
pond.FanHp.FAN_HP_SEVEN,
pond.FanHp.FAN_HP_TEN
]
},
{
key: pond.FanType.FAN_TYPE_CENTRIFUGAL_HIGH_SPEED,
label: "High Speed Centrifugal",
sizes: [
pond.FanHp.FAN_HP_THREE,
pond.FanHp.FAN_HP_FIVE,
pond.FanHp.FAN_HP_SEVENPOINTFIVE,
pond.FanHp.FAN_HP_TEN
]
},
{
key: pond.FanType.FAN_TYPE_CENTRIFUGAL_LOW_SPEED,
label: "Low Speed Centrifugal",
sizes: [
pond.FanHp.FAN_HP_FIVE,
pond.FanHp.FAN_HP_SEVENPOINTFIVE,
pond.FanHp.FAN_HP_TEN,
pond.FanHp.FAN_HP_FIFTEEN,
pond.FanHp.FAN_HP_TWENTY,
pond.FanHp.FAN_HP_TWENTYFIVE,
pond.FanHp.FAN_HP_THIRTY
]
}
];
};
export function GetFanTypes(): FanTypeDescriber[] {
return getFanTypeDescribers();
}
function getFanTypeDescriber(type: pond.FanType): FanTypeDescriber | undefined {
const fanTypes = getFanTypeDescribers();
return fanTypes.find(t => t.key === type);
}
export function GetFanTypeSizes(type: pond.FanType): FanSizeDescriber[] {
let options: FanSizeDescriber[] = [];
let typeDesc = getFanTypeDescriber(type);
if (typeDesc) {
let matches = typeDesc.sizes;
options = getFanSizeDescribers().filter(s => matches.includes(s.key));
}
return options;
}
export function getFanIcon(type: pond.FanType): string {
switch (type) {
case pond.FanType.FAN_TYPE_CENTRIFUGAL_INLINE:
if (getThemeType() === "light") return inLineLightIcon;
return inLineDarkIcon;
case pond.FanType.FAN_TYPE_CENTRIFUGAL_HIGH_SPEED:
if (getThemeType() === "light") return highSpeedLight;
return highSpeedDark;
case pond.FanType.FAN_TYPE_CENTRIFUGAL_LOW_SPEED:
if (getThemeType() === "light") return lowSpeedLight;
return lowSpeedDark;
}
return "";
}

View file

@ -1,5 +1,3 @@
//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 { Avatar, ButtonBase, Theme, Tooltip } from "@mui/material";
import { Tune as PresetsIcon, ViewList as ComponentsIcon } from "@mui/icons-material"; import { Tune as PresetsIcon, ViewList as ComponentsIcon } from "@mui/icons-material";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";

View file

@ -18,7 +18,6 @@ import {
ListItemText, ListItemText,
Tab, Tab,
Tabs, Tabs,
TextField,
Theme, Theme,
Tooltip, Tooltip,
Typography Typography
@ -29,7 +28,6 @@ import {
LinkOff, LinkOff,
RemoveCircle as RemoveCircleIcon RemoveCircle as RemoveCircleIcon
} from "@mui/icons-material"; } from "@mui/icons-material";
// import { MobileDateTimePicker } from "@material-ui/pickers";
import ResponsiveDialog from "common/ResponsiveDialog"; import ResponsiveDialog from "common/ResponsiveDialog";
import { usePermissionAPI, usePrevious, useSnackbar } from "hooks"; import { usePermissionAPI, usePrevious, useSnackbar } from "hooks";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";

View file

@ -12,7 +12,6 @@ import {
FormControlLabel, FormControlLabel,
FormGroup, FormGroup,
FormLabel, FormLabel,
Grid,
Grid2, Grid2,
IconButton, IconButton,
List, List,
@ -27,8 +26,6 @@ import {
Typography, Typography,
useTheme useTheme
} from "@mui/material"; } from "@mui/material";
// import { Theme } from "@material-ui/core/styles/createMuiTheme";
// import { PaletteColor } from "@material-ui/core/styles/createPalette";
import RemoveUserIcon from "@mui/icons-material/RemoveCircle"; import RemoveUserIcon from "@mui/icons-material/RemoveCircle";
import EditIcon from "@mui/icons-material/EditOutlined"; import EditIcon from "@mui/icons-material/EditOutlined";
import ShareIcon from "@mui/icons-material/Share"; import ShareIcon from "@mui/icons-material/Share";
@ -220,7 +217,7 @@ export default function ObjectUsers(props: Props) {
console.log(users); console.log(users);
permissionAPI permissionAPI
.updatePermissions(scope, users) .updatePermissions(scope, users)
.then((response: any) => { .then((_response: any) => {
success("Users were sucessfully updated for " + label); success("Users were sucessfully updated for " + label);
close(); close();
refreshCallback(); refreshCallback();

View file

@ -23,7 +23,6 @@ import CounterclockwiseIcon from "@mui/icons-material/RotateLeft";
import { useGlobalState, useMineAPI } from "providers"; import { useGlobalState, useMineAPI } from "providers";
import { Component, Device } from "models"; import { Component, Device } from "models";
import { Sensor } from "./drawable/Sensor"; import { Sensor } from "./drawable/Sensor";
// import { ToggleButton } from "@material-ui/lab";
import { VentTBreak } from "./drawable/VentTBreak"; import { VentTBreak } from "./drawable/VentTBreak";
import InteractionSettings from "interactions/InteractionSettings"; import InteractionSettings from "interactions/InteractionSettings";
import { UnitMeasurement } from "models/UnitMeasurement"; import { UnitMeasurement } from "models/UnitMeasurement";