Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 33x 56x 56x 56x 56x 56x 168x 56x 2x 2x 2x 2x 2x 2x 2x 56x | import SelectInput from "@/ahuora-design-system/inputs/SelectInput";
import { useCoreSchemapropertysetUpdateHxTypeCreateMutation } from "@/api/apiStore.gen";
import { heatExchanger,heat_exchanger_ntu, heat_exchanger_lc} from "@/data/objects.json";
import { useCurrentObject } from "@/hooks/flowsheetObjects";
import React, { useState } from "react";
import { useSearchParams } from "react-router-dom";
import { ContentTypes } from "../../LeftSideBar/LeftSideBarTabDefinitions";
const objMap = {
heatExchanger: heatExchanger.displayType,
heat_exchanger_ntu: heat_exchanger_ntu.displayType,
heat_exchanger_lc: heat_exchanger_lc.displayType,
}
export function HXSettings() {
const currentSimulationObject = useCurrentObject()
const [changeHXType] = useCoreSchemapropertysetUpdateHxTypeCreateMutation()
//Declaring array and veriables for selecting turbine:
const configNameArray = Object.entries(objMap)
const [selectedType, setSelectedType] = React.useState(currentSimulationObject.objectType);
const [searchParams, setSearchParams] = useSearchParams();
// Format configArray for SelectInput
const selectData = configNameArray.map((obj, index) => ({
value: obj[0],
label: obj[1],
}));
//Create handle for selecting turbine type:
const handleSelectChange = async (value: string) => {
setSelectedType(value)
const result = await changeHXType({
updateHxRequest: {
hx_type: value,
simulation_object: currentSimulationObject.id
}
})
const newSearchParams = new URLSearchParams(searchParams);
const id = result.data
newSearchParams.set("object", id.toString());
newSearchParams.set("content", ContentTypes.objectDetails);
setSearchParams(newSearchParams);
};
//Display formatting:
return (
<SelectInput
title="Change Model Type"
value={selectedType}
data={selectData}
handleChange={handleSelectChange}
className={!selectedType ? "border-rose-700" : " "}
/>
);
}
|