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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 34x 34x 26x 34x 60x 42x 24x 10x 86x 86x 86x 86x 1x 3x 3x 86x 86x 7x 7x 7x 86x 96x 188x 188x 188x 22x 188x 210x 206x 324x 306x 306x 27x 306x 333x 325x | import React, { useRef, useState } from "react";
import {
usePinchHenNodeListQuery,
usePinchStreamDataEntryListQuery,
useUnitopsSimulationobjectsRetrieveQuery,
} from "@/api/apiStore.gen";
import { useCurrentStreamDataProjectID } from "./PinchHooks";
// Fetch a simulation object by id without reading search params.
export function useNodeObject(objectId) {
const { data: object } = useUnitopsSimulationobjectsRetrieveQuery(
{
id: +objectId!,
},
{ skip: !objectId },
);
if (!objectId) {
return undefined;
}
return object;
}
// to getsizes
export function useElementSize<T extends HTMLElement>() {
const ref = useRef<T | null>(null);
const [size, setSize] = useState({ width: 0, height: 0 });
const setRef = (node: T | null) => {
Iif (ref.current) observer.disconnect(); // cleanup previous
if (node) {
ref.current = node;
observer.observe(node); // observe new
}
};
const observer = useRef<ResizeObserver>(
new ResizeObserver(([entry]) => {
const { width, height } = entry.contentRect;
setSize({ width, height });
}),
).current;
return [setRef, size] as const;
}
/**
* Gets the input/output streams related to the selected flowsheet as one continuous stream.
* @returns All StreamDataEntries of type StreamDataEntryRead[]
*/
export function useCurrentStreamDataEntries() {
const project = useCurrentStreamDataProjectID();
const {
data: streams,
isLoading,
isError,
refetch,
} = usePinchStreamDataEntryListQuery(
{
streamDataProject: +project,
},
{ skip: !project },
);
return { streams, isLoading, isError, refetch };
}
export function useCurrentHenNodes() {
const project = useCurrentStreamDataProjectID();
return usePinchHenNodeListQuery(
{
projectOwner: +project,
},
{ skip: !project },
);
}
|