From 312bc967701f69f0cb9d5756a45d4dae3f018e18 Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 17 Nov 2022 14:10:55 +0000 Subject: [PATCH] Don't show delete or duplicate actions in the component settings bar --- .../src/components/preview/SettingsBar.svelte | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/packages/client/src/components/preview/SettingsBar.svelte b/packages/client/src/components/preview/SettingsBar.svelte index f72994e496..7f9b92c01d 100644 --- a/packages/client/src/components/preview/SettingsBar.svelte +++ b/packages/client/src/components/preview/SettingsBar.svelte @@ -24,6 +24,9 @@ } $: settings = getBarSettings(definition) + $: isScreen = + $builderStore.selectedComponentId === $builderStore.screen?.props?._id + const getBarSettings = definition => { let allSettings = [] definition?.settings?.forEach(setting => { @@ -152,26 +155,30 @@ {:else if setting.type === "color"} {/if} - {#if setting.barSeparator !== false} + {#if setting.barSeparator !== false && (settings.length != idx + 1 || !isScreen)}
{/if} {/each} - { - builderStore.actions.duplicateComponent( - $builderStore.selectedComponentId - ) - }} - title="Duplicate component" - /> - { - builderStore.actions.deleteComponent($builderStore.selectedComponentId) - }} - title="Delete component" - /> + {#if !isScreen} + { + builderStore.actions.duplicateComponent( + $builderStore.selectedComponentId + ) + }} + title="Duplicate component" + /> + { + builderStore.actions.deleteComponent( + $builderStore.selectedComponentId + ) + }} + title="Delete component" + /> + {/if}
{/if}