fix(GenericNode/index.tsx): fix initial state of inputName to be false instead of true for better user experience

refactor(GenericNode/index.tsx): refactor tooltip div structure to improve readability and add pencil icon if node has flow
refactor(GenericNode/index.tsx): refactor color logic to use typesContext instead of accessing types directly
refactor(GenericNode/index.tsx): refactor output type title logic to use ternary operator for better readability
refactor(GenericNode/index.tsx): refactor validation status params rendering to use ternary operator for better readability
refactor(GenericNode/index.tsx): refactor generic node description rendering to use ternary operator for better readability
refactor(GenericNode/index.tsx): refactor template field rendering to use ternary operator for better readability
refactor(PageComponent/index.tsx): remove unnecessary empty line
This commit is contained in:
anovazzi1 2023-11-24 12:43:29 -03:00
commit 2438a8c658
2 changed files with 23 additions and 21 deletions

View file

@ -38,7 +38,7 @@ export default function GenericNode({
const { types, deleteNode, reactFlowInstance, setFilterEdge, getFilterEdge } = const { types, deleteNode, reactFlowInstance, setFilterEdge, getFilterEdge } =
useContext(typesContext); useContext(typesContext);
const name = nodeIconsLucide[data.type] ? data.type : types[data.type]; const name = nodeIconsLucide[data.type] ? data.type : types[data.type];
const [inputName, setInputName] = useState(true); const [inputName, setInputName] = useState(false);
const [nodeName, setNodeName] = useState(data.node!.display_name); const [nodeName, setNodeName] = useState(data.node!.display_name);
const [inputDescription, setInputDescription] = useState(false); const [inputDescription, setInputDescription] = useState(false);
const [nodeDescription, setNodeDescription] = useState( const [nodeDescription, setNodeDescription] = useState(
@ -198,12 +198,15 @@ export default function GenericNode({
</div> </div>
) : ( ) : (
<ShadTooltip content={data.node?.display_name}> <ShadTooltip content={data.node?.display_name}>
<div className="flex" onDoubleClick={() => setInputName(true)}>
<div <div
className="generic-node-tooltip-div text-primary" className="generic-node-tooltip-div text-primary pr-3"
onDoubleClick={() => setInputName(true)}
> >
{data.node?.display_name} {data.node?.display_name}
</div> </div>
{data.node?.flow&& <IconComponent name="Pencil" className="w-5 h-5 text-primary-content" />}
</div>
</ShadTooltip> </ShadTooltip>
)} )}
</div> </div>

View file

@ -145,7 +145,6 @@ export default function Page({
document.removeEventListener("mousemove", handleMouseMove); document.removeEventListener("mousemove", handleMouseMove);
}; };
}, [position, lastCopiedSelection, lastSelection]); }, [position, lastCopiedSelection, lastSelection]);
const [selectionMenuVisible, setSelectionMenuVisible] = useState(false); const [selectionMenuVisible, setSelectionMenuVisible] = useState(false);
const { setExtraComponent, setExtraNavigation } = useContext(locationContext); const { setExtraComponent, setExtraNavigation } = useContext(locationContext);