import {OverlayTrigger} from "react-bootstrap"; import React from "react"; import {v4 as uuidv4} from "uuid"; import {useRenderCount} from "@uidotdev/usehooks"; const resourcesWidthStyle = (occupied, max) => { return { width: `${Math.min(occupied * 100 / max, 100)}%`, } }; function EEMRenderer({occupied, max}) { return (
) } function ClockRenderer({occupied, max}) { return (
) } const resource_progress_renderers = { "eem": EEMRenderer, "clk": ClockRenderer, "idc": EEMRenderer } function EEMTipRender({occupied, max}) { return (

{`${occupied}/${max} EEM connectors used`}

); } function IDCTipRender({occupied, max}) { return (

{`${occupied}/${max} IDC connectors used`}

); } function ClockTipRender({occupied, max}) { return (

{`${occupied}/${max} clock connectors used`}

); } const resource_tip = { "eem": EEMTipRender, "clk": ClockTipRender, "idc": IDCTipRender } function RenderResources({resources, library}) { if (!resources) return null; let result = []; resources.forEach((value, _) => { if (library[value.name]) result.push(library[value.name](value)); }); return result; } export function Resources({resources}) { const renderCount = useRenderCount(); console.log("Resources renders: ", renderCount) return ( (
)} rootClose >
) }