= ({
},
);
- if (documentBuilderBranch == null) {
+ if (documentBuilderSubtree == null) {
return null;
}
- const { Component, props } = documentBuilderBranch;
+ const { Component, props } = documentBuilderSubtree;
// eslint-disable-next-line react/no-array-index-key -- They have no other unique identifier
return ;
})}
diff --git a/src/pageEditor/documentBuilder/documentBuilderTypes.ts b/src/pageEditor/documentBuilder/documentBuilderTypes.ts
index c45cc47a7c..a2e0ca27ab 100644
--- a/src/pageEditor/documentBuilder/documentBuilderTypes.ts
+++ b/src/pageEditor/documentBuilder/documentBuilderTypes.ts
@@ -145,7 +145,7 @@ export type DynamicPath = {
}>;
};
-export type BuildDocumentBuilderBranch = (
+export type BuildDocumentBuilderSubtree = (
root: DocumentBuilderElement,
tracePath: DynamicPath,
) => DocumentBuilderComponent | null;
diff --git a/src/pageEditor/documentBuilder/documentTree.test.tsx b/src/pageEditor/documentBuilder/documentTree.test.tsx
index f6aa26a75f..e777246843 100644
--- a/src/pageEditor/documentBuilder/documentTree.test.tsx
+++ b/src/pageEditor/documentBuilder/documentTree.test.tsx
@@ -23,7 +23,7 @@ import blockRegistry from "@/bricks/registry";
import MarkdownRenderer from "@/bricks/renderers/MarkdownRenderer";
import * as contentScriptAPI from "@/contentScript/messenger/api";
import { uuidv4 } from "@/types/helpers";
-import { buildDocumentBuilderBranch } from "./documentTree";
+import { buildDocumentBuilderSubtree } from "./documentTree";
import {
type DocumentBuilderElement,
type DocumentBuilderElementType,
@@ -46,7 +46,7 @@ describe("When rendered in panel", () => {
});
const renderDocument = (config: DocumentBuilderElement) => {
- const branch = buildDocumentBuilderBranch(config, {
+ const branch = buildDocumentBuilderSubtree(config, {
staticId: "body",
branches: [],
});
diff --git a/src/pageEditor/documentBuilder/documentTree.tsx b/src/pageEditor/documentBuilder/documentTree.tsx
index d327b357fa..bc167765c4 100644
--- a/src/pageEditor/documentBuilder/documentTree.tsx
+++ b/src/pageEditor/documentBuilder/documentTree.tsx
@@ -20,7 +20,7 @@ import BlockElement from "@/pageEditor/documentBuilder/render/BlockElement";
import { get } from "lodash";
import { Col, Container, Row, Image } from "react-bootstrap";
import {
- type BuildDocumentBuilderBranch,
+ type BuildDocumentBuilderSubtree,
type ButtonElementConfig,
type DocumentBuilderComponent,
type DocumentBuilderElement,
@@ -59,7 +59,7 @@ const UnknownType: React.FC<{ componentType: string }> = ({
Unknown component type: {componentType}
);
-export const buildDocumentBuilderBranch: BuildDocumentBuilderBranch = (
+export const buildDocumentBuilderSubtree: BuildDocumentBuilderSubtree = (
root,
tracePath,
) => {
@@ -84,16 +84,16 @@ export const buildDocumentBuilderBranch: BuildDocumentBuilderBranch = (
) {
documentBuilderComponent.props.children = root.children.map(
(child, index) => {
- const branch = buildDocumentBuilderBranch(child, {
+ const subtree = buildDocumentBuilderSubtree(child, {
staticId: joinPathParts(staticId, root.type, "children"),
branches: [...branches, { staticId, index }],
});
- if (branch == null) {
+ if (subtree == null) {
return null;
}
- const { Component, props } = branch;
+ const { Component, props } = subtree;
// eslint-disable-next-line react/no-array-index-key -- They have no other unique identifier
return ;
},
@@ -265,7 +265,7 @@ export function getDocumentBuilderComponent(
elementKey: config.elementKey,
config: config.element,
tracePath,
- buildDocumentBuilderBranch,
+ buildDocumentBuilderSubtree,
};
return {
diff --git a/src/pageEditor/documentBuilder/render/ListElement.tsx b/src/pageEditor/documentBuilder/render/ListElement.tsx
index 5828cb9749..913d6182f8 100644
--- a/src/pageEditor/documentBuilder/render/ListElement.tsx
+++ b/src/pageEditor/documentBuilder/render/ListElement.tsx
@@ -20,7 +20,7 @@ import DocumentContext from "./DocumentContext";
import { type Args } from "@/runtime/mapArgs";
import Loader from "@/components/Loader";
import {
- type BuildDocumentBuilderBranch,
+ type BuildDocumentBuilderSubtree,
type DocumentBuilderElement,
type DynamicPath,
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
@@ -41,7 +41,7 @@ type DocumentListProps = {
array: UnknownObject[];
elementKey?: string;
config: Args;
- buildDocumentBuilderBranch: BuildDocumentBuilderBranch;
+ buildDocumentBuilderSubtree: BuildDocumentBuilderSubtree;
tracePath: DynamicPath;
};
@@ -51,7 +51,7 @@ const ListElementInternal: React.FC = ({
array = DEFAULT_ARRAY,
elementKey,
config,
- buildDocumentBuilderBranch,
+ buildDocumentBuilderSubtree,
tracePath,
}) => {
const { staticId, branches } = tracePath;
@@ -138,7 +138,7 @@ const ListElementInternal: React.FC = ({
<>
{rootDefinitions?.map(({ documentElement, elementContext }, index) => {
const { Component, props } =
- buildDocumentBuilderBranch(
+ buildDocumentBuilderSubtree(
documentElement as DocumentBuilderElement,
{
staticId: joinPathParts(staticId, "list", "children"),
diff --git a/src/pageEditor/exampleStarterBrickConfigs.ts b/src/pageEditor/exampleStarterBrickConfigs.ts
index ae4476e35f..a73a3742c2 100644
--- a/src/pageEditor/exampleStarterBrickConfigs.ts
+++ b/src/pageEditor/exampleStarterBrickConfigs.ts
@@ -26,17 +26,17 @@ const quickbarActionId = validateRegistryId("@pixiebrix/quickbar/add");
export function getExampleBrickPipeline(type: StarterBrickType): BrickPipeline {
if (type === "actionPanel") {
- const documentBuilderBlock = createNewConfiguredBrick(documentBrickId);
- return [documentBuilderBlock];
+ const documentBuilderBrick = createNewConfiguredBrick(documentBrickId);
+ return [documentBuilderBrick];
}
if (type === "quickBarProvider") {
- const quickbarActionBlock = createNewConfiguredBrick(quickbarActionId);
- quickbarActionBlock.config = {
+ const quickbarActionBrick = createNewConfiguredBrick(quickbarActionId);
+ quickbarActionBrick.config = {
title: "Example Action",
action: toExpression("pipeline", []),
};
- return [quickbarActionBlock];
+ return [quickbarActionBrick];
}
return [];