Don't show delete or duplicate actions in the component settings bar

This commit is contained in:
Dean 2022-11-17 14:10:55 +00:00
parent 2a7b90e46f
commit 312bc96770
1 changed files with 24 additions and 17 deletions

View File

@ -24,6 +24,9 @@
} }
$: settings = getBarSettings(definition) $: settings = getBarSettings(definition)
$: isScreen =
$builderStore.selectedComponentId === $builderStore.screen?.props?._id
const getBarSettings = definition => { const getBarSettings = definition => {
let allSettings = [] let allSettings = []
definition?.settings?.forEach(setting => { definition?.settings?.forEach(setting => {
@ -152,26 +155,30 @@
{:else if setting.type === "color"} {:else if setting.type === "color"}
<SettingsColorPicker prop={setting.key} /> <SettingsColorPicker prop={setting.key} />
{/if} {/if}
{#if setting.barSeparator !== false} {#if setting.barSeparator !== false && (settings.length != idx + 1 || !isScreen)}
<div class="divider" /> <div class="divider" />
{/if} {/if}
{/each} {/each}
<SettingsButton {#if !isScreen}
icon="Duplicate" <SettingsButton
on:click={() => { icon="Duplicate"
builderStore.actions.duplicateComponent( on:click={() => {
$builderStore.selectedComponentId builderStore.actions.duplicateComponent(
) $builderStore.selectedComponentId
}} )
title="Duplicate component" }}
/> title="Duplicate component"
<SettingsButton />
icon="Delete" <SettingsButton
on:click={() => { icon="Delete"
builderStore.actions.deleteComponent($builderStore.selectedComponentId) on:click={() => {
}} builderStore.actions.deleteComponent(
title="Delete component" $builderStore.selectedComponentId
/> )
}}
title="Delete component"
/>
{/if}
</div> </div>
{/if} {/if}