Update title in component settings panel and fix issue when components are not selected

This commit is contained in:
Andrew Kingston 2022-04-26 14:40:29 +01:00
parent 380670b27e
commit c5c6f57fed
2 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,6 @@
<script>
import SettingsPanel from "components/design/settings/SettingsPanel.svelte"
import { store, selectedComponent, currentAsset } from "builderStore"
import { store, selectedComponent, selectedScreen } from "builderStore"
import ComponentSettingsSection from "./ComponentSettingsSection.svelte"
import DesignSection from "./DesignSection.svelte"
import CustomStylesSection from "./CustomStylesSection.svelte"
@ -14,23 +14,26 @@
$: componentDefinition = store.actions.components.getDefinition(
$selectedComponent?._component
)
$: bindings = getBindableProperties($currentAsset, $store.selectedComponentId)
$: componentBindings = getComponentBindableProperties(
$currentAsset,
$: bindings = getBindableProperties(
$selectedScreen,
$store.selectedComponentId
)
$: componentBindings = getComponentBindableProperties(
$selectedScreen,
$store.selectedComponentId
)
$: isScreen = $selectedComponent?._id === $selectedScreen?.props._id
$: title = isScreen ? "Screen" : $selectedComponent?._instanceName
</script>
{#if $selectedComponent}
<SettingsPanel
title={$selectedComponent._instanceName}
icon={componentDefinition.icon}
>
<SettingsPanel {title} icon={componentDefinition.icon}>
<ComponentSettingsSection
{componentInstance}
{componentDefinition}
{bindings}
{componentBindings}
{isScreen}
/>
<DesignSection {componentInstance} {componentDefinition} {bindings} />
<CustomStylesSection {componentInstance} {componentDefinition} {bindings} />

View File

@ -14,6 +14,7 @@
export let assetInstance
export let bindings
export let componentBindings
export let isScreen = false
const layoutDefinition = []
const screenDefinition = [
@ -90,7 +91,7 @@
{#each sections as section, idx (section.name)}
<DetailSummary name={section.name} collapsible={false}>
{#if idx === 0 && !componentInstance._component.endsWith("/layout")}
{#if idx === 0 && !componentInstance._component.endsWith("/layout") && !isScreen}
<PropertyControl
control={Input}
label="Name"