Skip to content

Commit

Permalink
break stuff out
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Sep 15, 2023
1 parent 53e48b3 commit 02bf6ce
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 299 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const MeasureWidth = styled.div`
height: 0;
overflow: hidden;
white-space: nowrap;
user-select: none;
visibility: hidden;
`;

const Container = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const TextInputContainerStyles = css`
position: relative;
`;

export const TextInputContainer = styled.div<{$disabled: boolean}>`
export const TextInputContainer = styled.div<{$disabled?: boolean}>`
${TextInputContainerStyles}
> ${IconWrapper}:first-child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ const AssetGraphExplorerWithData: React.FC<WithDataProps> = ({
);
},
[
assetGraphData,
explorerPath,
findAssetLocation,
layout?.nodes,
onChangeExplorerPath,
onNavigateToSourceAssetNode,
findAssetLocation,
selectedGraphNodes,
assetGraphData,
layout,
],
);

Expand Down Expand Up @@ -266,18 +266,22 @@ const AssetGraphExplorerWithData: React.FC<WithDataProps> = ({
selectNodeById(e, nextId);
};

const selectNodeById = (e: React.MouseEvent<any> | React.KeyboardEvent<any>, nodeId?: string) => {
if (!nodeId) {
return;
}
const node = assetGraphData.nodes[nodeId];
if (node) {
onSelectNode(e, node.assetKey, node);
if (layout && viewportEl.current) {
viewportEl.current.zoomToSVGBox(layout.nodes[nodeId]!.bounds, true);
const selectNodeById = React.useCallback(
(e: React.MouseEvent<any> | React.KeyboardEvent<any>, nodeId?: string) => {
if (!nodeId) {
return;
}
}
};
const node = assetGraphData.nodes[nodeId];
if (node) {
onSelectNode(e, node.assetKey, node);
if (layout && viewportEl.current) {
viewportEl.current.zoomToSVGBox(layout.nodes[nodeId]!.bounds, true);
}
}
},
[assetGraphData.nodes, layout, onSelectNode],
);

React.useEffect(() => {
if (layout && lastSelectedNode) {
selectNodeById({stopPropagation: () => {}} as any, lastSelectedNode.id);
Expand All @@ -296,7 +300,12 @@ const AssetGraphExplorerWithData: React.FC<WithDataProps> = ({
<AssetGraphExplorerSidebar
assetGraphData={assetGraphData}
lastSelectedNode={lastSelectedNode}
selectNode={selectNodeById}
selectNode={React.useCallback(
(e, nodeId) => {
selectNodeById(e, nodeId);
},
[selectNodeById],
)}
/>
}
second={
Expand Down
Loading

0 comments on commit 02bf6ce

Please sign in to comment.