the component sets are being properly constructed and passed up to the mode dialog that will control adding the interactions to them
This commit is contained in:
parent
ea81610635
commit
393a2f77dc
4 changed files with 512 additions and 9 deletions
|
|
@ -74,6 +74,7 @@ import SearchSelect, { Option } from "common/SearchSelect";
|
|||
import Edit from "@mui/icons-material/Edit";
|
||||
import { makeStyles, styled } from "@mui/styles";
|
||||
import ButtonGroup from "common/ButtonGroup";
|
||||
import ModeChangeDialog from "./conditioning/modeChangeDialog";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => {
|
||||
return ({
|
||||
|
|
@ -256,7 +257,7 @@ export default function BinVisualizer(props: Props) {
|
|||
const [cfmLowOpen, setCFMLowOpen] = useState(false);
|
||||
const [cfmHighOpen, setCFMHighOpen] = useState(false);
|
||||
const [{ user }] = useGlobalState();
|
||||
const [newPreset, setNewPreset] = useState<pond.BinMode>(pond.BinMode.BIN_MODE_NONE);
|
||||
// const [newPreset, setNewPreset] = useState<pond.BinMode>(pond.BinMode.BIN_MODE_NONE);
|
||||
const [newBinMode, setNewBinMode] = useState<pond.BinMode>(pond.BinMode.BIN_MODE_NONE);
|
||||
const [selectedCable, setSelectedCable] = useState<GrainCable>();
|
||||
const [openNodeDialog, setOpenNodeDialog] = useState(false);
|
||||
|
|
@ -293,6 +294,8 @@ export default function BinVisualizer(props: Props) {
|
|||
const [activePlenumIndex, setActivePlenumIndex] = useState(0)
|
||||
const [combinedPlenums, setCombinedPlenums] = useState<CombinedPlenum[]>([])
|
||||
|
||||
const [openModeChange, setOpenModeChange] = useState(false)
|
||||
|
||||
// const StyledToggle = styled(ToggleButton)(({ theme }: { theme: Theme }) => ({
|
||||
// root: {
|
||||
// backgroundColor: "transparent",
|
||||
|
|
@ -373,7 +376,7 @@ export default function BinVisualizer(props: Props) {
|
|||
useEffect(() => {
|
||||
setIsCustomInventory(bin.storage() !== pond.BinStorage.BIN_STORAGE_SUPPORTED_GRAIN);
|
||||
setStorageType(bin.storage());
|
||||
setNewPreset(pond.BinMode.BIN_MODE_NONE);
|
||||
// setNewPreset(pond.BinMode.BIN_MODE_NONE);
|
||||
if (bin.settings.inventory) {
|
||||
setMoistureInput(bin.settings.inventory.initialMoisture.toString());
|
||||
setCustomTypeName(bin.settings.inventory.customTypeName);
|
||||
|
|
@ -2020,16 +2023,18 @@ export default function BinVisualizer(props: Props) {
|
|||
};
|
||||
|
||||
const setModeStorage = () => {
|
||||
setNewPreset(pond.BinMode.BIN_MODE_STORAGE);
|
||||
// setNewPreset(pond.BinMode.BIN_MODE_STORAGE);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_STORAGE);
|
||||
setOpenModeChange(true)
|
||||
};
|
||||
|
||||
const setModeCooldown = () => {
|
||||
if (bin.settings.mode === pond.BinMode.BIN_MODE_COOLDOWN) {
|
||||
return;
|
||||
}
|
||||
setNewPreset(pond.BinMode.BIN_MODE_COOLDOWN);
|
||||
// setNewPreset(pond.BinMode.BIN_MODE_COOLDOWN);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_COOLDOWN);
|
||||
setOpenModeChange(true)
|
||||
};
|
||||
|
||||
const setModeDrying = () => {
|
||||
|
|
@ -2037,16 +2042,17 @@ export default function BinVisualizer(props: Props) {
|
|||
bin.settings.inventory &&
|
||||
bin.settings.inventory?.initialMoisture < bin.settings.inventory?.targetMoisture
|
||||
) {
|
||||
setNewPreset(pond.BinMode.BIN_MODE_HYDRATING);
|
||||
// setNewPreset(pond.BinMode.BIN_MODE_HYDRATING);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_HYDRATING);
|
||||
} else {
|
||||
setNewPreset(pond.BinMode.BIN_MODE_DRYING);
|
||||
// setNewPreset(pond.BinMode.BIN_MODE_DRYING);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_DRYING);
|
||||
}
|
||||
setOpenModeChange(true)
|
||||
};
|
||||
|
||||
const closeMoistureDialog = () => {
|
||||
setNewPreset(0);
|
||||
// setNewPreset(0);
|
||||
setNewBinMode(bin.settings.mode);
|
||||
setShowInputMoisture(false);
|
||||
};
|
||||
|
|
@ -2107,7 +2113,7 @@ export default function BinVisualizer(props: Props) {
|
|||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setNewPreset(0);
|
||||
// setNewPreset(0);
|
||||
setNewBinMode(bin.settings.mode);
|
||||
setShowInputMoisture(false);
|
||||
}}
|
||||
|
|
@ -2170,7 +2176,7 @@ export default function BinVisualizer(props: Props) {
|
|||
{cfmHighDialog()}
|
||||
{changeGrain()}
|
||||
{storageTimeDialog()}
|
||||
<DevicePresetsFromPicker
|
||||
{/* <DevicePresetsFromPicker
|
||||
preferences={preferences}
|
||||
binKey={bin.key()}
|
||||
devices={devices}
|
||||
|
|
@ -2184,6 +2190,21 @@ export default function BinVisualizer(props: Props) {
|
|||
binCables={cables}
|
||||
compDevMap={componentDevices}
|
||||
presets={binPresets}
|
||||
/> */}
|
||||
<ModeChangeDialog
|
||||
binKey={bin.key()}
|
||||
binMode={newBinMode}
|
||||
devices={devices}
|
||||
open={openModeChange}
|
||||
binCables={cables}
|
||||
compDevMap={componentDevices}
|
||||
preferences={preferences}
|
||||
onClose={(refresh) => {
|
||||
setShowInputMoisture(false)
|
||||
setOpenModeChange(false)
|
||||
if(refresh) updateBin();
|
||||
}}
|
||||
|
||||
/>
|
||||
<Box paddingRight={1}>
|
||||
{binMode()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue