mine editor opens
This commit is contained in:
parent
5fcb99ef40
commit
d945092b77
16 changed files with 159 additions and 108 deletions
58
src/common/DelayedTextInput.tsx
Normal file
58
src/common/DelayedTextInput.tsx
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
import {
|
||||||
|
FilledInputProps,
|
||||||
|
InputProps,
|
||||||
|
OutlinedInputProps,
|
||||||
|
TextField
|
||||||
|
} from "@mui/material";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
value: string;
|
||||||
|
onChange: React.Dispatch<React.SetStateAction<string>>;
|
||||||
|
delayMS?: number;
|
||||||
|
variant?: "standard" | "filled" | "outlined" | undefined;
|
||||||
|
title?: string;
|
||||||
|
size?: "small" | "medium" | undefined;
|
||||||
|
inputProps?:
|
||||||
|
| Partial<InputProps>
|
||||||
|
| Partial<FilledInputProps>
|
||||||
|
| Partial<OutlinedInputProps>
|
||||||
|
| undefined;
|
||||||
|
disabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DelayedTextField = (props: Props) => {
|
||||||
|
const { value, onChange, delayMS, variant, title, size, inputProps, disabled } = props;
|
||||||
|
|
||||||
|
const delay = delayMS ? delayMS : 1000;
|
||||||
|
const [inputValue, setInputValue] = useState(value);
|
||||||
|
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>(setTimeout(() => {}, 0));
|
||||||
|
|
||||||
|
//const timeout = useRef(null); //global variable
|
||||||
|
|
||||||
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||||
|
clearTimeout(timeoutId); // Clear previous timeout
|
||||||
|
const newValue = event.target.value;
|
||||||
|
setInputValue(newValue);
|
||||||
|
|
||||||
|
setTimeoutId(
|
||||||
|
setTimeout(() => {
|
||||||
|
onChange(newValue); // Update the value after the delay
|
||||||
|
}, delay)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TextField
|
||||||
|
value={inputValue}
|
||||||
|
variant={variant}
|
||||||
|
title={title}
|
||||||
|
InputProps={inputProps}
|
||||||
|
onChange={e => handleInputChange(e)}
|
||||||
|
size={size}
|
||||||
|
disabled={disabled}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DelayedTextField;
|
||||||
|
|
@ -6,6 +6,7 @@ import Header from "app/Header";
|
||||||
import Logout from "pages/Logout";
|
import Logout from "pages/Logout";
|
||||||
import { ErrorBoundary } from "react-error-boundary";
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
import { getWhitelabel } from "services/whiteLabel";
|
import { getWhitelabel } from "services/whiteLabel";
|
||||||
|
import Ventilation from "pages/VentEditor";
|
||||||
|
|
||||||
const DeviceHistory = lazy(() => import("pages/DeviceHistory"));
|
const DeviceHistory = lazy(() => import("pages/DeviceHistory"));
|
||||||
const DevicePage = lazy(() => import("pages/Device"));
|
const DevicePage = lazy(() => import("pages/Device"));
|
||||||
|
|
@ -133,22 +134,14 @@ export default function Router(props: Props) {
|
||||||
<Route
|
<Route
|
||||||
key="Mines page route"
|
key="Mines page route"
|
||||||
path="" // "/settings/basic"
|
path="" // "/settings/basic"
|
||||||
element={<Mines key={"Bins page"} />}
|
element={<Mines key={"Mines page"} />}
|
||||||
/>
|
|
||||||
{/* <Route
|
|
||||||
path="/:binID" // "/settings/basic"
|
|
||||||
element={<Bin />}
|
|
||||||
/> */}
|
|
||||||
{/* <Route
|
|
||||||
path="/:deviceID/components/:componentID" // "/settings/basic"
|
|
||||||
element={<DeviceComponent />}
|
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/:deviceID/history" // "/settings/basic"
|
path="/:mineKey" // "/settings/basic"
|
||||||
element={<DeviceHistory />}
|
element={<Ventilation />}
|
||||||
/> */}
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/:binID/*" // "/settings/basic"
|
path="/:mineKey/*" // "/settings/basic"
|
||||||
element={<RelativeRoutes />}
|
element={<RelativeRoutes />}
|
||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,18 @@
|
||||||
import SmartBreadcrumb from "common/SmartBreadcrumb";
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import PageContainer from "./PageContainer";
|
import PageContainer from "./PageContainer";
|
||||||
import {
|
import {
|
||||||
Theme,
|
Theme,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Chip,
|
Chip,
|
||||||
Box,
|
|
||||||
Grid2 as Grid,
|
|
||||||
useTheme,
|
|
||||||
Typography,
|
Typography,
|
||||||
Grid2,
|
Grid2,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { useMineAPI, useMobile } from "hooks";
|
import { useMineAPI } from "hooks";
|
||||||
// import { useHistory } from "react-router";
|
// import { useHistory } from "react-router";
|
||||||
import AddMine from "ventilation/AddMine";
|
import AddMine from "ventilation/AddMine";
|
||||||
import { Add } from "@mui/icons-material";
|
import { Add } from "@mui/icons-material";
|
||||||
import SearchBar from "common/SearchBar";
|
|
||||||
import { makeStyles, withStyles } from "@mui/styles";
|
import { makeStyles, withStyles } from "@mui/styles";
|
||||||
import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
@ -150,7 +145,6 @@ export default function Mines() {
|
||||||
const renderTitle = () => {
|
const renderTitle = () => {
|
||||||
return (
|
return (
|
||||||
<Grid2 container direction={"row"} spacing={1} alignContent={"center"}>
|
<Grid2 container direction={"row"} spacing={1} alignContent={"center"}>
|
||||||
{/* <Grid2 sx={{ border: "1px solid blue"}} alignContent={"center"}> */}
|
|
||||||
<Typography variant="h5">
|
<Typography variant="h5">
|
||||||
Mines
|
Mines
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
@ -159,9 +153,8 @@ export default function Mines() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClick = (data: MineRow) => {
|
const onRowClick = (data: MineRow) => {
|
||||||
const url = or(data.mine.settings?.key, "")
|
navigate(or(data.mine.settings?.key, ""))
|
||||||
navigate(url)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const minesTable = () => {
|
const minesTable = () => {
|
||||||
|
|
@ -178,7 +171,7 @@ export default function Mines() {
|
||||||
handleRowsPerPageChange={handleRowsPerPageChange}
|
handleRowsPerPageChange={handleRowsPerPageChange}
|
||||||
hideKeys
|
hideKeys
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
onRowClick={onClick}
|
onRowClick={onRowClick}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
import { IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Tooltip } from "@material-ui/core";
|
import {
|
||||||
import { AccountCircle, MoreVert, Settings } from "@material-ui/icons";
|
IconButton,
|
||||||
|
ListItemIcon,
|
||||||
|
ListItemText,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
Tooltip
|
||||||
|
} from "@mui/material";
|
||||||
|
import { AccountCircle, MoreVert, Settings } from "@mui/icons-material";
|
||||||
import { isOffline } from "utils/environment";
|
import { isOffline } from "utils/environment";
|
||||||
import { mineScope } from "models";
|
import { mineScope } from "models";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
|
|
@ -8,7 +15,7 @@ import ObjectUsers from "user/ObjectUsers";
|
||||||
import { or } from "utils";
|
import { or } from "utils";
|
||||||
import EditorSettings from "./EditorSettings";
|
import EditorSettings from "./EditorSettings";
|
||||||
import ObjectTeams from "teams/ObjectTeams";
|
import ObjectTeams from "teams/ObjectTeams";
|
||||||
import ObjectTeamsIcon from "@material-ui/icons/SupervisedUserCircle";
|
import ObjectTeamsIcon from "@mui/icons-material/SupervisedUserCircle";
|
||||||
import { useGlobalState } from "providers";
|
import { useGlobalState } from "providers";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
@ -37,7 +44,7 @@ export default function EditorActions(props: Props) {
|
||||||
disableAutoFocusItem>
|
disableAutoFocusItem>
|
||||||
{/* Users menu item */}
|
{/* Users menu item */}
|
||||||
{!isOffline() && canManageUsers && (
|
{!isOffline() && canManageUsers && (
|
||||||
<MenuItem onClick={() => setUserDialog(true)} button dense>
|
<MenuItem onClick={() => setUserDialog(true)} dense>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<AccountCircle />
|
<AccountCircle />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
|
@ -45,7 +52,7 @@ export default function EditorActions(props: Props) {
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{!isOffline() && canManageTeams && (
|
{!isOffline() && canManageTeams && (
|
||||||
<MenuItem onClick={() => setTeamDialog(true)} button dense>
|
<MenuItem onClick={() => setTeamDialog(true)} dense>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<ObjectTeamsIcon />
|
<ObjectTeamsIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { createStyles, makeStyles, Theme } from "@material-ui/core";
|
import { Theme } from "@mui/material";
|
||||||
import React from "react";
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const drawer = {
|
const drawer = {
|
||||||
"&": {
|
"&": {
|
||||||
|
|
@ -14,7 +14,7 @@ const drawer = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
drawer: {
|
drawer: {
|
||||||
...drawer,
|
...drawer,
|
||||||
height: "calc(100% - " + theme.spacing(7) + "px)",
|
height: "calc(100% - " + theme.spacing(7) + "px)",
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
import {
|
import {
|
||||||
createStyles,
|
|
||||||
Divider,
|
Divider,
|
||||||
Grid,
|
Grid2 as Grid,
|
||||||
IconButton,
|
IconButton,
|
||||||
makeStyles,
|
|
||||||
Theme,
|
Theme,
|
||||||
Typography,
|
Typography,
|
||||||
useTheme
|
useTheme
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import UndoIcon from "assets/editor/undo.png";
|
import UndoIcon from "assets/editor/undo.png";
|
||||||
import RedoIcon from "assets/editor/redo.png";
|
import RedoIcon from "assets/editor/redo.png";
|
||||||
|
|
@ -17,15 +15,16 @@ import DeleteIcon from "assets/editor/delete.png";
|
||||||
import { ImgIcon } from "common/ImgIcon";
|
import { ImgIcon } from "common/ImgIcon";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { useMineAPI, useSnackbar } from "providers";
|
import { useMineAPI, useSnackbar } from "providers";
|
||||||
import { Save, CloudDownload } from "@material-ui/icons";
|
import { Save, CloudDownload } from "@mui/icons-material";
|
||||||
import { Placeable } from "./drawable/Placeable";
|
import { Placeable } from "./drawable/Placeable";
|
||||||
import { Component } from "models";
|
import { Component } from "models";
|
||||||
import EditorActions from "./EditorActions";
|
import EditorActions from "./EditorActions";
|
||||||
import LoadMine from "./LoadMine";
|
import LoadMine from "./LoadMine";
|
||||||
import { Sensor } from "./drawable/Sensor";
|
import { Sensor } from "./drawable/Sensor";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
header: {
|
header: {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: theme.spacing(7),
|
height: theme.spacing(7),
|
||||||
|
|
@ -164,7 +163,7 @@ export default function EditorHeader(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container className={classes.header}>
|
<Grid container className={classes.header}>
|
||||||
<Grid item xs className={classes.leftButtons}>
|
<Grid className={classes.leftButtons}>
|
||||||
<Typography className={classes.leftButtons} variant="h6">
|
<Typography className={classes.leftButtons} variant="h6">
|
||||||
{mine.name ? mine.name : "No Name"}
|
{mine.name ? mine.name : "No Name"}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
@ -175,7 +174,7 @@ export default function EditorHeader(props: Props) {
|
||||||
<CloudDownload />
|
<CloudDownload />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs className={classes.middleButtons}>
|
<Grid className={classes.middleButtons}>
|
||||||
<div className={classes.middleButtons}>
|
<div className={classes.middleButtons}>
|
||||||
<IconButton onClick={undoRef.current ? (undoRef.current as any) : undefined}>
|
<IconButton onClick={undoRef.current ? (undoRef.current as any) : undefined}>
|
||||||
<ImgIcon src={UndoIcon} />
|
<ImgIcon src={UndoIcon} />
|
||||||
|
|
@ -197,7 +196,7 @@ export default function EditorHeader(props: Props) {
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs className={classes.rightButtons}>
|
<Grid className={classes.rightButtons}>
|
||||||
<div className={classes.rightButtons}>
|
<div className={classes.rightButtons}>
|
||||||
<EditorActions
|
<EditorActions
|
||||||
mine={mine}
|
mine={mine}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,24 @@
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
createStyles,
|
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
makeStyles,
|
|
||||||
TextField,
|
TextField,
|
||||||
Theme,
|
Theme,
|
||||||
Typography,
|
Typography,
|
||||||
Tooltip
|
Tooltip
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
import DeleteButton from "common/DeleteButton";
|
import DeleteButton from "common/DeleteButton";
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { useMineAPI, useSnackbar } from "providers";
|
import { useMineAPI, useSnackbar } from "providers";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useHistory } from "react-router";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
createStyles({
|
return ({
|
||||||
dialogContent: {
|
dialogContent: {
|
||||||
minHeight: "25vh"
|
minHeight: "25vh"
|
||||||
},
|
},
|
||||||
|
|
@ -27,7 +26,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||||
zIndex: theme.zIndex.modal + 1
|
zIndex: theme.zIndex.modal + 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
});
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
|
@ -44,7 +43,7 @@ export default function EditorSettings(props: Props) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const mineAPI = useMineAPI();
|
const mineAPI = useMineAPI();
|
||||||
const snackbar = useSnackbar();
|
const snackbar = useSnackbar();
|
||||||
const history = useHistory();
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const updateName = (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
|
const updateName = (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => {
|
||||||
setNameInput(event.currentTarget.value);
|
setNameInput(event.currentTarget.value);
|
||||||
|
|
@ -65,7 +64,7 @@ export default function EditorSettings(props: Props) {
|
||||||
setRemoveDialog(false);
|
setRemoveDialog(false);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
setMine(pond.MineSettings.create());
|
setMine(pond.MineSettings.create());
|
||||||
history.push("/mines");
|
navigate("/mines");
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
snackbar.error("Could not delete the mine");
|
snackbar.error("Could not delete the mine");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { createStyles, makeStyles, Theme, Tooltip } from "@material-ui/core";
|
import { Theme, Tooltip } from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import FansIcon from "assets/editor/fans.png";
|
import FansIcon from "assets/editor/fans.png";
|
||||||
import FansYellowIcon from "assets/editor/fansYellow.png";
|
import FansYellowIcon from "assets/editor/fansYellow.png";
|
||||||
|
|
@ -14,9 +14,10 @@ import DeviceDrawer from "./drawers/DeviceDrawer";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import SensorDrawer from "./drawers/SensorDrawer";
|
import SensorDrawer from "./drawers/SensorDrawer";
|
||||||
import { Component } from "models";
|
import { Component } from "models";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
sidebar: {
|
sidebar: {
|
||||||
maxHeight: "auto",
|
maxHeight: "auto",
|
||||||
width: theme.spacing(10),
|
width: theme.spacing(10),
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,26 @@ import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
createStyles,
|
|
||||||
DialogActions,
|
DialogActions,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
Divider,
|
Divider,
|
||||||
IconButton,
|
IconButton,
|
||||||
makeStyles,
|
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Select,
|
Select,
|
||||||
Theme,
|
Theme,
|
||||||
Typography
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { useMineAPI, useSnackbar } from "providers";
|
import { useMineAPI, useSnackbar } from "providers";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { or } from "utils";
|
import { or } from "utils";
|
||||||
import { loadPlaceable, Placeable } from "./drawable/Placeable";
|
import { loadPlaceable, Placeable } from "./drawable/Placeable";
|
||||||
import LeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
import LeftIcon from "@mui/icons-material/KeyboardArrowLeft";
|
||||||
import RightIcon from "@material-ui/icons/KeyboardArrowRight";
|
import RightIcon from "@mui/icons-material/KeyboardArrowRight";
|
||||||
import ResponsiveDialog from "common/ResponsiveDialog";
|
import ResponsiveDialog from "common/ResponsiveDialog";
|
||||||
import { useMobile } from "hooks";
|
import { useMobile } from "hooks";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
setMine: (value: React.SetStateAction<pond.MineSettings>) => void;
|
setMine: (value: React.SetStateAction<pond.MineSettings>) => void;
|
||||||
|
|
@ -34,7 +33,7 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
dialog: {
|
dialog: {
|
||||||
//width: theme.spacing(32)
|
//width: theme.spacing(32)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ import {
|
||||||
Select,
|
Select,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
useTheme
|
useTheme
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
import { Close } from "@material-ui/icons";
|
import { Close } from "@mui/icons-material";
|
||||||
import ResponsiveDialog from "common/ResponsiveDialog";
|
import ResponsiveDialog from "common/ResponsiveDialog";
|
||||||
import { useMobile } from "hooks";
|
import { useMobile } from "hooks";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { IconButton, InputAdornment, TextField, useTheme } from "@material-ui/core";
|
import { IconButton, InputAdornment, TextField, useTheme } from "@mui/material";
|
||||||
import { Add, Remove } from "@material-ui/icons";
|
import { Add, Remove } from "@mui/icons-material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,14 @@ import {
|
||||||
Box,
|
Box,
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
|
CardHeader,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
createStyles,
|
Grid2 as Grid,
|
||||||
Grid,
|
|
||||||
makeStyles,
|
|
||||||
Theme,
|
Theme,
|
||||||
Typography,
|
Typography,
|
||||||
useTheme
|
useTheme
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
import CardHeader from "@material-ui/core/CardHeader";
|
|
||||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { GetComponentIcon } from "pbHelpers/ComponentType";
|
import { GetComponentIcon } from "pbHelpers/ComponentType";
|
||||||
|
|
@ -24,7 +22,8 @@ import UnitMeasurementSummary from "component/UnitMeasurementSummary";
|
||||||
import { UnitMeasurement } from "models/UnitMeasurement";
|
import { UnitMeasurement } from "models/UnitMeasurement";
|
||||||
import { useGlobalState } from "providers";
|
import { useGlobalState } from "providers";
|
||||||
import DelayedTextField from "common/DelayedTextInput";
|
import DelayedTextField from "common/DelayedTextInput";
|
||||||
import { useHistory } from "react-router";
|
import { makeStyles } from "@mui/styles";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
deviceId: number;
|
deviceId: number;
|
||||||
|
|
@ -39,8 +38,8 @@ interface Props {
|
||||||
types?: string[];
|
types?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
createStyles({
|
return ({
|
||||||
avatarIcon: {
|
avatarIcon: {
|
||||||
width: theme.spacing(3),
|
width: theme.spacing(3),
|
||||||
height: theme.spacing(3)
|
height: theme.spacing(3)
|
||||||
|
|
@ -67,7 +66,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
});
|
||||||
|
|
||||||
export default function ComponentCards(props: Props) {
|
export default function ComponentCards(props: Props) {
|
||||||
const {
|
const {
|
||||||
|
|
@ -87,7 +86,7 @@ export default function ComponentCards(props: Props) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [{ user }] = useGlobalState();
|
const [{ user }] = useGlobalState();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const history = useHistory();
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const keys = props.keys ? props.keys : getContextKeys();
|
const keys = props.keys ? props.keys : getContextKeys();
|
||||||
const types = props.types ? props.types : getContextTypes();
|
const types = props.types ? props.types : getContextTypes();
|
||||||
|
|
@ -200,13 +199,13 @@ export default function ComponentCards(props: Props) {
|
||||||
<Typography
|
<Typography
|
||||||
className={classes.onHover}
|
className={classes.onHover}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.replace(
|
navigate(
|
||||||
history.location.pathname +
|
window.location.pathname +
|
||||||
"/devices/" +
|
"/devices/" +
|
||||||
deviceId +
|
deviceId +
|
||||||
"/components/" +
|
"/components/" +
|
||||||
component.key()
|
component.key()
|
||||||
);
|
, { replace: true });
|
||||||
}}>
|
}}>
|
||||||
{component.name()}
|
{component.name()}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
@ -252,7 +251,7 @@ export default function ComponentCards(props: Props) {
|
||||||
boxShadow: "inset 0px 0px 12px rgba(0,0,0,0.5)",
|
boxShadow: "inset 0px 0px 12px rgba(0,0,0,0.5)",
|
||||||
marginTop: i > 0 ? 10 : 0
|
marginTop: i > 0 ? 10 : 0
|
||||||
}}>
|
}}>
|
||||||
<Grid item xs={10}>
|
<Grid size={{ xs: 10 }}>
|
||||||
<Grid container direction="column">
|
<Grid container direction="column">
|
||||||
<DelayedTextField
|
<DelayedTextField
|
||||||
value={sensor.nickname}
|
value={sensor.nickname}
|
||||||
|
|
@ -277,21 +276,21 @@ export default function ComponentCards(props: Props) {
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid container spacing={1}>
|
<Grid container spacing={1}>
|
||||||
<Grid item style={{ marginLeft: 6 }}>
|
<Grid style={{ marginLeft: 6 }}>
|
||||||
<UnitMeasurementSummary
|
<UnitMeasurementSummary
|
||||||
component={component}
|
component={component}
|
||||||
reading={reading}
|
reading={reading}
|
||||||
dense
|
dense
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid >
|
||||||
<Typography variant={"caption"} style={{ fontSize: 12 }}>
|
<Typography variant={"caption"} style={{ fontSize: 12 }}>
|
||||||
{"(" + sensor.x + ", " + sensor.y + ")"}
|
{"(" + sensor.x + ", " + sensor.y + ")"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={2}>
|
<Grid size={{ xs: 2 }}>
|
||||||
<Box
|
<Box
|
||||||
display="flex"
|
display="flex"
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
|
|
@ -346,7 +345,7 @@ export default function ComponentCards(props: Props) {
|
||||||
}, [deviceId, componentAPI, showMobile, keys, types]);
|
}, [deviceId, componentAPI, showMobile, keys, types]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container direction="row" justify="flex-start" spacing={2}>
|
<Grid container direction="row" justifyContent="flex-start" spacing={2}>
|
||||||
{firstLoad ? (
|
{firstLoad ? (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|
|
||||||
|
|
@ -3,27 +3,26 @@ import {
|
||||||
Card,
|
Card,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
createStyles,
|
|
||||||
Divider,
|
Divider,
|
||||||
Grid,
|
Grid,
|
||||||
IconButton,
|
IconButton,
|
||||||
makeStyles,
|
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Select,
|
Select,
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
Theme,
|
Theme,
|
||||||
Typography
|
Typography
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
import DeviceIcon from "assets/editor/device.png";
|
import DeviceIcon from "assets/editor/device.png";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { useDeviceAPI, useMineAPI } from "hooks";
|
import { useDeviceAPI, useMineAPI } from "hooks";
|
||||||
import LeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
import LeftIcon from "@mui/icons-material/KeyboardArrowLeft";
|
||||||
import RightIcon from "@material-ui/icons/KeyboardArrowRight";
|
import RightIcon from "@mui/icons-material/KeyboardArrowRight";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
topText: {
|
topText: {
|
||||||
//textAlign: "center",
|
//textAlign: "center",
|
||||||
//alignContent: "center"
|
//alignContent: "center"
|
||||||
|
|
@ -246,7 +245,7 @@ export default function DeviceDrawer(props: Props) {
|
||||||
<div className={classes.bottom}>
|
<div className={classes.bottom}>
|
||||||
{offset + 1} - {devices.length + offset} of {total}
|
{offset + 1} - {devices.length + offset} of {total}
|
||||||
<div className={classes.bottomButtons}>
|
<div className={classes.bottomButtons}>
|
||||||
<Grid container justify="center">
|
<Grid container justifyContent="center">
|
||||||
<IconButton onClick={back} size="small">
|
<IconButton onClick={back} size="small">
|
||||||
<LeftIcon />
|
<LeftIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import { Card, createStyles, Divider, makeStyles, Theme, Typography } from "@material-ui/core";
|
import { Card, Divider, Theme, Typography } from "@mui/material";
|
||||||
import InlineIcon from "assets/editor/inlineCentrifugal.png";
|
import InlineIcon from "assets/editor/inlineCentrifugal.png";
|
||||||
import FullIcon from "assets/editor/fullCentrifugal.png";
|
import FullIcon from "assets/editor/fullCentrifugal.png";
|
||||||
import LowIcon from "assets/editor/lowCentrifugal.png";
|
import LowIcon from "assets/editor/lowCentrifugal.png";
|
||||||
import Fan1Icon from "assets/editor/fan1.png";
|
import Fan1Icon from "assets/editor/fan1.png";
|
||||||
import Fan2Icon from "assets/editor/fan2.png";
|
import Fan2Icon from "assets/editor/fan2.png";
|
||||||
import Fan3Icon from "assets/editor/fan3.png";
|
import Fan3Icon from "assets/editor/fan3.png";
|
||||||
import AddIcon from "@material-ui/icons/Add";
|
import AddIcon from "@mui/icons-material/Add";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Block } from "ventilation/drawable/Block";
|
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { VentShaft } from "ventilation/drawable/VentShaft";
|
import { VentShaft } from "ventilation/drawable/VentShaft";
|
||||||
import { VentCorner } from "ventilation/drawable/VentCorner";
|
import { VentCorner } from "ventilation/drawable/VentCorner";
|
||||||
import { VentTBreak } from "ventilation/drawable/VentTBreak";
|
import { VentTBreak } from "ventilation/drawable/VentTBreak";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const ducts = [
|
const ducts = [
|
||||||
{
|
{
|
||||||
|
|
@ -41,7 +41,7 @@ const ducts = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
topText: {
|
topText: {
|
||||||
//textAlign: "center",
|
//textAlign: "center",
|
||||||
//alignContent: "center"
|
//alignContent: "center"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
import { Card, createStyles, Divider, makeStyles, Theme, Typography } from "@material-ui/core";
|
import {
|
||||||
|
Card,
|
||||||
|
Divider,
|
||||||
|
Theme,
|
||||||
|
Typography
|
||||||
|
} from "@mui/material";
|
||||||
import InlineIcon from "assets/editor/inlineCentrifugal.png";
|
import InlineIcon from "assets/editor/inlineCentrifugal.png";
|
||||||
import FullIcon from "assets/editor/fullCentrifugal.png";
|
import FullIcon from "assets/editor/fullCentrifugal.png";
|
||||||
import LowIcon from "assets/editor/lowCentrifugal.png";
|
import LowIcon from "assets/editor/lowCentrifugal.png";
|
||||||
import Fan1Icon from "assets/editor/fan1.png";
|
import Fan1Icon from "assets/editor/fan1.png";
|
||||||
import Fan2Icon from "assets/editor/fan2.png";
|
import Fan2Icon from "assets/editor/fan2.png";
|
||||||
import Fan3Icon from "assets/editor/fan3.png";
|
import Fan3Icon from "assets/editor/fan3.png";
|
||||||
import AddIcon from "@material-ui/icons/Add";
|
import AddIcon from "@mui/icons-material/Add";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Fan } from "ventilation/drawable/Fan";
|
import { Fan } from "ventilation/drawable/Fan";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const fans = [
|
const fans = [
|
||||||
{
|
{
|
||||||
|
|
@ -37,7 +43,7 @@ const fans = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
topText: {
|
topText: {
|
||||||
//textAlign: "center",
|
//textAlign: "center",
|
||||||
//alignContent: "center"
|
//alignContent: "center"
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,31 @@
|
||||||
import {
|
import {
|
||||||
Collapse,
|
Collapse,
|
||||||
createStyles,
|
|
||||||
Divider,
|
Divider,
|
||||||
Grid,
|
Grid2 as Grid,
|
||||||
IconButton,
|
IconButton,
|
||||||
List,
|
List,
|
||||||
ListItem,
|
ListItemButton,
|
||||||
ListItemIcon,
|
ListItemIcon,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
makeStyles,
|
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Select,
|
Select,
|
||||||
Theme,
|
Theme,
|
||||||
Typography,
|
Typography,
|
||||||
useTheme
|
useTheme
|
||||||
} from "@material-ui/core";
|
} from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import LeftIcon from "@material-ui/icons/KeyboardArrowLeft";
|
import LeftIcon from "@mui/icons-material/KeyboardArrowLeft";
|
||||||
import RightIcon from "@material-ui/icons/KeyboardArrowRight";
|
import RightIcon from "@mui/icons-material/KeyboardArrowRight";
|
||||||
import { ExpandLess, ExpandMore } from "@material-ui/icons";
|
import { ExpandLess, ExpandMore } from "@mui/icons-material";
|
||||||
import DeviceIcon from "assets/editor/device.png";
|
import DeviceIcon from "assets/editor/device.png";
|
||||||
import { ImgIcon } from "common/ImgIcon";
|
import { ImgIcon } from "common/ImgIcon";
|
||||||
import ComponentCards from "./ComponentCards";
|
import ComponentCards from "./ComponentCards";
|
||||||
import { Component } from "models";
|
import { Component } from "models";
|
||||||
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => {
|
const useStyles = makeStyles((theme: Theme) => {
|
||||||
return createStyles({
|
return ({
|
||||||
topText: {
|
topText: {
|
||||||
//textAlign: "center",
|
//textAlign: "center",
|
||||||
//alignContent: "center"
|
//alignContent: "center"
|
||||||
|
|
@ -148,8 +147,7 @@ export default function SensorDrawer(props: Props) {
|
||||||
{selectedDevices.map((device: pond.Device) => {
|
{selectedDevices.map((device: pond.Device) => {
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={device.settings?.deviceId}>
|
<React.Fragment key={device.settings?.deviceId}>
|
||||||
<ListItem
|
<ListItemButton
|
||||||
button
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (device.settings?.deviceId === expanded) {
|
if (device.settings?.deviceId === expanded) {
|
||||||
setExpanded(0);
|
setExpanded(0);
|
||||||
|
|
@ -168,7 +166,7 @@ export default function SensorDrawer(props: Props) {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{device.settings?.deviceId === expanded ? <ExpandLess /> : <ExpandMore />}
|
{device.settings?.deviceId === expanded ? <ExpandLess /> : <ExpandMore />}
|
||||||
</ListItem>
|
</ListItemButton>
|
||||||
<Collapse in={device.settings?.deviceId === expanded} timeout="auto" unmountOnExit>
|
<Collapse in={device.settings?.deviceId === expanded} timeout="auto" unmountOnExit>
|
||||||
{device.settings?.deviceId === expanded && (
|
{device.settings?.deviceId === expanded && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|
@ -195,7 +193,7 @@ export default function SensorDrawer(props: Props) {
|
||||||
<div className={classes.bottom}>
|
<div className={classes.bottom}>
|
||||||
{offset + 1} - {limit + offset} of {selectedDevices.length}
|
{offset + 1} - {limit + offset} of {selectedDevices.length}
|
||||||
<div className={classes.bottomButtons}>
|
<div className={classes.bottomButtons}>
|
||||||
<Grid container justify="center">
|
<Grid container justifyContent="center">
|
||||||
<IconButton onClick={back} size="small">
|
<IconButton onClick={back} size="small">
|
||||||
<LeftIcon />
|
<LeftIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue