diff --git a/modules/code-builder/playground/pages/WorkSpace/BrickFactory.tsx b/modules/code-builder/playground/pages/WorkSpace/BrickFactory.tsx index 233ab08d..dcb20494 100644 --- a/modules/code-builder/playground/pages/WorkSpace/BrickFactory.tsx +++ b/modules/code-builder/playground/pages/WorkSpace/BrickFactory.tsx @@ -29,7 +29,6 @@ const BrickFactory = ({ brickData }: { brickData: Brick }) => { setCoords(brickData.id, { x: clampX(newX), y: clampY(newY) }); brickData.childBricks.forEach((childBrick) => { - console.log(childBrick); const childBrickCoords = getCoords(childBrick)!; setCoords(childBrick, { x: childBrickCoords.x + e.deltaX, @@ -69,41 +68,118 @@ const BrickFactory = ({ brickData }: { brickData: Brick }) => { }, }); - switch (brickData.type) { - case 'data': - return ( - - ); - case 'expression': - return ( - ( + <> + {/* Right args bounding box */} + {'bBoxArgs' in brickData.instance && ( + <> + {Object.keys(brickData.instance.bBoxArgs).map((name, i) => { + if ('bBoxArgs' in brickData.instance) { + const arg = brickData.instance.bBoxArgs[name]; + + return ( + + ); + } + })} + + )} + + {/* Top instruction notch bounding box */} + {'bBoxNotchInsTop' in brickData.instance && ( + - ); - case 'statement': - return ( - - ); - case 'block': - return ( - - ); - default: - return <>; - } + )} + + ); + + const getBrick = () => { + switch (brickData.type) { + case 'data': + return ( + + ); + case 'expression': + return ( + + ); + case 'statement': + return ( + + ); + case 'block': + return ( + + ); + default: + return <>; + } + }; + + return ( + <> + + {/* {getBrick()} */} + + ); }; export default BrickFactory; diff --git a/modules/code-builder/playground/pages/WorkSpace/data.ts b/modules/code-builder/playground/pages/WorkSpace/data.ts index 768712a2..b29701c4 100644 --- a/modules/code-builder/playground/pages/WorkSpace/data.ts +++ b/modules/code-builder/playground/pages/WorkSpace/data.ts @@ -1,16 +1,19 @@ -import { - ModelBrickBlock, - ModelBrickData, - ModelBrickExpression, - ModelBrickStatement, -} from '@/brick'; -import type { TBrickType, TBrickCoords, TBrickArgDataType } from '@/@types/brick'; +import { ModelBrickBlock, ModelBrickStatement } from '@/brick'; +import type { + TBrickType, + TBrickCoords, + TBrickArgDataType, + IBrickData, + IBrickExpression, + IBrickStatement, + IBrickBlock, +} from '@/@types/brick'; type InstanceMap = { - data: ModelBrickData; - expression: ModelBrickExpression; - statement: ModelBrickStatement; - block: ModelBrickBlock; + data: IBrickData; + expression: IBrickExpression; + statement: IBrickStatement; + block: IBrickBlock; }; export type Brick = {