@shware/workflow-ui 2.0.0 → 2.0.2
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/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +95 -88
- package/dist/index.mjs.map +1 -1
- package/dist/postgres.mjs +4 -4
- package/dist/postgres.mjs.map +1 -1
- package/package.json +2 -2
- package/src/app/integrations/theme/root-provider.tsx +24 -12
- package/src/app/integrations/toast/toast-provider.tsx +2 -2
- package/src/app/routes/__root.tsx +9 -9
- package/src/app/routes/emails.tsx +2 -2
- package/src/app/routes/home.tsx +4 -4
- package/src/app/routes/metrics.tsx +19 -19
- package/src/app/routes/segment-overview.tsx +21 -21
- package/src/app/routes/segments.tsx +2 -2
- package/src/app/routes/settings.tsx +6 -6
- package/src/app/routes/workflows.tsx +5 -5
- package/src/components/avatar.tsx +1 -1
- package/src/components/breadcrumb.tsx +3 -3
- package/src/components/button/index.tsx +4 -4
- package/src/components/chat-markup.tsx +6 -6
- package/src/components/date-range.tsx +16 -8
- package/src/components/dropdown/index.tsx +18 -10
- package/src/components/email-defaults.tsx +3 -3
- package/src/components/email-list.tsx +6 -6
- package/src/components/flag.tsx +17 -11
- package/src/components/input/index.tsx +2 -2
- package/src/components/input/search-input.tsx +1 -1
- package/src/components/menu/index.tsx +12 -4
- package/src/components/metric-card.tsx +7 -7
- package/src/components/modal/index.tsx +4 -3
- package/src/components/nav-drawer.tsx +3 -3
- package/src/components/node-inspector.tsx +5 -5
- package/src/components/profile-drawer.tsx +37 -23
- package/src/components/segment-list.tsx +9 -9
- package/src/components/select/index.tsx +3 -3
- package/src/components/slack-preview.tsx +33 -30
- package/src/components/tabs/index.tsx +2 -2
- package/src/components/templates-page.tsx +23 -23
- package/src/components/textarea/index.tsx +2 -2
- package/src/components/thumbnail-window.tsx +1 -1
- package/src/components/workflow-list.tsx +8 -8
- package/src/postgres.ts +4 -2
|
@@ -36,8 +36,8 @@ export interface NodeInspectorProps {
|
|
|
36
36
|
function Field({ label, children }: { label: string; children: ReactNode }) {
|
|
37
37
|
return (
|
|
38
38
|
<>
|
|
39
|
-
<dt className="text-muted
|
|
40
|
-
<dd className="
|
|
39
|
+
<dt className="whitespace-nowrap text-muted">{label}</dt>
|
|
40
|
+
<dd className="min-w-0 break-words text-secondary">{children}</dd>
|
|
41
41
|
</>
|
|
42
42
|
);
|
|
43
43
|
}
|
|
@@ -185,17 +185,17 @@ export function NodeInspector({ node, source, onClose, preview }: NodeInspectorP
|
|
|
185
185
|
|
|
186
186
|
return (
|
|
187
187
|
<aside
|
|
188
|
-
className="
|
|
188
|
+
className="flex max-h-full w-80 flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-[0_4px_12px_var(--color-card-shadow)]"
|
|
189
189
|
style={superellipse}
|
|
190
190
|
>
|
|
191
191
|
<div className="flex h-12 shrink-0 items-center gap-3 pr-2.5 pl-4">
|
|
192
|
-
<span className="
|
|
192
|
+
<span className="flex-1 text-sm font-semibold text-primary">
|
|
193
193
|
{t(`inspector.type.${node.type}`)}
|
|
194
194
|
</span>
|
|
195
195
|
<button
|
|
196
196
|
type="button"
|
|
197
197
|
onClick={onClose}
|
|
198
|
-
className="
|
|
198
|
+
className="flex size-7 items-center justify-center rounded-lg text-muted transition-colors hover:bg-hover hover:text-primary"
|
|
199
199
|
style={superellipse}
|
|
200
200
|
aria-label={t('inspector.close')}
|
|
201
201
|
>
|
|
@@ -67,14 +67,14 @@ function Section({
|
|
|
67
67
|
}) {
|
|
68
68
|
/* Top border, inset by the drawer's padding — the divider stops short of the edges. */
|
|
69
69
|
return (
|
|
70
|
-
<section className="border-
|
|
70
|
+
<section className="border-t border-border py-4">
|
|
71
71
|
<button
|
|
72
72
|
type="button"
|
|
73
73
|
aria-expanded={open}
|
|
74
74
|
onClick={onToggle}
|
|
75
75
|
className="flex w-full items-center justify-between text-left"
|
|
76
76
|
>
|
|
77
|
-
<span className="text-
|
|
77
|
+
<span className="text-sm font-semibold text-primary">{title}</span>
|
|
78
78
|
<ChevronDown
|
|
79
79
|
size={16}
|
|
80
80
|
strokeWidth={2}
|
|
@@ -106,8 +106,8 @@ function Row({
|
|
|
106
106
|
}) {
|
|
107
107
|
return (
|
|
108
108
|
<>
|
|
109
|
-
<dt className="text-muted
|
|
110
|
-
<dd className="
|
|
109
|
+
<dt className="whitespace-nowrap text-muted">{label}</dt>
|
|
110
|
+
<dd className="flex min-w-0 items-center justify-end gap-1.5 text-secondary">
|
|
111
111
|
{leading}
|
|
112
112
|
<span className="min-w-0 truncate text-right" title={formatValue(value)}>
|
|
113
113
|
{formatValue(value)}
|
|
@@ -118,7 +118,34 @@ function Row({
|
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
async function copyText(value: string): Promise<boolean> {
|
|
122
|
+
try {
|
|
123
|
+
await navigator.clipboard.writeText(value);
|
|
124
|
+
return true;
|
|
125
|
+
} catch {
|
|
126
|
+
// Clipboard permissions and embedded webviews can require the legacy fallback.
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const area = document.createElement('textarea');
|
|
130
|
+
const previousFocus = document.activeElement;
|
|
131
|
+
area.value = value;
|
|
132
|
+
area.readOnly = true;
|
|
133
|
+
area.style.position = 'fixed';
|
|
134
|
+
area.style.opacity = '0';
|
|
135
|
+
try {
|
|
136
|
+
document.body.append(area);
|
|
137
|
+
area.select();
|
|
138
|
+
// oxlint-disable-next-line typescript/no-deprecated -- Only used when the Clipboard API is unavailable or rejects permission.
|
|
139
|
+
return document.execCommand('copy');
|
|
140
|
+
} catch {
|
|
141
|
+
return false;
|
|
142
|
+
} finally {
|
|
143
|
+
area.remove();
|
|
144
|
+
if (previousFocus instanceof HTMLElement) previousFocus.focus();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Copy-to-clipboard tail for identity rows, flipping to a check only after success. */
|
|
122
149
|
function CopyButton({ label, value }: { label: string; value: string }) {
|
|
123
150
|
const [copied, setCopied] = useState(false);
|
|
124
151
|
useEffect(() => {
|
|
@@ -132,22 +159,9 @@ function CopyButton({ label, value }: { label: string; value: string }) {
|
|
|
132
159
|
aria-label={label}
|
|
133
160
|
title={label}
|
|
134
161
|
onClick={() => {
|
|
135
|
-
void (
|
|
136
|
-
try {
|
|
137
|
-
await navigator.clipboard.writeText(value);
|
|
138
|
-
} catch {
|
|
139
|
-
/* Clipboard API can be permission-gated (embedded webviews); fall back. */
|
|
140
|
-
const area = document.createElement('textarea');
|
|
141
|
-
area.value = value;
|
|
142
|
-
document.body.append(area);
|
|
143
|
-
area.select();
|
|
144
|
-
document.execCommand('copy');
|
|
145
|
-
area.remove();
|
|
146
|
-
}
|
|
147
|
-
setCopied(true);
|
|
148
|
-
})();
|
|
162
|
+
void copyText(value).then(setCopied);
|
|
149
163
|
}}
|
|
150
|
-
className="
|
|
164
|
+
className="flex size-6 shrink-0 items-center justify-center rounded-md text-muted transition-colors hover:bg-hover hover:text-primary"
|
|
151
165
|
style={superellipse}
|
|
152
166
|
>
|
|
153
167
|
{copied ? (
|
|
@@ -214,7 +228,7 @@ export function ProfileDrawer({ profile, onClose }: ProfileDrawerProps) {
|
|
|
214
228
|
|
|
215
229
|
<aside
|
|
216
230
|
aria-hidden={!open}
|
|
217
|
-
className={`
|
|
231
|
+
className={`fixed inset-y-0 right-0 z-30 flex w-96 max-w-full flex-col border-l border-border bg-card shadow-xl transition-transform duration-200 ease-out ${
|
|
218
232
|
open ? 'translate-x-0' : 'translate-x-full'
|
|
219
233
|
}`}
|
|
220
234
|
>
|
|
@@ -230,7 +244,7 @@ export function ProfileDrawer({ profile, onClose }: ProfileDrawerProps) {
|
|
|
230
244
|
<div className="truncate text-sm font-semibold">
|
|
231
245
|
{name ?? email ?? profile?.id ?? ''}
|
|
232
246
|
</div>
|
|
233
|
-
<div className="text-
|
|
247
|
+
<div className="truncate text-xs text-muted">
|
|
234
248
|
{name !== undefined ? (email ?? profile?.id ?? '') : (profile?.id ?? '')}
|
|
235
249
|
</div>
|
|
236
250
|
</div>
|
|
@@ -238,7 +252,7 @@ export function ProfileDrawer({ profile, onClose }: ProfileDrawerProps) {
|
|
|
238
252
|
type="button"
|
|
239
253
|
onClick={onClose}
|
|
240
254
|
aria-label={t('common.close')}
|
|
241
|
-
className="
|
|
255
|
+
className="flex size-8 shrink-0 items-center justify-center rounded-lg text-muted transition-colors hover:bg-hover hover:text-primary"
|
|
242
256
|
style={superellipse}
|
|
243
257
|
>
|
|
244
258
|
<X className="size-4" strokeWidth={2} />
|
|
@@ -70,10 +70,10 @@ export function SegmentList({ items, reports, onOpen }: SegmentListProps) {
|
|
|
70
70
|
* the page is the one scroller (see __root). Nothing clips, so the corners
|
|
71
71
|
* are re-cut on the first and last cells below.
|
|
72
72
|
*/
|
|
73
|
-
<div className="border-border bg-card
|
|
73
|
+
<div className="rounded-2xl border border-border bg-card" style={superellipse}>
|
|
74
74
|
<table className="w-full table-fixed border-separate border-spacing-0 text-sm max-md:block">
|
|
75
75
|
<thead className="max-md:hidden">
|
|
76
|
-
<tr className="text-
|
|
76
|
+
<tr className="text-left text-xs font-medium text-muted">
|
|
77
77
|
<th className={clsx(HEAD_CELL, 'min-w-0 px-6')} style={superellipse}>
|
|
78
78
|
{t('common.name')}
|
|
79
79
|
</th>
|
|
@@ -112,7 +112,7 @@ export function SegmentList({ items, reports, onOpen }: SegmentListProps) {
|
|
|
112
112
|
'max-md:last:border-b-0',
|
|
113
113
|
'last:[&>td]:border-b-0 md:last:[&>td:first-child]:rounded-bl-2xl',
|
|
114
114
|
'md:last:[&>td:last-child]:rounded-br-2xl',
|
|
115
|
-
onOpen && 'max-md:hover:bg-hover md:hover:[&>td]:bg-hover
|
|
115
|
+
onOpen && 'cursor-pointer max-md:hover:bg-hover md:hover:[&>td]:bg-hover'
|
|
116
116
|
)}
|
|
117
117
|
style={superellipse}
|
|
118
118
|
>
|
|
@@ -121,7 +121,7 @@ export function SegmentList({ items, reports, onOpen }: SegmentListProps) {
|
|
|
121
121
|
style={superellipse}
|
|
122
122
|
>
|
|
123
123
|
<div className="flex items-start gap-3">
|
|
124
|
-
<Users className="
|
|
124
|
+
<Users className="mt-0.5 size-4 shrink-0 text-muted" strokeWidth={2} />
|
|
125
125
|
<div className="min-w-0">
|
|
126
126
|
<div className="flex items-center gap-2 font-medium">
|
|
127
127
|
{label !== '' ? (
|
|
@@ -139,9 +139,9 @@ export function SegmentList({ items, reports, onOpen }: SegmentListProps) {
|
|
|
139
139
|
)}
|
|
140
140
|
</div>
|
|
141
141
|
{item.description !== undefined && (
|
|
142
|
-
<p className="
|
|
142
|
+
<p className="mt-1 truncate text-sm text-secondary">{item.description}</p>
|
|
143
143
|
)}
|
|
144
|
-
<div className="
|
|
144
|
+
<div className="mt-2 truncate text-xs text-muted">
|
|
145
145
|
{item.usedBy.length === 0
|
|
146
146
|
? t('segments.unused')
|
|
147
147
|
: `${t('segments.usedBy')}: ${item.usedBy.join(', ')}`}
|
|
@@ -154,14 +154,14 @@ export function SegmentList({ items, reports, onOpen }: SegmentListProps) {
|
|
|
154
154
|
className={clsx(CELL, 'px-3 max-md:order-2 max-md:pt-0 max-md:pb-4')}
|
|
155
155
|
style={superellipse}
|
|
156
156
|
>
|
|
157
|
-
<div className="
|
|
157
|
+
<div className="mb-1 truncate text-xs text-muted md:hidden">
|
|
158
158
|
{t('segments.size')}
|
|
159
159
|
</div>
|
|
160
160
|
<div className="tabular-nums">
|
|
161
161
|
{report === undefined ? '—' : compact(report.size)}
|
|
162
162
|
</div>
|
|
163
163
|
{movement !== undefined && (
|
|
164
|
-
<div className="
|
|
164
|
+
<div className="mt-1 text-xs text-muted tabular-nums">{movement.text}</div>
|
|
165
165
|
)}
|
|
166
166
|
</td>
|
|
167
167
|
|
|
@@ -169,7 +169,7 @@ export function SegmentList({ items, reports, onOpen }: SegmentListProps) {
|
|
|
169
169
|
className={clsx(CELL, 'px-3 max-md:order-3 max-md:pt-0 max-md:pb-4')}
|
|
170
170
|
style={superellipse}
|
|
171
171
|
>
|
|
172
|
-
<div className="
|
|
172
|
+
<div className="mb-1 truncate text-xs text-muted md:hidden">
|
|
173
173
|
{t('segments.overTime')}
|
|
174
174
|
</div>
|
|
175
175
|
<Sparkline values={report?.series ?? []} />
|
|
@@ -41,8 +41,8 @@ export function Select({
|
|
|
41
41
|
value={value}
|
|
42
42
|
className={cn(
|
|
43
43
|
'w-full cursor-pointer appearance-none truncate transition-colors duration-100',
|
|
44
|
-
'bg-textfield focus-visible:border-accent
|
|
45
|
-
'
|
|
44
|
+
'border bg-textfield focus:outline-none focus-visible:border-accent',
|
|
45
|
+
'focus-visible:ring-accent/40 dark:focus-visible:ring-accent/50',
|
|
46
46
|
value === '' || value === undefined ? 'text-placeholder' : 'text-primary',
|
|
47
47
|
SIZE_STYLE[size]
|
|
48
48
|
)}
|
|
@@ -63,7 +63,7 @@ export function Select({
|
|
|
63
63
|
size={16}
|
|
64
64
|
strokeWidth={2}
|
|
65
65
|
aria-hidden
|
|
66
|
-
className="
|
|
66
|
+
className="pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 text-secondary"
|
|
67
67
|
/>
|
|
68
68
|
</div>
|
|
69
69
|
);
|
|
@@ -36,38 +36,39 @@ const textOf = (value: unknown): TextObject | undefined => {
|
|
|
36
36
|
return typeof object.text === 'string' ? (object as TextObject) : undefined;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const linkClass = 'text-[#1d9bd1] hover:underline';
|
|
40
|
+
const Text = ({ value, className }: { value: TextObject | undefined; className?: string }) =>
|
|
41
|
+
value === undefined ? null : (
|
|
42
|
+
<div className={`break-words whitespace-pre-wrap ${className ?? ''}`}>
|
|
43
|
+
{value.type === 'mrkdwn' ? (
|
|
44
|
+
<ChatMarkup text={value.text} dialect="slack" linkClass={linkClass} />
|
|
45
|
+
) : (
|
|
46
|
+
value.text
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
const Button = ({ element, colors }: { element: Element; colors: (typeof PALETTE)['light'] }) => {
|
|
51
|
+
const style = element.style as string | undefined;
|
|
52
|
+
return (
|
|
53
|
+
<span
|
|
54
|
+
className="inline-flex h-8 items-center rounded-lg border px-3 text-[13px] font-bold"
|
|
55
|
+
style={
|
|
56
|
+
style === 'primary'
|
|
57
|
+
? { background: '#007a5a', borderColor: '#007a5a', color: '#fff' }
|
|
58
|
+
: style === 'danger'
|
|
59
|
+
? { background: '#e01e5a', borderColor: '#e01e5a', color: '#fff' }
|
|
60
|
+
: { borderColor: colors.border, color: colors.name }
|
|
61
|
+
}
|
|
62
|
+
>
|
|
63
|
+
{textOf(element.text)?.text}
|
|
64
|
+
</span>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
39
68
|
export function SlackPreview({ message, appName, scheme, zoom }: SlackPreviewProps) {
|
|
40
69
|
const { t } = useTranslation();
|
|
41
70
|
const colors = PALETTE[scheme];
|
|
42
71
|
const name = message.username ?? appName;
|
|
43
|
-
const linkClass = 'text-[#1d9bd1] hover:underline';
|
|
44
|
-
const Text = ({ value, className }: { value: TextObject | undefined; className?: string }) =>
|
|
45
|
-
value === undefined ? null : (
|
|
46
|
-
<div className={`break-words whitespace-pre-wrap ${className ?? ''}`}>
|
|
47
|
-
{value.type === 'mrkdwn' ? (
|
|
48
|
-
<ChatMarkup text={value.text} dialect="slack" linkClass={linkClass} />
|
|
49
|
-
) : (
|
|
50
|
-
value.text
|
|
51
|
-
)}
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
const Button = ({ element }: { element: Element }) => {
|
|
55
|
-
const style = element.style as string | undefined;
|
|
56
|
-
return (
|
|
57
|
-
<span
|
|
58
|
-
className="inline-flex h-8 items-center rounded-lg border px-3 text-[13px] font-bold"
|
|
59
|
-
style={
|
|
60
|
-
style === 'primary'
|
|
61
|
-
? { background: '#007a5a', borderColor: '#007a5a', color: '#fff' }
|
|
62
|
-
: style === 'danger'
|
|
63
|
-
? { background: '#e01e5a', borderColor: '#e01e5a', color: '#fff' }
|
|
64
|
-
: { borderColor: colors.border, color: colors.name }
|
|
65
|
-
}
|
|
66
|
-
>
|
|
67
|
-
{textOf(element.text)?.text}
|
|
68
|
-
</span>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
72
|
|
|
72
73
|
const blocks = (message.blocks ?? []) as Element[];
|
|
73
74
|
return (
|
|
@@ -154,7 +155,9 @@ export function SlackPreview({ message, appName, scheme, zoom }: SlackPreviewPro
|
|
|
154
155
|
className="size-[88px] shrink-0 rounded-lg object-cover"
|
|
155
156
|
/>
|
|
156
157
|
)}
|
|
157
|
-
{accessory?.type === 'button' &&
|
|
158
|
+
{accessory?.type === 'button' && (
|
|
159
|
+
<Button element={accessory} colors={colors} />
|
|
160
|
+
)}
|
|
158
161
|
</div>
|
|
159
162
|
);
|
|
160
163
|
}
|
|
@@ -187,7 +190,7 @@ export function SlackPreview({ message, appName, scheme, zoom }: SlackPreviewPro
|
|
|
187
190
|
{((block.elements as Element[] | undefined) ?? []).map((element, i) =>
|
|
188
191
|
element.type === 'button' ? (
|
|
189
192
|
// oxlint-disable-next-line react/no-array-index-key -- elements are positional
|
|
190
|
-
<Button key={i} element={element} />
|
|
193
|
+
<Button key={i} element={element} colors={colors} />
|
|
191
194
|
) : null
|
|
192
195
|
)}
|
|
193
196
|
</div>
|
|
@@ -24,7 +24,7 @@ interface Props {
|
|
|
24
24
|
export function Tabs({ items, params, className }: Props) {
|
|
25
25
|
return (
|
|
26
26
|
<nav
|
|
27
|
-
className={cn('
|
|
27
|
+
className={cn('flex items-center gap-0.5 rounded-lg bg-selected p-0.5', className)}
|
|
28
28
|
style={superellipse}
|
|
29
29
|
>
|
|
30
30
|
{items.map((item) => (
|
|
@@ -33,7 +33,7 @@ export function Tabs({ items, params, className }: Props) {
|
|
|
33
33
|
to={item.to as LinkProps['to']}
|
|
34
34
|
params={params as LinkProps['params']}
|
|
35
35
|
activeOptions={{ exact: item.exact ?? false }}
|
|
36
|
-
className="
|
|
36
|
+
className="rounded-md px-3 py-1 text-sm font-medium text-secondary transition-colors hover:text-primary"
|
|
37
37
|
activeProps={{ className: '!bg-card !text-primary shadow-sm' }}
|
|
38
38
|
style={superellipse}
|
|
39
39
|
>
|
|
@@ -93,8 +93,8 @@ export interface TemplatesPageProps {
|
|
|
93
93
|
function Field({ label, children }: { label: string; children: ReactNode }) {
|
|
94
94
|
return (
|
|
95
95
|
<>
|
|
96
|
-
<dt className="text-muted
|
|
97
|
-
<dd className="
|
|
96
|
+
<dt className="whitespace-nowrap text-muted">{label}</dt>
|
|
97
|
+
<dd className="min-w-0 break-words text-secondary">{children}</dd>
|
|
98
98
|
</>
|
|
99
99
|
);
|
|
100
100
|
}
|
|
@@ -166,9 +166,9 @@ function PreviewPropsEditor({
|
|
|
166
166
|
const [draft, setDraft] = useState<string | undefined>(undefined);
|
|
167
167
|
const text = draft ?? JSON.stringify(initial, null, 2);
|
|
168
168
|
return (
|
|
169
|
-
<div className="border-border bg-card
|
|
169
|
+
<div className="border-b border-border bg-card px-6 py-4">
|
|
170
170
|
<div className="flex items-center justify-between">
|
|
171
|
-
<label htmlFor="preview-props" className="text-
|
|
171
|
+
<label htmlFor="preview-props" className="text-sm text-muted">
|
|
172
172
|
{t('emails.previewProps')}
|
|
173
173
|
</label>
|
|
174
174
|
<button
|
|
@@ -177,7 +177,7 @@ function PreviewPropsEditor({
|
|
|
177
177
|
setDraft(undefined);
|
|
178
178
|
onReset();
|
|
179
179
|
}}
|
|
180
|
-
className="text-muted hover:text-primary
|
|
180
|
+
className="text-xs text-muted transition-colors hover:text-primary"
|
|
181
181
|
>
|
|
182
182
|
{t('emails.previewPropsReset')}
|
|
183
183
|
</button>
|
|
@@ -206,7 +206,7 @@ function PreviewPropsEditor({
|
|
|
206
206
|
onChange(parsed as Props);
|
|
207
207
|
}}
|
|
208
208
|
/>
|
|
209
|
-
<p className="
|
|
209
|
+
<p className="mt-1.5 text-xs text-muted">{t('emails.previewPropsHint')}</p>
|
|
210
210
|
</div>
|
|
211
211
|
);
|
|
212
212
|
}
|
|
@@ -335,9 +335,9 @@ export function TemplatesPage({
|
|
|
335
335
|
return (
|
|
336
336
|
<div className="flex flex-1">
|
|
337
337
|
{/* Preview; the template list lives on the /emails index and the header dropdown. */}
|
|
338
|
-
<section className="
|
|
338
|
+
<section className="flex min-w-0 flex-1 flex-col bg-page">
|
|
339
339
|
{active === undefined ? (
|
|
340
|
-
<div className="
|
|
340
|
+
<div className="flex flex-1 items-center justify-center text-sm text-muted">
|
|
341
341
|
{selected === undefined ? t('emails.empty') : t('emails.notFound', { key: selected })}
|
|
342
342
|
</div>
|
|
343
343
|
) : (
|
|
@@ -348,7 +348,7 @@ export function TemplatesPage({
|
|
|
348
348
|
the project's envelope; a push's "envelope" is its content.
|
|
349
349
|
*/}
|
|
350
350
|
{((isEmail && activeEmail !== undefined) || push !== undefined) && (
|
|
351
|
-
<div className="border-border bg-card
|
|
351
|
+
<div className="border-b border-border bg-card px-6 py-4">
|
|
352
352
|
<dl className="grid grid-cols-[max-content_1fr] gap-x-8 gap-y-2.5 text-sm">
|
|
353
353
|
{isEmail && activeEmail !== undefined && resolved !== undefined && (
|
|
354
354
|
<>
|
|
@@ -419,13 +419,13 @@ export function TemplatesPage({
|
|
|
419
419
|
{isChat ? (
|
|
420
420
|
(isDiscord ? activeDiscord : activeSlack) === undefined ? (
|
|
421
421
|
<div
|
|
422
|
-
className="
|
|
422
|
+
className="mx-auto max-w-xl rounded-2xl border border-dashed border-border bg-card p-8 text-center"
|
|
423
423
|
style={superellipse}
|
|
424
424
|
>
|
|
425
|
-
<p className="text-
|
|
425
|
+
<p className="text-sm font-medium text-primary">
|
|
426
426
|
{t('emails.notRegistered')}
|
|
427
427
|
</p>
|
|
428
|
-
<p className="
|
|
428
|
+
<p className="mt-2 text-sm text-muted">
|
|
429
429
|
{t('emails.chatNotRegisteredHint', {
|
|
430
430
|
key: active.key,
|
|
431
431
|
channel: isDiscord ? 'discord' : 'slack',
|
|
@@ -452,13 +452,13 @@ export function TemplatesPage({
|
|
|
452
452
|
) : isPush ? (
|
|
453
453
|
activePush === undefined ? (
|
|
454
454
|
<div
|
|
455
|
-
className="
|
|
455
|
+
className="mx-auto max-w-xl rounded-2xl border border-dashed border-border bg-card p-8 text-center"
|
|
456
456
|
style={superellipse}
|
|
457
457
|
>
|
|
458
|
-
<p className="text-
|
|
458
|
+
<p className="text-sm font-medium text-primary">
|
|
459
459
|
{t('emails.notRegistered')}
|
|
460
460
|
</p>
|
|
461
|
-
<p className="
|
|
461
|
+
<p className="mt-2 text-sm text-muted">
|
|
462
462
|
{t('emails.pushNotRegisteredHint', { key: active.key })}
|
|
463
463
|
</p>
|
|
464
464
|
</div>
|
|
@@ -475,18 +475,18 @@ export function TemplatesPage({
|
|
|
475
475
|
)
|
|
476
476
|
) : activeEmail === undefined ? (
|
|
477
477
|
<div
|
|
478
|
-
className="
|
|
478
|
+
className="mx-auto max-w-xl rounded-2xl border border-dashed border-border bg-card p-8 text-center"
|
|
479
479
|
style={superellipse}
|
|
480
480
|
>
|
|
481
|
-
<p className="text-
|
|
482
|
-
<p className="
|
|
481
|
+
<p className="text-sm font-medium text-primary">{t('emails.notRegistered')}</p>
|
|
482
|
+
<p className="mt-2 text-sm text-muted">
|
|
483
483
|
{t('emails.notRegisteredHint', { key: active.key })}
|
|
484
484
|
</p>
|
|
485
485
|
</div>
|
|
486
486
|
) : failure !== undefined ? (
|
|
487
487
|
<TemplateFailurePanel failure={failure} />
|
|
488
488
|
) : loading ? (
|
|
489
|
-
<div className="text-
|
|
489
|
+
<div className="text-center text-sm text-muted">{t('emails.rendering')}</div>
|
|
490
490
|
) : error !== undefined ? (
|
|
491
491
|
<div
|
|
492
492
|
className="mx-auto max-w-xl rounded-2xl border border-red-200 bg-red-50 p-6 text-sm text-red-700 dark:border-red-400/20 dark:bg-red-400/10 dark:text-red-300"
|
|
@@ -546,7 +546,7 @@ export function TemplatesPage({
|
|
|
546
546
|
error === undefined &&
|
|
547
547
|
failure === undefined) && (
|
|
548
548
|
<div className="pointer-events-none sticky bottom-0 z-10 flex justify-center pt-2 pb-4">
|
|
549
|
-
<div className="
|
|
549
|
+
<div className="pointer-events-auto flex items-center gap-0.5 rounded-full border border-border bg-card p-1 shadow-lg">
|
|
550
550
|
<ToolButton
|
|
551
551
|
active={scheme === 'light'}
|
|
552
552
|
label={t('emails.previewLight')}
|
|
@@ -564,7 +564,7 @@ export function TemplatesPage({
|
|
|
564
564
|
{/* Device widths are an email concern; a push shows both platforms, a chat message its client. */}
|
|
565
565
|
{isEmail && (
|
|
566
566
|
<>
|
|
567
|
-
<div className="
|
|
567
|
+
<div className="mx-1 h-4 w-px bg-border" />
|
|
568
568
|
<ToolButton
|
|
569
569
|
active={device === 'desktop'}
|
|
570
570
|
label={t('emails.previewDesktop')}
|
|
@@ -581,7 +581,7 @@ export function TemplatesPage({
|
|
|
581
581
|
</ToolButton>
|
|
582
582
|
</>
|
|
583
583
|
)}
|
|
584
|
-
<div className="
|
|
584
|
+
<div className="mx-1 h-4 w-px bg-border" />
|
|
585
585
|
<ToolButton
|
|
586
586
|
label={t('emails.zoomOut')}
|
|
587
587
|
onClick={() => setZoom((level) => Math.max(0.5, level - 0.25))}
|
|
@@ -592,7 +592,7 @@ export function TemplatesPage({
|
|
|
592
592
|
type="button"
|
|
593
593
|
title={t('emails.zoomReset')}
|
|
594
594
|
onClick={() => setZoom(1)}
|
|
595
|
-
className="
|
|
595
|
+
className="w-11 text-center text-xs font-medium text-secondary tabular-nums transition-colors hover:text-primary"
|
|
596
596
|
>
|
|
597
597
|
{Math.round(zoom * 100)}%
|
|
598
598
|
</button>
|
|
@@ -27,8 +27,8 @@ export function Textarea({ size = 'md', className, ...props }: Props) {
|
|
|
27
27
|
{...props}
|
|
28
28
|
className={cn(
|
|
29
29
|
'transition-colors duration-100 focus:outline-none',
|
|
30
|
-
'
|
|
31
|
-
'
|
|
30
|
+
'border bg-textfield placeholder-placeholder focus-visible:border-accent',
|
|
31
|
+
'focus-visible:ring-accent/40 dark:focus-visible:ring-accent/50',
|
|
32
32
|
SIZE_STYLE[size],
|
|
33
33
|
className
|
|
34
34
|
)}
|
|
@@ -29,7 +29,7 @@ export function ThumbnailWindow({
|
|
|
29
29
|
<div className="mb-4">
|
|
30
30
|
<div
|
|
31
31
|
ref={ref}
|
|
32
|
-
className={cn('
|
|
32
|
+
className={cn('h-48 overflow-hidden rounded-xl border border-border', className)}
|
|
33
33
|
style={{ ...superellipse, ...style }}
|
|
34
34
|
>
|
|
35
35
|
{children}
|
|
@@ -85,12 +85,12 @@ export function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {
|
|
|
85
85
|
* the page is the one scroller (see __root). Nothing clips, so the corners
|
|
86
86
|
* are re-cut on the first and last cells below.
|
|
87
87
|
*/
|
|
88
|
-
<div className="border-border bg-card
|
|
88
|
+
<div className="rounded-2xl border border-border bg-card" style={superellipse}>
|
|
89
89
|
{/* Below `md` the table leaves table layout entirely and each row lays
|
|
90
90
|
itself out as a four-column grid — see the row classes. */}
|
|
91
91
|
<table className="w-full table-fixed border-separate border-spacing-0 text-sm max-md:block">
|
|
92
92
|
<thead className="max-md:hidden">
|
|
93
|
-
<tr className="text-
|
|
93
|
+
<tr className="text-left text-xs font-medium text-muted">
|
|
94
94
|
<th className={clsx(HEAD_CELL, 'min-w-0 px-6')} style={superellipse}>
|
|
95
95
|
{t('common.name')}
|
|
96
96
|
</th>
|
|
@@ -126,12 +126,12 @@ export function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {
|
|
|
126
126
|
* poke square grey corners out of the card. Stacked, the row
|
|
127
127
|
* is an ordinary grid box and takes fill and radius itself.
|
|
128
128
|
*/
|
|
129
|
-
'md:
|
|
129
|
+
'md:last:[&>td]:border-b-0 md:hover:[&>td]:bg-hover',
|
|
130
130
|
'md:last:[&>td:first-child]:rounded-bl-2xl md:last:[&>td:last-child]:rounded-br-2xl',
|
|
131
131
|
/* Stacked: title / status / the metrics two by two
|
|
132
132
|
— four across a phone leaves no room for a label, let
|
|
133
133
|
alone the sparkline under it. */
|
|
134
|
-
'border-border max-md:
|
|
134
|
+
'border-border max-md:grid max-md:grid-cols-6 max-md:hover:bg-hover',
|
|
135
135
|
'max-md:border-b max-md:px-3 max-md:first:rounded-t-2xl',
|
|
136
136
|
'max-md:last:rounded-b-2xl max-md:last:border-b-0'
|
|
137
137
|
)}
|
|
@@ -142,7 +142,7 @@ export function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {
|
|
|
142
142
|
style={superellipse}
|
|
143
143
|
>
|
|
144
144
|
<div className="flex items-start gap-3">
|
|
145
|
-
<WorkflowIcon className="
|
|
145
|
+
<WorkflowIcon className="mt-0.5 size-4 shrink-0 text-muted" strokeWidth={2} />
|
|
146
146
|
<div className="min-w-0">
|
|
147
147
|
<div
|
|
148
148
|
className={clsx(
|
|
@@ -159,11 +159,11 @@ export function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {
|
|
|
159
159
|
so keeping the indent here left a notch down the side.
|
|
160
160
|
*/}
|
|
161
161
|
{ir.meta?.description !== undefined && (
|
|
162
|
-
<p className="
|
|
162
|
+
<p className="mt-1 truncate text-sm text-muted max-md:-ml-7">
|
|
163
163
|
{ir.meta.description}
|
|
164
164
|
</p>
|
|
165
165
|
)}
|
|
166
|
-
<div className="
|
|
166
|
+
<div className="mt-2 flex items-center gap-3 text-xs text-muted max-md:-ml-7">
|
|
167
167
|
<span className="flex items-center gap-1">
|
|
168
168
|
<Mail className="size-3.5" strokeWidth={2} />
|
|
169
169
|
{shape.messages}
|
|
@@ -214,7 +214,7 @@ export function WorkflowList({ items, reports, onOpen }: WorkflowListProps) {
|
|
|
214
214
|
style={superellipse}
|
|
215
215
|
>
|
|
216
216
|
{/* The head is gone when stacked, so each figure names itself. */}
|
|
217
|
-
<div className="
|
|
217
|
+
<div className="mb-1 truncate text-xs text-muted md:hidden">
|
|
218
218
|
{t(`workflows.columns.${column}`)}
|
|
219
219
|
</div>
|
|
220
220
|
<div className="tabular-nums">{values[column]}</div>
|
package/src/postgres.ts
CHANGED
|
@@ -84,13 +84,14 @@ export function postgresStats(options: PostgresStatsOptions): StatsSource {
|
|
|
84
84
|
anchor = Date.now();
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
const
|
|
87
|
+
const rows = await sql<{ latest: Date | null }[]>`
|
|
88
88
|
select greatest(
|
|
89
89
|
(select max(sent_at) from ${t('message')}),
|
|
90
90
|
(select max(node_at) from ${t('instance')}),
|
|
91
91
|
(select max(finished_at) from ${t('instance')}),
|
|
92
92
|
(select max(taken_at) from ${t('segment_snapshot')})
|
|
93
93
|
) as latest`;
|
|
94
|
+
const row = rows.at(0);
|
|
94
95
|
const latest =
|
|
95
96
|
row?.latest === null || row?.latest === undefined
|
|
96
97
|
? Date.now()
|
|
@@ -382,8 +383,9 @@ export function postgresStats(options: PostgresStatsOptions): StatsSource {
|
|
|
382
383
|
|
|
383
384
|
async profiles(segment, { limit, offset }) {
|
|
384
385
|
await refreshAnchor();
|
|
385
|
-
const
|
|
386
|
+
const counts = await sql<{ total: number }[]>`
|
|
386
387
|
select count(*)::int as total from ${t('segment_member')} where segment = ${segment}`;
|
|
388
|
+
const count = counts.at(0);
|
|
387
389
|
// "Created" is the user's first event: the engine knows nothing older about them
|
|
388
390
|
const rows = await sql<
|
|
389
391
|
{ id: string; props: Record<string, unknown> | null; created_at: Date | null }[]
|