diff --git a/packages/builder/src/builderStore/componentUtils.js b/packages/builder/src/builderStore/componentUtils.js index 522dbae416..85171ece66 100644 --- a/packages/builder/src/builderStore/componentUtils.js +++ b/packages/builder/src/builderStore/componentUtils.js @@ -1,4 +1,5 @@ import { store } from "./index" +import { get } from "svelte/store" import { Helpers } from "@budibase/bbui" import { decodeJSBinding, @@ -238,6 +239,10 @@ export const makeComponentUnique = component => { } export const getComponentText = component => { + if (component == null) { + return "" + } + if (component?._instanceName) { return component._instanceName } @@ -246,3 +251,15 @@ export const getComponentText = component => { "component" return capitalise(type) } + +export const getComponentName = component => { + if (component == null) { + return "" + } + + const components = get(store)?.components || {}; + const componentDefinition = components[component._component] || {}; + const name = componentDefinition.friendlyName || componentDefinition.name || ""; + + return name; +} diff --git a/packages/builder/src/components/common/NavItem.svelte b/packages/builder/src/components/common/NavItem.svelte index 2c8a862535..5ec399a7ea 100644 --- a/packages/builder/src/components/common/NavItem.svelte +++ b/packages/builder/src/components/common/NavItem.svelte @@ -1,10 +1,11 @@ {#if $selectedComponent} {#key $selectedComponent._id} - + { if (e.key.toLowerCase() === "enter") { e.target.blur() diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte index 8adc6cb5d4..6b5d356deb 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte @@ -11,6 +11,7 @@ import { findComponentPath, getComponentText, + getComponentName, } from "builderStore/componentUtils" import { get } from "svelte/store" import { dndStore } from "./dndStore" @@ -109,6 +110,7 @@ on:drop={onDrop} text={getComponentText(component)} icon={getComponentIcon(component)} + iconTooltip={getComponentName(component)} withArrow={componentHasChildren(component)} indentLevel={level} selected={$store.selectedComponentId === component._id}