Formattef code

This commit is contained in:
Lucas Oliveira 2023-07-31 10:53:42 -03:00
commit ac46fff761
4 changed files with 14 additions and 23 deletions

View file

@ -13,7 +13,7 @@ import IntComponent from "../../../../components/intComponent";
import PromptAreaComponent from "../../../../components/promptComponent"; import PromptAreaComponent from "../../../../components/promptComponent";
import TextAreaComponent from "../../../../components/textAreaComponent"; import TextAreaComponent from "../../../../components/textAreaComponent";
import ToggleShadComponent from "../../../../components/toggleShadComponent"; import ToggleShadComponent from "../../../../components/toggleShadComponent";
import { MAX_LENGTH_TO_SCROLL_TOOLTIP, TOOLTIP_EMPTY } from "../../../../constants/constants"; import { TOOLTIP_EMPTY } from "../../../../constants/constants";
import { TabsContext } from "../../../../contexts/tabsContext"; import { TabsContext } from "../../../../contexts/tabsContext";
import { typesContext } from "../../../../contexts/typesContext"; import { typesContext } from "../../../../contexts/typesContext";
import { ParameterComponentType } from "../../../../types/components"; import { ParameterComponentType } from "../../../../types/components";
@ -23,10 +23,7 @@ import {
nodeIconsLucide, nodeIconsLucide,
nodeNames, nodeNames,
} from "../../../../utils/styleUtils"; } from "../../../../utils/styleUtils";
import { import { classNames, groupByFamily } from "../../../../utils/utils";
classNames,
groupByFamily,
} from "../../../../utils/utils";
export default function ParameterComponent({ export default function ParameterComponent({
left, left,
@ -151,9 +148,7 @@ export default function ParameterComponent({
); );
}); });
} else { } else {
refHtml.current = <span> refHtml.current = <span>{TOOLTIP_EMPTY}</span>;
{TOOLTIP_EMPTY}
</span>
} }
} }
@ -202,9 +197,7 @@ export default function ParameterComponent({
<></> <></>
) : ( ) : (
<ShadTooltip <ShadTooltip
styleClasses={ styleClasses={"tooltip-fixed-width custom-scroll nowheel"}
"tooltip-fixed-width custom-scroll nowheel"
}
delayDuration={0} delayDuration={0}
content={refHtml.current} content={refHtml.current}
side={left ? "left" : "right"} side={left ? "left" : "right"}

View file

@ -1,11 +1,10 @@
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import { useContext, useEffect, useRef, useState } from "react"; import { useContext, useEffect, useState } from "react";
import { NodeToolbar, useUpdateNodeInternals } from "reactflow"; import { NodeToolbar, useUpdateNodeInternals } from "reactflow";
import ShadTooltip from "../../components/ShadTooltipComponent"; import ShadTooltip from "../../components/ShadTooltipComponent";
import Tooltip from "../../components/TooltipComponent"; import Tooltip from "../../components/TooltipComponent";
import IconComponent from "../../components/genericIconComponent"; import IconComponent from "../../components/genericIconComponent";
import { useSSE } from "../../contexts/SSEContext"; import { useSSE } from "../../contexts/SSEContext";
import { alertContext } from "../../contexts/alertContext";
import { TabsContext } from "../../contexts/tabsContext"; import { TabsContext } from "../../contexts/tabsContext";
import { typesContext } from "../../contexts/typesContext"; import { typesContext } from "../../contexts/typesContext";
import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent"; import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent";

View file

@ -147,8 +147,7 @@ export const IMPORT_DIALOG_SUBTITLE =
* The text that shows when a tooltip is empty * The text that shows when a tooltip is empty
* @constant * @constant
*/ */
export const TOOLTIP_EMPTY = export const TOOLTIP_EMPTY = "No compatible components found.";
"No compatible components found.";
/** /**
* The base text for subtitle of code dialog * The base text for subtitle of code dialog

View file

@ -113,14 +113,14 @@ export function groupByFamily(data, baseClasses, left, flow?: NodeType[]) {
for (const node of flow) { for (const node of flow) {
const nodeData = node.data; const nodeData = node.data;
const foundNode = checkedNodes.get(nodeData.type); const foundNode = checkedNodes.get(nodeData.type);
checkedNodes.set(nodeData.type, { checkedNodes.set(nodeData.type, {
hasBaseClassInTemplate: checkedNodes.get(nodeData.type)?.hasBaseClassInTemplate || Object.values(nodeData.node.template).some( hasBaseClassInTemplate:
checkBaseClass checkedNodes.get(nodeData.type)?.hasBaseClassInTemplate ||
), Object.values(nodeData.node.template).some(checkBaseClass),
hasBaseClassInBaseClasses: checkedNodes.get(nodeData.type)?.hasBaseClassInBaseClasses || nodeData.node.base_classes.some((t) => hasBaseClassInBaseClasses:
baseClassesSet.has(t) checkedNodes.get(nodeData.type)?.hasBaseClassInBaseClasses ||
), nodeData.node.base_classes.some((t) => baseClassesSet.has(t)),
}); });
} }
} }