Updating automation action add modal to split out plugins into their own section.

This commit is contained in:
mike12345567 2023-04-18 16:12:08 +01:00
parent cb73e3b1c3
commit 22dbb8d379
1 changed files with 31 additions and 2 deletions

View File

@ -34,13 +34,22 @@
const internal = actions.reduce((acc, elm) => { const internal = actions.reduce((acc, elm) => {
const [k, v] = elm const [k, v] = elm
if (v.internal || v.custom) { if (v.internal) {
acc[k] = v acc[k] = v
} }
delete acc.LOOP delete acc.LOOP
return acc return acc
}, {}) }, {})
const plugins = actions.reduce((acc, elm) => {
const [k, v] = elm
if (v.custom) {
acc[k] = v
}
return acc
}, {})
console.log(plugins)
const selectAction = action => { const selectAction = action => {
actionVal = action actionVal = action
selectedAction = action.name selectedAction = action.name
@ -116,6 +125,26 @@
{/each} {/each}
</div> </div>
</Layout> </Layout>
{#if Object.keys(plugins).length}
<Layout noPadding gap="XS">
<Detail size="S">Plugins</Detail>
<div class="item-list">
{#each Object.entries(plugins) as [idx, action]}
<div
class="item"
class:selected={selectedAction === action.name}
on:click={() => selectAction(action)}
>
<div class="item-body">
<Icon name={action.icon} />
<Body size="XS">{action.name}</Body>
</div>
</div>
{/each}
</div>
</Layout>
{/if}
</ModalContent> </ModalContent>
<style> <style>
@ -126,7 +155,7 @@
} }
.item-list { .item-list {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-template-columns: repeat(2, minmax(150px, 1fr));
grid-gap: var(--spectrum-alias-grid-baseline); grid-gap: var(--spectrum-alias-grid-baseline);
} }