diff --git a/modules/rsocials/components/campaign-workflow.css b/modules/rsocials/components/campaign-workflow.css index 3308e14..1deff4d 100644 --- a/modules/rsocials/components/campaign-workflow.css +++ b/modules/rsocials/components/campaign-workflow.css @@ -73,6 +73,19 @@ folk-campaign-workflow { border-color: var(--rs-border-strong, #4d4d6c); } +.cw-btn--back { + text-decoration: none; + color: #93c5fd; + border-color: #3b82f644; + display: inline-flex; + align-items: center; + gap: 4px; +} +.cw-btn--back:hover { + background: #3b82f622; + border-color: #3b82f6; +} + .cw-btn--run { background: #3b82f622; border-color: #3b82f655; diff --git a/modules/rsocials/components/folk-campaign-workflow.ts b/modules/rsocials/components/folk-campaign-workflow.ts index 6312c18..839d568 100644 --- a/modules/rsocials/components/folk-campaign-workflow.ts +++ b/modules/rsocials/components/folk-campaign-workflow.ts @@ -81,6 +81,7 @@ class FolkCampaignWorkflow extends HTMLElement { } // Data + private targetWorkflowId = ''; private workflows: CampaignWorkflow[] = []; private currentWorkflowId = ''; private nodes: CampaignWorkflowNode[] = []; @@ -134,8 +135,11 @@ class FolkCampaignWorkflow extends HTMLElement { this.shadow = this.attachShadow({ mode: 'open' }); } + static get observedAttributes() { return ['space', 'workflow']; } + connectedCallback() { this.space = this.getAttribute('space') || 'demo'; + this.targetWorkflowId = this.getAttribute('workflow') || ''; this.initData(); } @@ -155,7 +159,10 @@ class FolkCampaignWorkflow extends HTMLElement { const data = await res.json(); this.workflows = data.results || []; if (this.workflows.length > 0) { - this.loadWorkflow(this.workflows[0]); + const target = this.targetWorkflowId + ? this.workflows.find(w => w.id === this.targetWorkflowId) + : undefined; + this.loadWorkflow(target || this.workflows[0]); } } } catch { @@ -306,7 +313,7 @@ class FolkCampaignWorkflow extends HTMLElement {