🔨 refactor(tabsContext.tsx): improve code readability by adding whitespace and consistent formatting
The code has been refactored to improve readability by adding whitespace and consistent formatting. The function names have been updated to use camelCase for consistency. The updateDisplay_name function has been updated to use a logical OR operator instead of a ternary operator for better readability. The updateNodeDocumentation function has been added to update the node documentation. The updateNodeBaseClasses, updateNodeEdges, updateNodeDescription, and updateNodeTemplate functions have been updated to use consistent parameter names and whitespace.
This commit is contained in:
parent
f52feac7e5
commit
99f0b803e9
1 changed files with 20 additions and 10 deletions
|
|
@ -198,8 +198,13 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
edge.style = { stroke: "#555555" };
|
edge.style = { stroke: "#555555" };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDisplay_name(node: NodeType, template: APIClassType) {
|
function updateDisplay_name(node: NodeType, template: APIClassType) {
|
||||||
node.data.node.display_name = template["display_name"]?template["display_name"]:node.data.type;
|
node.data.node.display_name = template["display_name"] || node.data.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateNodeDocumentation(node: NodeType, template: APIClassType) {
|
||||||
|
node.data.node.documentation = template["documentation"];
|
||||||
}
|
}
|
||||||
|
|
||||||
function processFlowNodes(flow) {
|
function processFlowNodes(flow) {
|
||||||
|
|
@ -216,6 +221,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
updateNodeEdges(flow, node, template);
|
updateNodeEdges(flow, node, template);
|
||||||
updateNodeDescription(node, template);
|
updateNodeDescription(node, template);
|
||||||
updateNodeTemplate(node, template);
|
updateNodeTemplate(node, template);
|
||||||
|
updateNodeDocumentation(node, template);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +230,11 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
node.data.node.base_classes = template["base_classes"];
|
node.data.node.base_classes = template["base_classes"];
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNodeEdges(flow:FlowType, node:NodeType,template:APIClassType) {
|
function updateNodeEdges(
|
||||||
|
flow: FlowType,
|
||||||
|
node: NodeType,
|
||||||
|
template: APIClassType
|
||||||
|
) {
|
||||||
flow.data.edges.forEach((edge) => {
|
flow.data.edges.forEach((edge) => {
|
||||||
if (edge.source === node.id) {
|
if (edge.source === node.id) {
|
||||||
edge.sourceHandle = edge.sourceHandle
|
edge.sourceHandle = edge.sourceHandle
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue