Skip to content

Commit

Permalink
refactor rename all SourceLabelProps props
Browse files Browse the repository at this point in the history
  • Loading branch information
mnholtz committed Jul 2, 2024
1 parent 06ece22 commit 4e687f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { type TypedBrickMap } from "@/bricks/registry";
type SourceLabelProps = {
source: string;
extensionPointLabel: string;
nodeInfo: NodeInfo[];
allBlocks: TypedBrickMap;
nodes: NodeInfo[];
allBricks: TypedBrickMap;
};

const SourceLabel: React.FunctionComponent<SourceLabelProps> = ({
source,
extensionPointLabel,
nodeInfo,
allBlocks,
nodes,
allBricks,
}) => {
const [kind] = source.split(":");
let label: string;
Expand All @@ -42,14 +42,14 @@ const SourceLabel: React.FunctionComponent<SourceLabelProps> = ({
}

default: {
const blockConfig = nodeInfo.find((block) => block.path === source)
const brickConfig = nodes.find((node) => node.path === source)
?.blockConfig;
if (blockConfig == null) {
if (brickConfig == null) {
label = source;
} else {
label =
blockConfig.label ??
allBlocks.get(blockConfig.id)?.block?.name ??
brickConfig.label ??
allBricks.get(brickConfig.id)?.block?.name ??
source;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ const VarMenu: React.FunctionComponent<VarMenuProps> = ({
<SourceLabel
source={source}
extensionPointLabel={starterBrickLabel}
nodeInfo={blocksInfo}
allBlocks={allBricks}
nodes={blocksInfo}
allBricks={allBricks}
/>
<VariablesTree
vars={vars}
Expand All @@ -273,8 +273,8 @@ const VarMenu: React.FunctionComponent<VarMenuProps> = ({
<SourceLabel
source={source}
extensionPointLabel={starterBrickLabel}
nodeInfo={blocksInfo}
allBlocks={allBricks}
nodes={blocksInfo}
allBricks={allBricks}
/>
<VariablesTree
vars={filterVarMapByVariable(vars, likelyVariable)}
Expand Down

0 comments on commit 4e687f1

Please sign in to comment.