Updates to automation flow items

- changed backend log icon
- added static values for trigger icon and action icons
- added a background to external app actions
- changed layout of labels + fields
- resized automation cards
- removed automation label. Made Automation title more prominent.
- creation automation modal layout changed
- removed label for name field
- removed help text
- removed warning
- added background to icons
- changed item size
- added placeholder to name input
This commit is contained in:
Joe 2024-10-21 17:23:48 +01:00
parent 80c9011892
commit fe920dafc2
13 changed files with 128 additions and 129 deletions

View File

@ -197,12 +197,14 @@
on:click={() => selectAction(action)} on:click={() => selectAction(action)}
> >
<div class="item-body"> <div class="item-body">
<div class="icon-background-external">
<img <img
width={24} width={20}
height={24} height={20}
src={externalActions[action.stepId].icon} src={externalActions[action.stepId].icon}
alt={externalActions[action.stepId].name} alt={externalActions[action.stepId].name}
/> />
</div>
<p> <p>
{action.stepTitle || idx.charAt(0).toUpperCase() + idx.slice(1)} {action.stepTitle || idx.charAt(0).toUpperCase() + idx.slice(1)}
</p> </p>
@ -259,7 +261,17 @@
background: var(--spectrum-global-color-gray-200); background: var(--spectrum-global-color-gray-200);
} }
.icon-background { .icon-background {
background-color: var(--spectrum-global-color-indigo-500); background-color: #5e12f7;
padding: 0;
border-radius: 6px;
min-height: 28px;
min-width: 28px;
display: inline-flex;
justify-content: center;
align-items: center;
}
.icon-background-external {
background-color: var(--spectrum-global-color-gray-200);
padding: 0; padding: 0;
border-radius: 6px; border-radius: 6px;
min-height: 28px; min-height: 28px;
@ -269,8 +281,9 @@
align-items: center; align-items: center;
} }
div:has(svg) { div:has(svg) {
color: var(--spectrum-global-color-gray-900); color: white;
} }
img { img {
border-radius: 6px; border-radius: 6px;
padding: 2px; padding: 2px;

View File

@ -111,40 +111,7 @@
await automationStore.actions.save(updatedAuto) await automationStore.actions.save(updatedAuto)
}} }}
on:toggle={() => (open = !open)} on:toggle={() => (open = !open)}
>
<div slot="custom-actions" class="branch-actions">
<Icon
on:click={() => {
automationStore.actions.branchLeft(
branchBlockRef.pathTo,
$selectedAutomation.data,
step
)
}}
tooltip={"Move left"}
tooltipType={TooltipType.Info}
tooltipPosition={TooltipPosition.Top}
hoverable
disabled={branchIdx == 0}
name="ArrowLeft"
/> />
<Icon
on:click={() => {
automationStore.actions.branchRight(
branchBlockRef.pathTo,
$selectedAutomation.data,
step
)
}}
tooltip={"Move right"}
tooltipType={TooltipType.Info}
tooltipPosition={TooltipPosition.Top}
hoverable
disabled={isLast}
name="ArrowRight"
/>
</div>
</FlowItemHeader>
{#if open} {#if open}
<Divider noMargin /> <Divider noMargin />
<div class="blockSection"> <div class="blockSection">
@ -214,11 +181,11 @@
display: inline-block; display: inline-block;
} }
.block { .block {
width: 480px; width: 360px;
font-size: 16px; font-size: 16px;
background-color: var(--background); background-color: var(--background);
border: 1px solid var(--spectrum-global-color-gray-300); border: 1px solid var(--spectrum-global-color-gray-300);
border-radius: 4px 4px 4px 4px; border-radius: 12px;
} }
.blockSection { .blockSection {

View File

@ -264,11 +264,11 @@
display: inline-block; display: inline-block;
} }
.block { .block {
width: 480px; width: 360px;
font-size: 16px; font-size: 16px;
background-color: var(--background); background-color: var(--background);
border: 1px solid var(--spectrum-global-color-gray-300); border: 1px solid var(--spectrum-global-color-gray-300);
border-radius: 4px 4px 4px 4px; border-radius: 12px;
} }
.blockSection { .blockSection {

View File

@ -41,7 +41,7 @@
<style> <style>
.action-bar { .action-bar {
background-color: var(--background); background-color: var(--background);
border-radius: 4px 4px 4px 4px; border-radius: 8px;
display: flex; display: flex;
gap: var(--spacing-m); gap: var(--spacing-m);
padding: var(--spacing-m); padding: var(--spacing-m);

View File

@ -113,19 +113,21 @@
<div class="splitHeader"> <div class="splitHeader">
<div class="center-items"> <div class="center-items">
{#if externalActions[block.stepId]} {#if externalActions[block.stepId]}
<div class="icon-background-external">
<img <img
alt={externalActions[block.stepId].name} alt={externalActions[block.stepId].name}
width="32px" width="20px"
height="32px" height="20px"
src={externalActions[block.stepId].icon} src={externalActions[block.stepId].icon}
/> />
</div>
{:else if isHeaderTrigger} {:else if isHeaderTrigger}
<div class="icon-background-trigger"> <div class="icon-background-trigger">
<svg <svg
width="24px" width="20px"
height="24px" height="20px"
class="spectrum-Icon" class="spectrum-Icon"
style="color:var(--spectrum-global-color-gray-900);" style="color: black;"
focusable="false" focusable="false"
> >
<use xlink:href="#spectrum-icon-18-{block.icon}" /> <use xlink:href="#spectrum-icon-18-{block.icon}" />
@ -134,10 +136,10 @@
{:else} {:else}
<div class="icon-background"> <div class="icon-background">
<svg <svg
width="24px" width="20px"
height="24px" height="20px"
class="spectrum-Icon" class="spectrum-Icon"
style="color:var(--spectrum-global-color-gray-900);" style="color: white;"
focusable="false" focusable="false"
> >
<use xlink:href="#spectrum-icon-18-{block.icon}" /> <use xlink:href="#spectrum-icon-18-{block.icon}" />
@ -145,12 +147,6 @@
</div> </div>
{/if} {/if}
<div class="iconAlign"> <div class="iconAlign">
{#if isHeaderTrigger}
<Body size="XS"><b>Trigger</b></Body>
{:else}
<Body size="XS"><b>{isBranch ? "Branch" : "Step"}</b></Body>
{/if}
{#if enableNaming} {#if enableNaming}
<input <input
class="input-text" class="input-text"
@ -180,6 +176,7 @@
{/if} {/if}
</div> </div>
</div> </div>
<div class="blockTitle"> <div class="blockTitle">
{#if showTestStatus && testResult} {#if showTestStatus && testResult}
<div class="status-container"> <div class="status-container">
@ -199,7 +196,7 @@
dispatch("toggle") dispatch("toggle")
}} }}
hoverable hoverable
name={open ? "ChevronUp" : "ChevronDown"} name={open ? "ChevronDown" : "ChevronRight"}
/> />
</div> </div>
{/if} {/if}
@ -214,7 +211,12 @@
{#if !showTestStatus} {#if !showTestStatus}
{#if !isHeaderTrigger && !isLooped && !isBranch && (block?.features?.[Features.LOOPING] || !block.features)} {#if !isHeaderTrigger && !isLooped && !isBranch && (block?.features?.[Features.LOOPING] || !block.features)}
<AbsTooltip type="info" text="Add looping"> <AbsTooltip type="info" text="Add looping">
<Icon on:click={addLooping} hoverable name="RotateCW" /> <Icon
on:click={addLooping}
tooltip={"Loop automation step"}
hoverable
name="RotateCW"
/>
</AbsTooltip> </AbsTooltip>
{/if} {/if}
{#if !isHeaderTrigger} {#if !isHeaderTrigger}
@ -223,9 +225,6 @@
</AbsTooltip> </AbsTooltip>
{/if} {/if}
{/if} {/if}
{#if !showTestStatus && !isHeaderTrigger}
<span class="action-spacer" />
{/if}
{#if !showTestStatus} {#if !showTestStatus}
<Icon <Icon
on:click={e => { on:click={e => {
@ -233,7 +232,7 @@
dispatch("toggle") dispatch("toggle")
}} }}
hoverable hoverable
name={open ? "ChevronUp" : "ChevronDown"} name={open ? "ChevronDown" : "ChevronRight"}
/> />
{/if} {/if}
</div> </div>
@ -251,9 +250,6 @@
</div> </div>
<style> <style>
.action-spacer {
border-left: 1px solid var(--spectrum-global-color-gray-300);
}
.status-container { .status-container {
display: flex; display: flex;
align-items: center; align-items: center;
@ -261,7 +257,6 @@
gap: var(--spacing-m); gap: var(--spacing-m);
/* You can also add padding or margin to adjust the spacing between the text and the chevron if needed. */ /* You can also add padding or margin to adjust the spacing between the text and the chevron if needed. */
} }
.context-actions { .context-actions {
display: flex; display: flex;
gap: var(--spacing-l); gap: var(--spacing-l);
@ -272,9 +267,9 @@
align-items: center; align-items: center;
} }
.icon-background-trigger { .icon-background-trigger {
background-color: var(--spectrum-global-color-static-orange-400); background-color: #6afdef;
padding: 0; padding: 0;
border-radius: 7px; border-radius: 8px;
min-height: 32px; min-height: 32px;
min-width: 32px; min-width: 32px;
display: inline-flex; display: inline-flex;
@ -282,16 +277,25 @@
align-items: center; align-items: center;
} }
.icon-background { .icon-background {
background-color: var(--spectrum-global-color-indigo-500); background-color: #5e12f7;
padding: 0; padding: 0;
border-radius: 7px; border-radius: 8px;
min-height: 32px;
min-width: 32px;
display: inline-flex;
justify-content: center;
align-items: center;
}
.icon-background-external {
background-color: var(--spectrum-global-color-gray-200);
padding: 0;
border-radius: 8px;
min-height: 32px; min-height: 32px;
min-width: 32px; min-width: 32px;
display: inline-flex; display: inline-flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.splitHeader { .splitHeader {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -301,16 +305,13 @@
padding: 0 0 0 var(--spacing-m); padding: 0 0 0 var(--spacing-m);
display: inline-block; display: inline-block;
} }
.blockSection { .blockSection {
padding: var(--spacing-xl); padding: var(--spacing-xl);
border: 1px solid transparent; border: 1px solid transparent;
} }
.blockTitle { .blockTitle {
display: flex; display: flex;
} }
.hide-context-actions { .hide-context-actions {
display: none; display: none;
} }
@ -318,14 +319,13 @@
color: var(--ink); color: var(--ink);
background-color: transparent; background-color: transparent;
border: 1px solid transparent; border: 1px solid transparent;
width: 230px; width: 100%;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
} }
.input-text { .input-text {
font-size: var(--spectrum-alias-font-size-default); font-size: 16px;
font-family: var(--font-sans); font-family: var(--font-sans);
text-overflow: ellipsis; text-overflow: ellipsis;
padding-left: 0px; padding-left: 0px;

View File

@ -146,7 +146,7 @@
flex-direction: column; flex-direction: column;
align-items: stretch; align-items: stretch;
border-right: var(--border-light); border-right: var(--border-light);
background: var(--spectrum-global-color-gray-100); background: var(--background);
overflow: hidden; overflow: hidden;
transition: margin-left 300ms ease-out; transition: margin-left 300ms ease-out;
} }

View File

@ -57,23 +57,15 @@
onConfirm={createAutomation} onConfirm={createAutomation}
disabled={!selectedTrigger || !name} disabled={!selectedTrigger || !name}
> >
<InlineAlert
header="You must publish your app to activate your automations."
message="To test your automation before publishing, you can use the 'Run Test' functionality on the next screen."
/>
<Body size="S">
Please name your automation, then select a trigger.<br />
Every automation must start with a trigger.
</Body>
<Input <Input
bind:value={name} bind:value={name}
on:input={() => (nameTouched = true)} on:input={() => (nameTouched = true)}
bind:error={nameError} bind:error={nameError}
label="Name" placeholder="Name your automation"
/> />
<Layout noPadding gap="XS"> <Layout noPadding gap="XS">
<Label size="S">Trigger</Label> <Label size="L">Trigger</Label>
<div class="item-list"> <div class="item-list">
{#each triggers as [_, trigger]} {#each triggers as [_, trigger]}
<div <div
@ -82,10 +74,10 @@
on:click={() => selectTrigger(trigger)} on:click={() => selectTrigger(trigger)}
> >
<div class="item-body"> <div class="item-body">
<div class="icon-background-trigger">
<Icon name={trigger.icon} /> <Icon name={trigger.icon} />
<span class="icon-spacing"> </div>
<Body size="S">{trigger.name}</Body></span <Body size="S">{trigger.name}</Body>
>
</div> </div>
</div> </div>
{/each} {/each}
@ -94,35 +86,65 @@
</ModalContent> </ModalContent>
<style> <style>
.icon-spacing {
margin-left: var(--spacing-m);
}
.item-body { .item-body {
display: flex; display: flex;
margin-left: var(--spacing-m); margin-left: var(--spacing-m);
gap: var(--spacing-m);
align-items: center;
} }
.item-list { .item-list {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-template-columns: repeat(2, minmax(200px, 1fr));
grid-gap: var(--spectrum-alias-grid-baseline); grid-gap: 10px;
} }
.item { .item {
cursor: pointer; cursor: pointer;
display: grid;
grid-gap: var(--spectrum-alias-grid-margin-xsmall); grid-gap: var(--spectrum-alias-grid-margin-xsmall);
padding: var(--spectrum-alias-item-padding-s); padding: var(--spectrum-alias-item-padding-s);
background: var(--spectrum-alias-background-color-secondary); background: var(--spectrum-alias-background-color-secondary);
transition: 0.3s all; transition: 0.3s all;
border-radius: 5px; border: solid var(--spectrum-global-color-gray-200);
border-radius: 6px;
box-sizing: border-box; box-sizing: border-box;
border-width: 2px; border-width: 1px;
}
.item p {
font-size: 16px !important;
margin: 0;
color: var(--spectrum-global-color-gray-900);
} }
.item:hover { .item:not(.disabled):hover,
background: var(--spectrum-alias-background-color-tertiary);
}
.selected { .selected {
background: var(--spectrum-alias-background-color-tertiary); background: var(--spectrum-alias-background-color-tertiary);
} }
.disabled {
background: var(--spectrum-global-color-gray-200);
opacity: 0.5;
}
.disabled :global(.spectrum-Body) {
color: var(--spectrum-global-color-gray-600);
}
.tag-color :global(.spectrum-Tags-item) {
background: var(--spectrum-global-color-gray-200);
}
.icon-background-trigger {
background-color: #6afdef;
padding: 0;
border-radius: 6px;
min-height: 28px;
min-width: 28px;
display: inline-flex;
justify-content: center;
align-items: center;
}
div:has(svg) {
color: black;
}
img {
border-radius: 6px;
padding: 2px;
}
</style> </style>

View File

@ -1000,9 +1000,9 @@
.block-field { .block-field {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: row; flex-direction: column;
align-items: center; align-items: flex-start;
gap: 10px; gap: 8px;
flex: 1; flex: 1;
} }

View File

@ -73,8 +73,8 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-direction: row; flex-direction: column;
align-items: center; align-items: flex-start;
gap: 10px; gap: 10px;
flex: 1; flex: 1;
margin-bottom: 10px; margin-bottom: 10px;

View File

@ -15,15 +15,16 @@
<div class="prop-label" title={label}> <div class="prop-label" title={label}>
<Label size="L" tooltip={labelTooltip}>{label}</Label> <Label size="L" tooltip={labelTooltip}>{label}</Label>
</div> </div>
<div class="prop-control"> <div>
<slot /> <slot />
</div> </div>
</div> </div>
<style> <style>
.prop-field { .prop-field {
display: grid; display: flex;
grid-template-columns: 1fr var(--comp-width); flex-direction: column;
gap: 8px;
} }
.prop-field.fullWidth { .prop-field.fullWidth {
@ -50,10 +51,6 @@
overflow: hidden; overflow: hidden;
} }
.prop-control {
margin-left: var(--spacing-s);
}
.prop-field.fullWidth .prop-control { .prop-field.fullWidth .prop-control {
margin-left: 0px; margin-left: 0px;
} }

View File

@ -68,8 +68,8 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-direction: row; flex-direction: column;
align-items: center; align-items: flex-start;
gap: 10px; gap: 10px;
flex: 1; flex: 1;
margin-bottom: 10px; margin-bottom: 10px;

View File

@ -17,7 +17,7 @@ import {
export const definition: AutomationStepDefinition = { export const definition: AutomationStepDefinition = {
name: "Backend log", name: "Backend log",
tagline: "Console log a value in the backend", tagline: "Console log a value in the backend",
icon: "Monitoring", icon: "FileCode",
description: "Logs the given text to the server (using console.log)", description: "Logs the given text to the server (using console.log)",
type: AutomationStepType.ACTION, type: AutomationStepType.ACTION,
internal: true, internal: true,

View File

@ -273,7 +273,7 @@ export function serverLogAutomation(appId?: string): Automation {
stepId: AutomationActionStepId.SERVER_LOG, stepId: AutomationActionStepId.SERVER_LOG,
name: "Backend log", name: "Backend log",
tagline: "Console log a value in the backend", tagline: "Console log a value in the backend",
icon: "Monitoring", icon: "FileCode",
description: "Logs the given text to the server (using console.log)", description: "Logs the given text to the server (using console.log)",
internal: true, internal: true,
features: { features: {