@widgetic/workflows 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -44
- package/dist/api/types.d.ts +17 -0
- package/dist/api/types.js +7 -0
- package/dist/api/workflowsApi.js +23 -2
- package/dist/components/Workflows.svelte +13 -15
- package/dist/components/WorkflowsEmptyState.svelte +14 -12
- package/dist/components/WorkflowsHeader.svelte +9 -5
- package/dist/components/WorkflowsHeader.svelte.d.ts +4 -16
- package/dist/components/WorkflowsWorkspace.svelte +3 -2
- package/dist/components/canvas/AddBlockMenu.svelte +11 -2
- package/dist/components/canvas/CanvasToolbar.svelte +42 -31
- package/dist/components/canvas/CanvasToolbar.svelte.d.ts +2 -0
- package/dist/components/canvas/CompositionNodeView.svelte +58 -36
- package/dist/components/canvas/ConditionNodeView.svelte +31 -18
- package/dist/components/canvas/HandlePoint.svelte +10 -3
- package/dist/components/canvas/HandlePoint.svelte.d.ts +1 -1
- package/dist/components/canvas/TriggerNodeView.svelte +39 -13
- package/dist/components/canvas/WorkflowCanvas.svelte +22 -7
- package/dist/components/canvas/WorkflowCanvas.svelte.d.ts +2 -0
- package/dist/components/canvas/WorkflowEdgeView.svelte +5 -6
- package/dist/components/editor/ConflictBanner.svelte +1 -1
- package/dist/components/editor/EditorBanners.svelte +11 -4
- package/dist/components/editor/EditorCanvasArea.svelte +17 -10
- package/dist/components/editor/EditorTabs.svelte +10 -44
- package/dist/components/editor/EditorTopBar.svelte +166 -54
- package/dist/components/editor/PresenceBanner.svelte +106 -85
- package/dist/components/editor/RunsFlow.svelte +136 -42
- package/dist/components/editor/RunsTab.svelte +52 -46
- package/dist/components/editor/SettingsRow.svelte +35 -0
- package/dist/components/editor/SettingsRow.svelte.d.ts +14 -0
- package/dist/components/editor/SettingsTab.svelte +66 -50
- package/dist/components/editor/WorkflowEditor.svelte +4 -5
- package/dist/components/list/CreateWorkflowDialog.svelte +123 -73
- package/dist/components/list/WorkflowList.svelte +227 -100
- package/dist/components/list/WorkflowRow.svelte +84 -42
- package/dist/components/panel/BlockProblems.svelte +9 -8
- package/dist/components/panel/CompositionForm.svelte +52 -34
- package/dist/components/panel/CompositionPicker.svelte +43 -21
- package/dist/components/panel/CompositionPicker.svelte.d.ts +5 -0
- package/dist/components/panel/CompositionSelect.svelte +105 -0
- package/dist/components/panel/CompositionSelect.svelte.d.ts +23 -0
- package/dist/components/panel/ConditionForm.svelte +50 -17
- package/dist/components/panel/EventValueRow.svelte +5 -4
- package/dist/components/panel/ProblemsList.svelte +17 -19
- package/dist/components/panel/RuleCard.svelte +127 -89
- package/dist/components/panel/RuleCard.svelte.d.ts +2 -0
- package/dist/components/panel/SidePanel.svelte +101 -50
- package/dist/components/panel/TestResultLine.svelte +35 -0
- package/dist/components/panel/TestResultLine.svelte.d.ts +9 -0
- package/dist/components/panel/TestRow.svelte +21 -18
- package/dist/components/panel/TestRunPanel.svelte +61 -39
- package/dist/components/panel/TestTriggerCard.svelte +66 -6
- package/dist/components/panel/TestTriggerCard.svelte.d.ts +10 -0
- package/dist/components/panel/TriggerForm.svelte +24 -25
- package/dist/components/panel/VersionHistory.svelte +31 -43
- package/dist/components/ui/ActionButton.svelte +44 -12
- package/dist/components/ui/ActionButton.svelte.d.ts +2 -1
- package/dist/components/ui/Badge.svelte +39 -0
- package/dist/components/ui/Badge.svelte.d.ts +12 -0
- package/dist/components/ui/ConfirmDialog.svelte +4 -3
- package/dist/components/ui/Menu.svelte +28 -14
- package/dist/components/ui/Menu.svelte.d.ts +3 -1
- package/dist/components/ui/Modal.svelte +15 -8
- package/dist/components/ui/Notice.svelte +35 -11
- package/dist/components/ui/Notice.svelte.d.ts +4 -1
- package/dist/components/ui/SelectField.svelte +48 -20
- package/dist/components/ui/SelectField.svelte.d.ts +2 -0
- package/dist/components/ui/StatusBadge.svelte +13 -24
- package/dist/components/ui/StatusBadge.svelte.d.ts +0 -2
- package/dist/components/ui/Tabs.svelte +79 -0
- package/dist/components/ui/Tabs.svelte.d.ts +21 -0
- package/dist/components/ui/TextField.svelte +47 -27
- package/dist/components/ui/TextField.svelte.d.ts +5 -0
- package/dist/components/ui/icons.d.ts +43 -29
- package/dist/components/ui/icons.js +101 -40
- package/dist/editor/editorState.svelte.d.ts +23 -2
- package/dist/editor/editorState.svelte.js +36 -0
- package/dist/editor/listState.svelte.d.ts +32 -2
- package/dist/editor/listState.svelte.js +41 -0
- package/dist/editor/runsFlow.d.ts +28 -3
- package/dist/editor/runsFlow.js +27 -2
- package/dist/editor/runsFlowLayout.d.ts +6 -2
- package/dist/editor/runsFlowLayout.js +7 -2
- package/dist/editor/statsRange.d.ts +7 -1
- package/dist/editor/statsRange.js +14 -0
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/messages.d.ts +32 -13
- package/dist/i18n/messages.js +33 -14
- package/dist/i18n/statusWords.d.ts +12 -0
- package/dist/i18n/statusWords.js +12 -0
- package/package.json +3 -3
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
The list of a workspace's workflows: search, a filter by state, an order (name, when it was made, when it was last
|
|
3
3
|
published, how many visitors started it) and a row for each, with "New workflow" at the top.
|
|
4
4
|
|
|
5
|
+
The filter is two controls that work together (Figma "Workflows / List" and "Workflows / Status menu"). The tabs say what the
|
|
6
|
+
list covers: "Not archived" (drafts, live and paused) or "All workflows". The Status menu next to them narrows that to one
|
|
7
|
+
state (Any, Draft, Live, Paused, Archived). The archived workflows are only in "All workflows", so choosing Archived opens that
|
|
8
|
+
tab; choosing a tab puts Status back to Any. The model of it is in `WorkflowListState` (`chooseScope`, `chooseStatus`).
|
|
9
|
+
|
|
5
10
|
The list can be longer than a page, so every change of the search, the filter or the order asks the API again; "Show more"
|
|
6
11
|
adds the next page. A page of nothing says why: nothing made yet (and offers to make one), or nothing matches what was asked.
|
|
7
12
|
|
|
@@ -11,13 +16,17 @@
|
|
|
11
16
|
<script lang="ts">
|
|
12
17
|
import { onDestroy, onMount, untrack } from 'svelte';
|
|
13
18
|
import type { WorkflowDetail } from '../../api/types.js';
|
|
14
|
-
import { WORKFLOW_STATUSES } from '../../api/types.js';
|
|
15
19
|
import type { WorkflowSortField } from '../../api/types.js';
|
|
16
20
|
import { useWorkflowsApi } from '../../api/apiContext.js';
|
|
17
|
-
import {
|
|
18
|
-
|
|
21
|
+
import {
|
|
22
|
+
LIST_STATUS_CHOICES,
|
|
23
|
+
WorkflowListState,
|
|
24
|
+
provideListState
|
|
25
|
+
} from '../../editor/listState.svelte.js';
|
|
26
|
+
import type { ListScope } from '../../editor/listState.svelte.js';
|
|
19
27
|
import { useWorkflowsLanguage } from '../../i18n/language.js';
|
|
20
28
|
import type { WorkflowsMessageKey } from '../../i18n/messages.js';
|
|
29
|
+
import { STATUS_WORD_KEYS } from '../../i18n/statusWords.js';
|
|
21
30
|
import type { WorkflowsError } from '../../types/index.js';
|
|
22
31
|
import WorkflowsEmptyState from '../WorkflowsEmptyState.svelte';
|
|
23
32
|
import WorkflowsHeader from '../WorkflowsHeader.svelte';
|
|
@@ -25,6 +34,7 @@
|
|
|
25
34
|
import Icon from '../ui/Icon.svelte';
|
|
26
35
|
import Notice from '../ui/Notice.svelte';
|
|
27
36
|
import SelectField from '../ui/SelectField.svelte';
|
|
37
|
+
import Tabs from '../ui/Tabs.svelte';
|
|
28
38
|
import TextField from '../ui/TextField.svelte';
|
|
29
39
|
import type { SelectChoice } from '../ui/types.js';
|
|
30
40
|
import CreateWorkflowDialog from './CreateWorkflowDialog.svelte';
|
|
@@ -59,14 +69,10 @@
|
|
|
59
69
|
|
|
60
70
|
let isCreating = $state(false);
|
|
61
71
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
all: 'workflows.list.filterAll'
|
|
65
|
-
|
|
66
|
-
live: 'workflows.status.live',
|
|
67
|
-
paused: 'workflows.status.paused',
|
|
68
|
-
archived: 'workflows.status.archived'
|
|
69
|
-
} as const satisfies Record<ListStatusFilter, WorkflowsMessageKey>;
|
|
72
|
+
const TAB_FILTER_KEYS = {
|
|
73
|
+
active: 'workflows.list.filterActive',
|
|
74
|
+
all: 'workflows.list.filterAll'
|
|
75
|
+
} as const satisfies Record<ListScope, WorkflowsMessageKey>;
|
|
70
76
|
|
|
71
77
|
const SORT_KEYS = {
|
|
72
78
|
createdAt: 'workflows.list.sortCreated',
|
|
@@ -75,12 +81,32 @@
|
|
|
75
81
|
name: 'workflows.list.sortName'
|
|
76
82
|
} as const satisfies Record<WorkflowSortField, WorkflowsMessageKey>;
|
|
77
83
|
|
|
84
|
+
const listPanelId = $props.id();
|
|
85
|
+
|
|
86
|
+
const tabItems = $derived([
|
|
87
|
+
{ key: 'active', label: $t(TAB_FILTER_KEYS.active) },
|
|
88
|
+
{ key: 'all', label: $t(TAB_FILTER_KEYS.all) }
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
// The tab that is open is the list's own (see `WorkflowListState.scope`): choosing one state in the Status menu keeps it.
|
|
92
|
+
const tabValue = $derived(list.scope);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Nothing has been made yet and nothing narrows the list: the design then shows the title and the empty state alone (the
|
|
96
|
+
* state's own button makes the first workflow), with no search, no tabs, no sort and no second "New workflow".
|
|
97
|
+
*/
|
|
98
|
+
const isLibraryEmpty = $derived(
|
|
99
|
+
list.loadState === 'ready' && list.items.length === 0 && !list.isNarrowed
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/** The lines of the Status menu: "Any", then each state in the words the pill and the row of a workflow use. */
|
|
78
103
|
const statusChoices = $derived<SelectChoice[]>(
|
|
79
|
-
|
|
80
|
-
value:
|
|
81
|
-
label: $t(
|
|
104
|
+
LIST_STATUS_CHOICES.map((choice) => ({
|
|
105
|
+
value: choice,
|
|
106
|
+
label: $t(choice === 'any' ? 'workflows.list.statusAny' : STATUS_WORD_KEYS[choice])
|
|
82
107
|
}))
|
|
83
108
|
);
|
|
109
|
+
|
|
84
110
|
const sortChoices = $derived<SelectChoice[]>(
|
|
85
111
|
(Object.keys(SORT_KEYS) as WorkflowSortField[]).map((field) => ({
|
|
86
112
|
value: field,
|
|
@@ -95,6 +121,11 @@
|
|
|
95
121
|
onopen(created.id);
|
|
96
122
|
}
|
|
97
123
|
|
|
124
|
+
/** A tab was chosen: the list covers what it says, and Status goes back to Any (see `WorkflowListState.chooseScope`). */
|
|
125
|
+
function setTab(key: string): void {
|
|
126
|
+
list.chooseScope(key === 'all' ? 'all' : 'active');
|
|
127
|
+
}
|
|
128
|
+
|
|
98
129
|
onMount(() => {
|
|
99
130
|
void list.load();
|
|
100
131
|
// Who is editing what is asked alongside the load (it looks again once the rows are there); nothing happens without `presence`.
|
|
@@ -104,114 +135,210 @@
|
|
|
104
135
|
onDestroy(() => list.dispose());
|
|
105
136
|
</script>
|
|
106
137
|
|
|
107
|
-
<div class="@container flex flex-1 flex-col
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
138
|
+
<div class="@container flex min-h-0 flex-1 flex-col bg-background">
|
|
139
|
+
<!-- Desktop page header: title, search, primary action (Figma list-list) -->
|
|
140
|
+
<div class="hidden h-19 shrink-0 items-center justify-between gap-4 px-8 pt-6 pb-4 @3xl:flex">
|
|
141
|
+
<WorkflowsHeader class="min-w-0 shrink" />
|
|
142
|
+
{#if !isLibraryEmpty}
|
|
143
|
+
<div class="flex min-w-0 shrink-0 items-center gap-2">
|
|
144
|
+
<TextField
|
|
145
|
+
class="w-60 shrink-0"
|
|
146
|
+
type="search"
|
|
147
|
+
variant="soft"
|
|
148
|
+
icon="search"
|
|
149
|
+
label={$t('workflows.list.searchLabel')}
|
|
150
|
+
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
151
|
+
hideLabel
|
|
152
|
+
bind:value={searchDraft}
|
|
153
|
+
oninput={() => list.setSearch(searchDraft)}
|
|
154
|
+
/>
|
|
155
|
+
<!-- The design draws this button outlined while the list could not be read (the error state has the main action). -->
|
|
156
|
+
<ActionButton
|
|
157
|
+
variant={list.loadState === 'failed' ? 'outline' : 'primary'}
|
|
158
|
+
onclick={() => (isCreating = true)}
|
|
159
|
+
>
|
|
160
|
+
<Icon name="plus" class="size-4" />
|
|
161
|
+
{$t('workflows.list.newWorkflow')}
|
|
162
|
+
</ActionButton>
|
|
163
|
+
</div>
|
|
164
|
+
{/if}
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<!-- Mobile: compact header + full-width search -->
|
|
168
|
+
<div class="flex shrink-0 flex-col gap-2 px-4 pt-4 pb-2 @3xl:hidden">
|
|
169
|
+
<div class="flex items-center justify-between gap-4">
|
|
170
|
+
<WorkflowsHeader class="min-w-0 flex-1" />
|
|
171
|
+
{#if !isLibraryEmpty}
|
|
172
|
+
<ActionButton
|
|
173
|
+
variant={list.loadState === 'failed' ? 'outline' : 'primary'}
|
|
174
|
+
iconOnly
|
|
175
|
+
ariaLabel={$t('workflows.list.newWorkflow')}
|
|
176
|
+
title={$t('workflows.list.newWorkflow')}
|
|
177
|
+
onclick={() => (isCreating = true)}
|
|
178
|
+
>
|
|
179
|
+
<Icon name="plus" class="size-4" />
|
|
180
|
+
</ActionButton>
|
|
181
|
+
{/if}
|
|
182
|
+
</div>
|
|
183
|
+
{#if !isLibraryEmpty}
|
|
184
|
+
<TextField
|
|
185
|
+
class="w-full min-w-0"
|
|
186
|
+
type="search"
|
|
187
|
+
variant="soft"
|
|
188
|
+
icon="search"
|
|
189
|
+
label={$t('workflows.list.searchLabel')}
|
|
190
|
+
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
191
|
+
hideLabel
|
|
192
|
+
bind:value={searchDraft}
|
|
193
|
+
oninput={() => list.setSearch(searchDraft)}
|
|
194
|
+
/>
|
|
195
|
+
{/if}
|
|
114
196
|
</div>
|
|
115
197
|
|
|
116
198
|
{#if list.notice}
|
|
117
199
|
{@const notice = list.notice}
|
|
118
|
-
<
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
200
|
+
<div class="px-4 pb-3 @3xl:px-8">
|
|
201
|
+
<Notice tone={notice.tone}>
|
|
202
|
+
{$t(notice.messageKey, notice.values)}
|
|
203
|
+
{#snippet action()}
|
|
204
|
+
<ActionButton variant="ghost" size="small" onclick={() => list.dismissNotice()}
|
|
205
|
+
>{$t('workflows.common.dismiss')}</ActionButton
|
|
206
|
+
>
|
|
207
|
+
{/snippet}
|
|
208
|
+
</Notice>
|
|
209
|
+
</div>
|
|
126
210
|
{/if}
|
|
127
211
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
label={$t('workflows.list.searchLabel')}
|
|
133
|
-
placeholder={$t('workflows.list.searchPlaceholder')}
|
|
134
|
-
hideLabel
|
|
135
|
-
bind:value={searchDraft}
|
|
136
|
-
oninput={() => list.setSearch(searchDraft)}
|
|
137
|
-
/>
|
|
138
|
-
<SelectField
|
|
139
|
-
class="w-44"
|
|
140
|
-
label={$t('workflows.list.filterLabel')}
|
|
141
|
-
value={list.statusFilter}
|
|
142
|
-
choices={statusChoices}
|
|
143
|
-
onchange={(filter) => list.setStatusFilter(filter as ListStatusFilter)}
|
|
144
|
-
/>
|
|
145
|
-
<SelectField
|
|
146
|
-
class="w-44"
|
|
147
|
-
label={$t('workflows.list.sortLabel')}
|
|
148
|
-
value={list.sortField}
|
|
149
|
-
choices={sortChoices}
|
|
150
|
-
onchange={(field) => list.setSort(field as WorkflowSortField)}
|
|
151
|
-
/>
|
|
152
|
-
<ActionButton
|
|
153
|
-
iconOnly
|
|
154
|
-
ariaLabel={list.sortDirection === 'asc'
|
|
155
|
-
? $t('workflows.list.sortAscending')
|
|
156
|
-
: $t('workflows.list.sortDescending')}
|
|
157
|
-
title={list.sortDirection === 'asc'
|
|
158
|
-
? $t('workflows.list.sortAscending')
|
|
159
|
-
: $t('workflows.list.sortDescending')}
|
|
160
|
-
onclick={() => list.toggleSortDirection()}
|
|
212
|
+
<!-- Toolbar: tabs + Status, then sort (not drawn while nothing has been made yet, as in the design) -->
|
|
213
|
+
{#if !isLibraryEmpty}
|
|
214
|
+
<div
|
|
215
|
+
class="flex shrink-0 flex-col gap-3 px-4 pb-3 @3xl:flex-row @3xl:items-center @3xl:justify-between @3xl:gap-2 @3xl:px-8 @3xl:pb-4"
|
|
161
216
|
>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
217
|
+
<!-- What the list covers, and the one state it is narrowed to; on a narrow screen Status has a row of its own. -->
|
|
218
|
+
<div class="flex min-w-0 flex-col gap-3 @3xl:flex-row @3xl:items-center @3xl:gap-2">
|
|
219
|
+
<Tabs
|
|
220
|
+
class="self-start @3xl:self-auto"
|
|
221
|
+
tabs={tabItems}
|
|
222
|
+
value={tabValue}
|
|
223
|
+
label={$t('workflows.list.filterLabel')}
|
|
224
|
+
idPrefix={listPanelId}
|
|
225
|
+
controls={listPanelId}
|
|
226
|
+
onselect={setTab}
|
|
227
|
+
/>
|
|
228
|
+
<SelectField
|
|
229
|
+
class="w-full min-w-0 @3xl:w-auto @3xl:flex-none"
|
|
230
|
+
label={$t('workflows.list.statusLabel')}
|
|
231
|
+
inlineLabel
|
|
232
|
+
value={list.statusChoice}
|
|
233
|
+
choices={statusChoices}
|
|
234
|
+
onchange={(choice) => list.chooseStatus(choice)}
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
<div class="flex w-full min-w-0 items-center gap-2 @3xl:w-auto @3xl:shrink-0">
|
|
238
|
+
<SelectField
|
|
239
|
+
class="min-w-0 flex-1 @3xl:w-52 @3xl:flex-none"
|
|
240
|
+
label={$t('workflows.list.sortLabel')}
|
|
241
|
+
inlineLabel
|
|
242
|
+
value={list.sortField}
|
|
243
|
+
choices={sortChoices}
|
|
244
|
+
onchange={(field) => list.setSort(field as WorkflowSortField)}
|
|
245
|
+
/>
|
|
246
|
+
<ActionButton
|
|
247
|
+
variant="outline"
|
|
248
|
+
iconOnly
|
|
249
|
+
ariaLabel={list.sortDirection === 'asc'
|
|
250
|
+
? $t('workflows.list.sortAscending')
|
|
251
|
+
: $t('workflows.list.sortDescending')}
|
|
252
|
+
title={list.sortDirection === 'asc'
|
|
253
|
+
? $t('workflows.list.sortAscending')
|
|
254
|
+
: $t('workflows.list.sortDescending')}
|
|
255
|
+
onclick={() => list.toggleSortDirection()}
|
|
256
|
+
>
|
|
257
|
+
<Icon
|
|
258
|
+
name={list.sortDirection === 'asc' ? 'arrowUp' : 'arrowDown'}
|
|
259
|
+
class="size-4 rtl:rotate-180"
|
|
260
|
+
/>
|
|
261
|
+
</ActionButton>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
{/if}
|
|
165
265
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
266
|
+
<!-- List body -->
|
|
267
|
+
<div
|
|
268
|
+
id={listPanelId}
|
|
269
|
+
role="tabpanel"
|
|
270
|
+
aria-labelledby="{listPanelId}-tab-{tabValue}"
|
|
271
|
+
class="flex min-h-0 flex-1 flex-col gap-1 overflow-auto px-4 pb-4 @3xl:px-4"
|
|
272
|
+
aria-label={$t('workflows.list.label')}
|
|
273
|
+
>
|
|
274
|
+
{#if list.loadState === 'loading'}
|
|
275
|
+
<!-- Figma "Loading": the rows' own shape in `bg-muted` (tile, name bar, details bar, state pill). -->
|
|
276
|
+
<div class="flex flex-col gap-1" role="status" aria-live="polite">
|
|
277
|
+
{#each [0, 1, 2, 3, 4, 5] as skeletonIndex (skeletonIndex)}
|
|
278
|
+
<div class="flex h-16 items-center gap-4 rounded-xl px-4 py-3">
|
|
279
|
+
<div class="size-10 shrink-0 rounded-lg bg-muted"></div>
|
|
280
|
+
<div class="flex min-w-0 flex-1 flex-col gap-2">
|
|
281
|
+
<div class="h-3 w-45 max-w-full rounded-full bg-muted"></div>
|
|
282
|
+
<div class="h-3 w-65 max-w-full rounded-full bg-muted"></div>
|
|
283
|
+
</div>
|
|
284
|
+
<div class="hidden h-5 w-18 shrink-0 rounded-full bg-muted @3xl:block"></div>
|
|
285
|
+
</div>
|
|
286
|
+
{/each}
|
|
287
|
+
</div>
|
|
288
|
+
<p class="sr-only">{$t('workflows.common.loading')}</p>
|
|
289
|
+
{:else if list.loadState === 'failed'}
|
|
290
|
+
<!-- Figma "Error": a centred state with the alert tile, what happened, and the one way on. -->
|
|
291
|
+
<div class="flex flex-1 flex-col items-center justify-center px-4 py-12">
|
|
292
|
+
<div
|
|
293
|
+
class="flex w-120 max-w-full flex-col items-center gap-3 px-12 text-center"
|
|
294
|
+
role="alert"
|
|
176
295
|
>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
>
|
|
192
|
-
<span>{$t('workflows.list.columnName')}</span>
|
|
193
|
-
<span>{$t('workflows.list.columnStatus')}</span>
|
|
194
|
-
<span>{$t('workflows.list.columnRuns')}</span>
|
|
195
|
-
<span>{$t('workflows.list.columnPublished')}</span>
|
|
196
|
-
<span>{$t('workflows.list.columnCreated')}</span>
|
|
197
|
-
<span class="w-8"></span>
|
|
296
|
+
<div class="flex size-12 items-center justify-center rounded-xl bg-destructive/10">
|
|
297
|
+
<Icon name="warning" class="size-4 text-destructive" />
|
|
298
|
+
</div>
|
|
299
|
+
<div class="flex w-full flex-col gap-1">
|
|
300
|
+
<h2 class="text-heading-section text-foreground">{$t('workflows.error.title')}</h2>
|
|
301
|
+
<p class="text-body text-muted-foreground">
|
|
302
|
+
{$t(list.failure ?? 'workflows.error.generic')}
|
|
303
|
+
</p>
|
|
304
|
+
</div>
|
|
305
|
+
<ActionButton class="mt-3" variant="primary" onclick={() => void list.load()}>
|
|
306
|
+
<Icon name="refresh" class="size-4" />
|
|
307
|
+
{$t('workflows.error.retry')}
|
|
308
|
+
</ActionButton>
|
|
309
|
+
</div>
|
|
198
310
|
</div>
|
|
199
|
-
|
|
311
|
+
{:else if list.items.length === 0}
|
|
312
|
+
{#if list.isNarrowed}
|
|
313
|
+
<!-- Figma "No matches": the same centred state as an empty list, with a search tile and the one line. -->
|
|
314
|
+
<div class="flex flex-1 flex-col items-center justify-center px-4 py-12" role="status">
|
|
315
|
+
<div class="flex w-120 max-w-full flex-col items-center gap-3 px-12 text-center">
|
|
316
|
+
<div class="flex size-12 items-center justify-center rounded-xl bg-brand-subtle">
|
|
317
|
+
<Icon name="search" class="size-4 text-brand-foreground" />
|
|
318
|
+
</div>
|
|
319
|
+
<h2 class="text-heading-section text-foreground">{$t('workflows.list.noMatches')}</h2>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
{:else}
|
|
323
|
+
<WorkflowsEmptyState oncreate={() => (isCreating = true)} />
|
|
324
|
+
{/if}
|
|
325
|
+
{:else}
|
|
326
|
+
<ul class="flex flex-col gap-1">
|
|
200
327
|
{#each list.items as item (item.id)}
|
|
201
328
|
<WorkflowRow {item} {onopen} {onshowembedcode} />
|
|
202
329
|
{/each}
|
|
203
330
|
</ul>
|
|
204
331
|
{#if list.hasMore}
|
|
205
332
|
<ActionButton
|
|
206
|
-
class="self-center"
|
|
333
|
+
class="mt-2 self-center"
|
|
207
334
|
disabled={list.loadingMore}
|
|
208
335
|
onclick={() => void list.loadMore()}
|
|
209
336
|
>
|
|
210
337
|
{list.loadingMore ? $t('workflows.common.loading') : $t('workflows.list.showMore')}
|
|
211
338
|
</ActionButton>
|
|
212
339
|
{/if}
|
|
213
|
-
|
|
214
|
-
|
|
340
|
+
{/if}
|
|
341
|
+
</div>
|
|
215
342
|
</div>
|
|
216
343
|
|
|
217
344
|
{#if isCreating}
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
import type { WorkflowListItem } from '../../api/types.js';
|
|
16
16
|
import { formatDay } from '../../editor/blockLabels.js';
|
|
17
17
|
import { deleteMessageOf } from '../../editor/deleteWords.js';
|
|
18
|
-
import { formatCount } from '../../editor/formatCount.js';
|
|
19
18
|
import { useListState } from '../../editor/listState.svelte.js';
|
|
20
19
|
import { useWorkflowsLanguage } from '../../i18n/language.js';
|
|
20
|
+
import { STATUS_WORD_KEYS } from '../../i18n/statusWords.js';
|
|
21
|
+
import Badge from '../ui/Badge.svelte';
|
|
21
22
|
import ConfirmDialog from '../ui/ConfirmDialog.svelte';
|
|
23
|
+
import Icon from '../ui/Icon.svelte';
|
|
22
24
|
import Menu from '../ui/Menu.svelte';
|
|
23
|
-
import StatusBadge from '../ui/StatusBadge.svelte';
|
|
24
25
|
import type { MenuGroup } from '../ui/types.js';
|
|
25
26
|
|
|
26
27
|
interface Props {
|
|
@@ -44,6 +45,27 @@
|
|
|
44
45
|
/** What the confirmation of a delete says goes with this workflow, by how far it got. */
|
|
45
46
|
const deleteMessage = $derived(deleteMessageOf(item));
|
|
46
47
|
|
|
48
|
+
const statusTone = $derived(
|
|
49
|
+
item.status === 'live'
|
|
50
|
+
? null
|
|
51
|
+
: item.status === 'paused'
|
|
52
|
+
? ('outline' as const)
|
|
53
|
+
: ('neutral' as const)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/** Whether there is anything to say with a badge: a state other than live, unpublished changes, or a teammate editing. */
|
|
57
|
+
const hasBadges = $derived(
|
|
58
|
+
statusTone !== null || (item.status === 'live' && item.unpublishedChanges) || editor !== null
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const rowLabel = $derived(
|
|
62
|
+
`${item.name} — ${$t(STATUS_WORD_KEYS[item.status])}${
|
|
63
|
+
item.unpublishedChanges && item.status === 'live'
|
|
64
|
+
? ` — ${$t('workflows.status.unpublishedChanges')}`
|
|
65
|
+
: ''
|
|
66
|
+
}`
|
|
67
|
+
);
|
|
68
|
+
|
|
47
69
|
const groups = $derived.by<MenuGroup[]>(() => {
|
|
48
70
|
const states: MenuGroup['items'][number][] = [];
|
|
49
71
|
if (item.status === 'live') {
|
|
@@ -129,55 +151,73 @@
|
|
|
129
151
|
await list.remove(item.id);
|
|
130
152
|
asking = null;
|
|
131
153
|
}
|
|
154
|
+
|
|
155
|
+
function openRow(): void {
|
|
156
|
+
onopen(item.id);
|
|
157
|
+
}
|
|
132
158
|
</script>
|
|
133
159
|
|
|
134
|
-
<li
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
160
|
+
<li class="list-none" aria-busy={isBusy}>
|
|
161
|
+
<!--
|
|
162
|
+
The row is a grid: the picture, the words, the badges and the menu. On a wide screen they stand in one line; on a phone the
|
|
163
|
+
badges go under the words and the menu stays at the end of the first line. The row whose menu is open is lifted (`z-30`), so
|
|
164
|
+
the menu is drawn over the rows below it and not under them.
|
|
165
|
+
-->
|
|
166
|
+
<div
|
|
167
|
+
class="group relative grid min-h-19 w-full grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-3 rounded-xl border border-transparent px-3 py-2 transition-colors duration-fast has-[[aria-expanded=true]]:z-30 hover:bg-accent @3xl:h-16 @3xl:min-h-0 @3xl:grid-cols-[auto_minmax(0,1fr)_auto_auto] @3xl:items-center @3xl:gap-x-4 @3xl:px-4 @3xl:py-0"
|
|
168
|
+
>
|
|
139
169
|
<button
|
|
140
170
|
type="button"
|
|
141
|
-
class="
|
|
142
|
-
|
|
143
|
-
onclick={
|
|
171
|
+
class="absolute inset-0 z-0 rounded-xl focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
172
|
+
aria-label={rowLabel}
|
|
173
|
+
onclick={openRow}
|
|
144
174
|
>
|
|
145
|
-
{item.name}
|
|
175
|
+
<span class="sr-only">{item.name}</span>
|
|
146
176
|
</button>
|
|
147
|
-
|
|
148
|
-
|
|
177
|
+
|
|
178
|
+
<!-- The picture of the workflow; on a phone it stands beside the words and the badges under them. -->
|
|
179
|
+
<div
|
|
180
|
+
class="pointer-events-none relative z-10 row-span-2 flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted transition-colors duration-fast group-hover:bg-background @3xl:row-span-1"
|
|
149
181
|
>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
182
|
+
<Icon name="route" class="size-4 text-foreground" />
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="pointer-events-none relative z-10 flex min-w-0 flex-col gap-0 text-start">
|
|
186
|
+
<span class="truncate text-body-medium text-foreground" dir="auto">{item.name}</span>
|
|
187
|
+
<p class="text-caption text-muted-foreground">
|
|
188
|
+
{$t('workflows.list.compositionsCount', { count: item.compositionIds.length })} ·
|
|
189
|
+
{$t('workflows.list.runsCount', { count: item.runsCount })} ·
|
|
190
|
+
{item.lastPublishedAt
|
|
191
|
+
? $t('workflows.list.publishedOn', { date: formatDay(item.lastPublishedAt, $locale) })
|
|
192
|
+
: $t('workflows.list.neverPublished')}
|
|
193
|
+
</p>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
{#if hasBadges}
|
|
197
|
+
<div
|
|
198
|
+
class="pointer-events-none relative z-10 col-start-2 mt-1 flex min-w-0 flex-wrap items-center gap-2 @3xl:col-start-3 @3xl:row-start-1 @3xl:mt-0 @3xl:justify-end"
|
|
155
199
|
>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
200
|
+
{#if statusTone}
|
|
201
|
+
<Badge tone={statusTone} showDot={item.status === 'live'}>
|
|
202
|
+
{$t(STATUS_WORD_KEYS[item.status])}
|
|
203
|
+
</Badge>
|
|
204
|
+
{/if}
|
|
205
|
+
{#if item.status === 'live' && item.unpublishedChanges}
|
|
206
|
+
<Badge tone="outline">{$t('workflows.status.unpublishedChanges')}</Badge>
|
|
207
|
+
{/if}
|
|
208
|
+
{#if editor}
|
|
209
|
+
<span data-workflows-editing>
|
|
210
|
+
<Badge tone="outline">
|
|
211
|
+
{editor.name
|
|
212
|
+
? $t('workflows.list.editingNamed', { name: editor.name })
|
|
213
|
+
: $t('workflows.list.editingSomeone')}
|
|
214
|
+
</Badge>
|
|
215
|
+
</span>
|
|
216
|
+
{/if}
|
|
217
|
+
</div>
|
|
163
218
|
{/if}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<StatusBadge status={item.status} hasUnpublishedChanges={item.unpublishedChanges} />
|
|
167
|
-
</div>
|
|
168
|
-
<span class="hidden text-sm @2xl:block">{formatCount(item.runsCount, $locale)}</span>
|
|
169
|
-
<span class="hidden text-sm text-ink-muted @2xl:block">
|
|
170
|
-
{item.lastPublishedAt ? formatDay(item.lastPublishedAt, $locale) : $t('workflows.list.never')}
|
|
171
|
-
</span>
|
|
172
|
-
<span class="hidden text-sm text-ink-muted @2xl:block">{formatDay(item.createdAt, $locale)}</span>
|
|
173
|
-
<!-- On a narrow screen the figures that have no column of their own are one line under the name. -->
|
|
174
|
-
<p class="col-span-2 text-xs text-ink-muted @2xl:hidden">
|
|
175
|
-
{$t('workflows.list.runsCount', { count: item.runsCount })} ·
|
|
176
|
-
{item.lastPublishedAt
|
|
177
|
-
? $t('workflows.list.publishedOn', { date: formatDay(item.lastPublishedAt, $locale) })
|
|
178
|
-
: $t('workflows.list.neverPublished')}
|
|
179
|
-
</p>
|
|
180
|
-
<div class="col-start-2 row-start-1 @2xl:col-start-auto @2xl:row-start-auto">
|
|
219
|
+
|
|
220
|
+
<!-- With a mouse the menu shows when the row is pointed at, focused or open; on a touch screen it is always there. -->
|
|
181
221
|
<Menu
|
|
182
222
|
{groups}
|
|
183
223
|
label={$t('workflows.list.rowMenu', { name: item.name })}
|
|
@@ -187,6 +227,7 @@
|
|
|
187
227
|
size="small"
|
|
188
228
|
align="end"
|
|
189
229
|
disabled={isBusy}
|
|
230
|
+
class="relative z-20 col-start-3 row-start-1 self-start transition-opacity duration-fast @3xl:col-start-4 @3xl:self-center pointer-fine:opacity-0 pointer-fine:group-focus-within:opacity-100 pointer-fine:group-hover:opacity-100 pointer-fine:[.group:has([aria-expanded=true])_&]:opacity-100"
|
|
190
231
|
/>
|
|
191
232
|
</div>
|
|
192
233
|
</li>
|
|
@@ -196,6 +237,7 @@
|
|
|
196
237
|
title={$t('workflows.settings.archiveTitle')}
|
|
197
238
|
message={$t('workflows.settings.archiveMessage')}
|
|
198
239
|
confirmLabel={$t('workflows.settings.archive')}
|
|
240
|
+
tone="normal"
|
|
199
241
|
busy={isBusy}
|
|
200
242
|
onconfirm={() => void confirmArchive()}
|
|
201
243
|
oncancel={() => (asking = null)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
What the check finds wrong with one block, in sentences, under the form of that block. The draft is checked all the time
|
|
3
3
|
with the engine's own rules (the same ones the publish applies), so a person sees what stops a publish while they build
|
|
4
|
-
instead of after they press the button.
|
|
4
|
+
instead of after they press the button. The mark is red for what stops a publish; warnings are advice and carry the amber mark.
|
|
5
5
|
-->
|
|
6
6
|
<script lang="ts">
|
|
7
7
|
import { describeBlocksUniquely } from '../../editor/blockLabels.js';
|
|
@@ -32,14 +32,15 @@
|
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
{#if sentences.length > 0}
|
|
35
|
-
<ul class="flex flex-col gap-
|
|
35
|
+
<ul class="flex flex-col gap-2" aria-label={$t('workflows.panel.problemsLabel')}>
|
|
36
36
|
{#each sentences as sentence, index (index)}
|
|
37
|
-
<li
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
<li class="flex items-start gap-2 text-body text-foreground">
|
|
38
|
+
<Icon
|
|
39
|
+
name="warning"
|
|
40
|
+
class="mt-0.5 size-4 shrink-0 {sentence.severity === 'error'
|
|
41
|
+
? 'text-destructive'
|
|
42
|
+
: 'text-warning'}"
|
|
43
|
+
/>
|
|
43
44
|
<span>{sentence.text}</span>
|
|
44
45
|
</li>
|
|
45
46
|
{/each}
|