From 019243a3298b67a2a7a3c565353580521a5992b7 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Wed, 28 Jul 2021 17:05:14 +0200 Subject: [PATCH 1/2] add duplicate condition button --- .../PropertyControls/ConditionalUIDrawer.svelte | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte index ebe60c7110..67315c620c 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte @@ -101,6 +101,12 @@ conditions = conditions.filter(link => link.id !== id) } + const duplicateCondition = id => { + const condition = conditions.find(link => link.id === id); + const duplicate = {...condition, id: generate()} + conditions = [...conditions, duplicate] + } + const handleFinalize = e => { updateConditions(e) dragDisabled = true @@ -235,6 +241,12 @@ bind:value={condition.referenceValue} /> {/if} + duplicateCondition(condition.id)} + /> Date: Wed, 28 Jul 2021 17:20:25 +0200 Subject: [PATCH 2/2] fix lint issue --- .../PropertyControls/ConditionalUIDrawer.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte index 67315c620c..8b9cad1b7c 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte @@ -102,8 +102,8 @@ } const duplicateCondition = id => { - const condition = conditions.find(link => link.id === id); - const duplicate = {...condition, id: generate()} + const condition = conditions.find(link => link.id === id) + const duplicate = { ...condition, id: generate() } conditions = [...conditions, duplicate] }