@tangle-network/sandbox-ui 0.113.6 → 0.114.0
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/WorkflowGraph-B-NsdYz_.js +1961 -0
- package/dist/assets.d.ts +214 -206
- package/dist/assets.js +1057 -908
- package/dist/auth-CWe17Hly.js +37 -0
- package/dist/auth.d.ts +2 -30
- package/dist/auth.js +2 -15
- package/dist/chat-BOvFAe6p.js +903 -0
- package/dist/chat.d.ts +2 -230
- package/dist/chat.js +2 -34
- package/dist/connectors.d.ts +52 -49
- package/dist/connectors.js +595 -643
- package/dist/dashboard-CZ3VgNPR.js +4969 -0
- package/dist/dashboard.d.ts +4 -1297
- package/dist/dashboard.js +4 -152
- package/dist/editor.d.ts +2 -1
- package/dist/editor.js +2 -31
- package/dist/files.d.ts +2 -6
- package/dist/files.js +2 -33
- package/dist/globals.css +63 -3
- package/dist/hooks.d.ts +146 -148
- package/dist/hooks.js +222 -55
- package/dist/index-CKRaj1pM.d.ts +776 -0
- package/dist/index-CXX5IpH2.d.ts +2 -0
- package/dist/index-DPePq7c8.d.ts +1340 -0
- package/dist/index-DiyLLZuJ.d.ts +230 -0
- package/dist/index-DvmZLMT1.d.ts +30 -0
- package/dist/index-I8ZLVtHd.d.ts +330 -0
- package/dist/index-PRM636Ex.d.ts +86 -0
- package/dist/index.d.ts +21 -33
- package/dist/index.js +21 -701
- package/dist/info-panel-C9cqDzOL.js +594 -0
- package/dist/integrations.d.ts +133 -139
- package/dist/integrations.js +491 -673
- package/dist/markdown.d.ts +2 -1
- package/dist/markdown.js +2 -13
- package/dist/model-I-NIxeM-.js +1250 -0
- package/dist/model-brand-B9A4H9pJ.d.ts +98 -0
- package/dist/model-brand-hMyDTUqB.js +624 -0
- package/dist/motion-DkyBRJb9.js +37 -0
- package/dist/openui.d.ts +2 -1
- package/dist/openui.js +2 -7
- package/dist/pages.d.ts +307 -300
- package/dist/pages.js +4404 -4181
- package/dist/primitives-Dh1vG6J3.js +113 -0
- package/dist/primitives.d.ts +2 -74
- package/dist/primitives.js +2 -204
- package/dist/provider-logo-DjqmConF.js +311 -0
- package/dist/run.d.ts +2 -1
- package/dist/run.js +2 -23
- package/dist/sdk-hooks.d.ts +3 -4
- package/dist/sdk-hooks.js +3 -31
- package/dist/sidecar-DgH_vQ6m.d.ts +9 -0
- package/dist/stores.d.ts +14 -15
- package/dist/stores.js +13 -81
- package/dist/styles.css +63 -3
- package/dist/template-card-L-4gmjx2.d.ts +90 -0
- package/dist/terminal-CN9ZgHRt.js +197 -0
- package/dist/terminal.d.ts +60 -60
- package/dist/terminal.js +2 -10
- package/dist/tokens.css +51 -0
- package/dist/types.d.ts +4 -11
- package/dist/types.js +0 -1
- package/dist/use-pty-session-C8cE0adT.js +669 -0
- package/dist/use-sidecar-auth-CCTJcrq7.d.ts +145 -0
- package/dist/use-sidecar-auth-DkdcufOz.js +742 -0
- package/dist/utils-DzWbktWG.js +2 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +2 -37
- package/dist/workbench-BCaCKl-J.js +8347 -0
- package/dist/workbench.d.ts +2 -310
- package/dist/workbench.js +2 -44
- package/dist/workflows.d.ts +341 -339
- package/dist/workflows.js +74 -109
- package/dist/workspace-B6AtI6ld.js +2510 -0
- package/dist/workspace.d.ts +2 -761
- package/dist/workspace.js +2 -51
- package/package.json +46 -40
- package/dist/WorkflowGraph-2QOORYIR.js +0 -1722
- package/dist/chunk-2BUPSB7O.js +0 -0
- package/dist/chunk-3KBNPQQF.js +0 -2697
- package/dist/chunk-3LIXVEEE.js +0 -279
- package/dist/chunk-72UF2H5H.js +0 -707
- package/dist/chunk-AI25G5MX.js +0 -944
- package/dist/chunk-ANSC5AFC.js +0 -314
- package/dist/chunk-AZ3AWMTM.js +0 -8
- package/dist/chunk-BGVEHENC.js +0 -10
- package/dist/chunk-CZ7CSFO4.js +0 -39
- package/dist/chunk-DYXXYGS4.js +0 -4700
- package/dist/chunk-EI44GEQ5.js +0 -6
- package/dist/chunk-IACRDXER.js +0 -219
- package/dist/chunk-IOB2PW5Z.js +0 -55
- package/dist/chunk-M4K7ZGR2.js +0 -24
- package/dist/chunk-MYZAW4RX.js +0 -665
- package/dist/chunk-OMUIPJQZ.js +0 -555
- package/dist/chunk-RQZRXKMR.js +0 -398
- package/dist/chunk-SOKKTB7W.js +0 -230
- package/dist/chunk-TADGS4Q7.js +0 -1010
- package/dist/chunk-UCQNOUN3.js +0 -7964
- package/dist/chunk-ULPLRBMF.js +0 -34
- package/dist/chunk-WID73FPH.js +0 -89
- package/dist/chunk-X3YXP7FG.js +0 -38
- package/dist/logo-DiAjq759.d.ts +0 -15
- package/dist/model-brand-BNnaUKKZ.d.ts +0 -99
- package/dist/ports-list-CDIvTNnX.d.ts +0 -17
- package/dist/sdk-hooks-Djkjq4cp.d.ts +0 -145
- package/dist/template-card-Bn-Bw5xC.d.ts +0 -87
package/dist/assets.js
CHANGED
|
@@ -1,947 +1,1096 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-EI44GEQ5.js";
|
|
4
|
-
import "./chunk-CZ7CSFO4.js";
|
|
5
|
-
|
|
6
|
-
// src/assets/approval-queue.tsx
|
|
7
|
-
import * as React3 from "react";
|
|
8
|
-
import { Button as Button3, Input as Input2 } from "@tangle-network/ui/primitives";
|
|
9
|
-
import { Search, CheckCheck } from "lucide-react";
|
|
10
|
-
|
|
11
|
-
// src/assets/asset-card.tsx
|
|
12
|
-
import { Badge } from "@tangle-network/ui/primitives";
|
|
13
|
-
import { Check, X, Pencil, GitBranch } from "lucide-react";
|
|
14
|
-
|
|
15
|
-
// src/assets/preview/image-preview.tsx
|
|
16
|
-
import * as React from "react";
|
|
17
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
1
|
+
import { t as cn } from "./utils-DzWbktWG.js";
|
|
2
|
+
import { Badge, Button, Input, Label, Textarea } from "@tangle-network/ui/primitives";
|
|
18
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Fragment as Fragment$1 } from "react";
|
|
6
|
+
import { Check, CheckCheck, ChevronDown, ChevronLeft, ChevronRight, Film, GitBranch, Loader2, MessageSquare, Pencil, Play, Save, Search, Trophy, X } from "lucide-react";
|
|
7
|
+
//#region src/assets/preview/image-preview.tsx
|
|
8
|
+
const ASPECT = {
|
|
9
|
+
feed: "aspect-square",
|
|
10
|
+
story: "aspect-[9/16]",
|
|
11
|
+
carousel: "aspect-square"
|
|
23
12
|
};
|
|
24
13
|
function bgStyle(bg, brand) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return { background: brand.primaryColor };
|
|
14
|
+
if (bg.type === "color") return { background: bg.value };
|
|
15
|
+
if (bg.type === "gradient") return { background: `linear-gradient(${bg.direction ?? "to bottom right"}, ${bg.from}, ${bg.to})` };
|
|
16
|
+
if (bg.type === "image") return {
|
|
17
|
+
backgroundImage: `url(${bg.url})`,
|
|
18
|
+
backgroundSize: "cover",
|
|
19
|
+
backgroundPosition: "center"
|
|
20
|
+
};
|
|
21
|
+
return { background: brand.primaryColor };
|
|
35
22
|
}
|
|
36
23
|
function Layer({ layer, brand }) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
height: `${layer.height}%`,
|
|
82
|
-
background: layer.fill ?? brand.accentColor,
|
|
83
|
-
opacity: layer.opacity ?? 1,
|
|
84
|
-
borderRadius: layer.shape === "circle" ? "50%" : layer.shape === "rounded-rect" ? "8px" : 0
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
if (layer.type === "logo" && brand.logoUrl) {
|
|
90
|
-
return /* @__PURE__ */ jsx(
|
|
91
|
-
"img",
|
|
92
|
-
{
|
|
93
|
-
src: brand.logoUrl,
|
|
94
|
-
alt: brand.businessName,
|
|
95
|
-
style: {
|
|
96
|
-
...base,
|
|
97
|
-
width: layer.width ? `${layer.width}%` : "12%"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
24
|
+
const base = {
|
|
25
|
+
position: "absolute",
|
|
26
|
+
left: `${layer.x}%`,
|
|
27
|
+
top: `${layer.y}%`
|
|
28
|
+
};
|
|
29
|
+
if (layer.type === "text") return /* @__PURE__ */ jsx("div", {
|
|
30
|
+
style: {
|
|
31
|
+
...base,
|
|
32
|
+
fontSize: layer.fontSize ?? 16,
|
|
33
|
+
fontWeight: layer.fontWeight ?? "normal",
|
|
34
|
+
color: layer.color ?? brand.textColor,
|
|
35
|
+
width: layer.width ? `${layer.width}%` : void 0,
|
|
36
|
+
textAlign: layer.align ?? "left"
|
|
37
|
+
},
|
|
38
|
+
children: layer.text
|
|
39
|
+
});
|
|
40
|
+
if (layer.type === "image") return /* @__PURE__ */ jsx("img", {
|
|
41
|
+
src: layer.url,
|
|
42
|
+
alt: "",
|
|
43
|
+
style: {
|
|
44
|
+
...base,
|
|
45
|
+
width: `${layer.width}%`,
|
|
46
|
+
height: `${layer.height}%`,
|
|
47
|
+
opacity: layer.opacity ?? 1,
|
|
48
|
+
objectFit: "cover"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
if (layer.type === "shape") return /* @__PURE__ */ jsx("div", { style: {
|
|
52
|
+
...base,
|
|
53
|
+
width: `${layer.width}%`,
|
|
54
|
+
height: `${layer.height}%`,
|
|
55
|
+
background: layer.fill ?? brand.accentColor,
|
|
56
|
+
opacity: layer.opacity ?? 1,
|
|
57
|
+
borderRadius: layer.shape === "circle" ? "50%" : layer.shape === "rounded-rect" ? "8px" : 0
|
|
58
|
+
} });
|
|
59
|
+
if (layer.type === "logo" && brand.logoUrl) return /* @__PURE__ */ jsx("img", {
|
|
60
|
+
src: brand.logoUrl,
|
|
61
|
+
alt: brand.businessName,
|
|
62
|
+
style: {
|
|
63
|
+
...base,
|
|
64
|
+
width: layer.width ? `${layer.width}%` : "12%"
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return null;
|
|
103
68
|
}
|
|
104
69
|
function Slide({ slide, brand }) {
|
|
105
|
-
|
|
70
|
+
return /* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: "relative w-full h-full overflow-hidden",
|
|
72
|
+
style: bgStyle(slide.background, brand),
|
|
73
|
+
children: slide.layers.map((layer, i) => /* @__PURE__ */ jsx(Layer, {
|
|
74
|
+
layer,
|
|
75
|
+
brand
|
|
76
|
+
}, i))
|
|
77
|
+
});
|
|
106
78
|
}
|
|
107
79
|
function ImagePreview({ content, brand, format = "feed", className }) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
] });
|
|
80
|
+
const [activeIndex, setActiveIndex] = React$1.useState(0);
|
|
81
|
+
const slides = content.slides;
|
|
82
|
+
const isMulti = slides.length > 1;
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
className: cn("flex flex-col gap-2", className),
|
|
85
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
86
|
+
className: cn("relative w-full rounded overflow-hidden", ASPECT[format]),
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(Slide, {
|
|
89
|
+
slide: slides[activeIndex],
|
|
90
|
+
brand
|
|
91
|
+
}),
|
|
92
|
+
isMulti && activeIndex > 0 && /* @__PURE__ */ jsx("button", {
|
|
93
|
+
onClick: () => setActiveIndex((i) => i - 1),
|
|
94
|
+
className: "absolute left-1 top-1/2 -translate-y-1/2 rounded-full p-1 bg-black/40 text-white hover:bg-black/60",
|
|
95
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 16 })
|
|
96
|
+
}),
|
|
97
|
+
isMulti && activeIndex < slides.length - 1 && /* @__PURE__ */ jsx("button", {
|
|
98
|
+
onClick: () => setActiveIndex((i) => i + 1),
|
|
99
|
+
className: "absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-1 bg-black/40 text-white hover:bg-black/60",
|
|
100
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
|
|
101
|
+
}),
|
|
102
|
+
isMulti && /* @__PURE__ */ jsx("div", {
|
|
103
|
+
className: "absolute bottom-2 left-1/2 -translate-x-1/2 flex gap-1",
|
|
104
|
+
children: slides.map((_, i) => /* @__PURE__ */ jsx("button", {
|
|
105
|
+
onClick: () => setActiveIndex(i),
|
|
106
|
+
className: cn("w-1.5 h-1.5 rounded-full transition-colors", i === activeIndex ? "bg-white" : "bg-white/40")
|
|
107
|
+
}, i))
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
}), isMulti && /* @__PURE__ */ jsxs("div", {
|
|
111
|
+
className: "text-xs text-muted-foreground text-center",
|
|
112
|
+
children: [
|
|
113
|
+
activeIndex + 1,
|
|
114
|
+
" / ",
|
|
115
|
+
slides.length
|
|
116
|
+
]
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
148
119
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
published: "default"
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/assets/asset-card.tsx
|
|
122
|
+
const STATUS_VARIANT = {
|
|
123
|
+
draft: "secondary",
|
|
124
|
+
pending_review: "outline",
|
|
125
|
+
approved: "default",
|
|
126
|
+
rejected: "destructive",
|
|
127
|
+
scheduled: "secondary",
|
|
128
|
+
published: "default"
|
|
159
129
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
130
|
+
const STATUS_LABEL = {
|
|
131
|
+
draft: "Draft",
|
|
132
|
+
pending_review: "Review",
|
|
133
|
+
approved: "Approved",
|
|
134
|
+
rejected: "Rejected",
|
|
135
|
+
scheduled: "Scheduled",
|
|
136
|
+
published: "Published"
|
|
167
137
|
};
|
|
168
138
|
function Thumbnail({ spec }) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
139
|
+
const { format, brand, content } = spec;
|
|
140
|
+
if (format === "email") {
|
|
141
|
+
const ec = content;
|
|
142
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
143
|
+
className: "p-2 text-xs space-y-0.5",
|
|
144
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
145
|
+
className: "font-medium truncate",
|
|
146
|
+
children: ec.subject
|
|
147
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
148
|
+
className: "text-muted-foreground truncate text-[10px]",
|
|
149
|
+
children: [ec.sections.length, " sections"]
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (format.startsWith("image:")) return /* @__PURE__ */ jsx("div", {
|
|
154
|
+
className: "overflow-hidden rounded",
|
|
155
|
+
style: { maxHeight: 120 },
|
|
156
|
+
children: /* @__PURE__ */ jsx(ImagePreview, {
|
|
157
|
+
content,
|
|
158
|
+
brand,
|
|
159
|
+
format: format === "image:story" ? "story" : "feed"
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
if (format.startsWith("video:")) {
|
|
163
|
+
const vc = content;
|
|
164
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
165
|
+
className: "p-2 text-xs space-y-0.5",
|
|
166
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
167
|
+
className: "font-medium",
|
|
168
|
+
children: [vc.scenes.length, " scenes"]
|
|
169
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
170
|
+
className: "text-muted-foreground",
|
|
171
|
+
children: [vc.durationSeconds, "s video"]
|
|
172
|
+
})]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
if (format.startsWith("copy:")) {
|
|
176
|
+
const cc = content;
|
|
177
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
178
|
+
className: "p-2 text-xs truncate space-y-0.5",
|
|
179
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: "font-medium truncate",
|
|
181
|
+
children: cc.headline
|
|
182
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
183
|
+
className: "text-muted-foreground line-clamp-2 text-[10px]",
|
|
184
|
+
children: cc.body
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
212
189
|
}
|
|
213
190
|
function AssetCard({ spec, variantCount, onApprove, onReject, onEdit, className }) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
191
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
192
|
+
className: cn("rounded-lg border border-border bg-card flex flex-col overflow-hidden hover:border-border/80 transition-colors", className),
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ jsx("div", {
|
|
195
|
+
className: "min-h-[80px] bg-muted/30",
|
|
196
|
+
children: /* @__PURE__ */ jsx(Thumbnail, { spec })
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsxs("div", {
|
|
199
|
+
className: "px-2 py-1.5 flex items-center gap-1.5",
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ jsx("span", {
|
|
202
|
+
className: "text-[10px] text-muted-foreground flex-1 truncate",
|
|
203
|
+
children: spec.format
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
206
|
+
variant: STATUS_VARIANT[spec.status],
|
|
207
|
+
className: "text-[10px] h-4 px-1.5",
|
|
208
|
+
children: STATUS_LABEL[spec.status]
|
|
209
|
+
}),
|
|
210
|
+
variantCount !== void 0 && variantCount > 0 && /* @__PURE__ */ jsxs("span", {
|
|
211
|
+
className: "flex items-center gap-0.5 text-[10px] text-muted-foreground",
|
|
212
|
+
children: [/* @__PURE__ */ jsx(GitBranch, { size: 10 }), variantCount]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ jsxs("div", {
|
|
217
|
+
className: "flex border-t border-border",
|
|
218
|
+
children: [
|
|
219
|
+
onEdit && /* @__PURE__ */ jsxs("button", {
|
|
220
|
+
type: "button",
|
|
221
|
+
onClick: () => onEdit(spec.id),
|
|
222
|
+
className: "flex-1 flex items-center justify-center gap-1 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",
|
|
223
|
+
children: [/* @__PURE__ */ jsx(Pencil, { size: 12 }), "Edit"]
|
|
224
|
+
}),
|
|
225
|
+
onReject && spec.status === "pending_review" && /* @__PURE__ */ jsxs("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
onClick: () => onReject(spec.id),
|
|
228
|
+
className: "flex-1 flex items-center justify-center gap-1 py-1.5 text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 transition-colors border-l border-border",
|
|
229
|
+
children: [/* @__PURE__ */ jsx(X, { size: 12 }), "Reject"]
|
|
230
|
+
}),
|
|
231
|
+
onApprove && spec.status === "pending_review" && /* @__PURE__ */ jsxs("button", {
|
|
232
|
+
type: "button",
|
|
233
|
+
onClick: () => onApprove(spec.id),
|
|
234
|
+
className: "flex-1 flex items-center justify-center gap-1 py-1.5 text-xs text-muted-foreground hover:text-green-600 hover:bg-green-600/5 transition-colors border-l border-border",
|
|
235
|
+
children: [/* @__PURE__ */ jsx(Check, { size: 12 }), "Approve"]
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
});
|
|
263
241
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
import * as React2 from "react";
|
|
267
|
-
import { Button as Button2, Input, Textarea, Label } from "@tangle-network/ui/primitives";
|
|
268
|
-
import { MessageSquare, Save, ChevronDown, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
269
|
-
|
|
270
|
-
// src/assets/preview/email-preview.tsx
|
|
271
|
-
import { jsxs as jsxs3, jsx as jsx3 } from "react/jsx-runtime";
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/assets/preview/email-preview.tsx
|
|
272
244
|
function EmailPreview({ content, brand, previewUrl, className }) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
245
|
+
if (previewUrl) return jsxs("div", {
|
|
246
|
+
className: cn("flex flex-col gap-1", className),
|
|
247
|
+
children: [
|
|
248
|
+
jsx("div", {
|
|
249
|
+
className: "text-xs text-muted-foreground font-medium truncate",
|
|
250
|
+
children: content.subject
|
|
251
|
+
}),
|
|
252
|
+
content.preheader && jsx("div", {
|
|
253
|
+
className: "text-xs text-muted-foreground/60 truncate",
|
|
254
|
+
children: content.preheader
|
|
255
|
+
}),
|
|
256
|
+
jsx("iframe", {
|
|
257
|
+
src: previewUrl,
|
|
258
|
+
className: "w-full rounded border border-border",
|
|
259
|
+
style: {
|
|
260
|
+
height: 480,
|
|
261
|
+
background: "#fff"
|
|
262
|
+
},
|
|
263
|
+
title: "Email preview",
|
|
264
|
+
sandbox: "allow-same-origin"
|
|
265
|
+
})
|
|
266
|
+
]
|
|
267
|
+
});
|
|
268
|
+
return jsxs("div", {
|
|
269
|
+
className: cn("flex flex-col gap-2", className),
|
|
270
|
+
children: [
|
|
271
|
+
jsx("div", {
|
|
272
|
+
className: "text-sm font-semibold truncate",
|
|
273
|
+
children: content.subject
|
|
274
|
+
}),
|
|
275
|
+
content.preheader && jsx("div", {
|
|
276
|
+
className: "text-xs text-muted-foreground truncate",
|
|
277
|
+
children: content.preheader
|
|
278
|
+
}),
|
|
279
|
+
jsx("div", {
|
|
280
|
+
className: "rounded border border-border p-4 space-y-3 overflow-y-auto",
|
|
281
|
+
style: {
|
|
282
|
+
maxHeight: 480,
|
|
283
|
+
fontFamily: brand.fontFamily,
|
|
284
|
+
color: brand.textColor
|
|
285
|
+
},
|
|
286
|
+
children: content.sections.map((section, i) => {
|
|
287
|
+
if (section.type === "hero") return jsxs("div", {
|
|
288
|
+
className: "text-center py-4 space-y-2",
|
|
289
|
+
children: [
|
|
290
|
+
section.imageUrl && jsx("img", {
|
|
291
|
+
src: section.imageUrl,
|
|
292
|
+
alt: "",
|
|
293
|
+
className: "mx-auto max-h-40 object-cover rounded"
|
|
294
|
+
}),
|
|
295
|
+
jsx("div", {
|
|
296
|
+
className: "text-xl font-bold",
|
|
297
|
+
style: { color: brand.primaryColor },
|
|
298
|
+
children: section.headline
|
|
299
|
+
}),
|
|
300
|
+
section.subheadline && jsx("div", {
|
|
301
|
+
className: "text-sm text-muted-foreground",
|
|
302
|
+
children: section.subheadline
|
|
303
|
+
}),
|
|
304
|
+
section.ctaLabel && jsx("a", {
|
|
305
|
+
href: section.ctaUrl ?? "#",
|
|
306
|
+
className: "inline-block px-4 py-2 rounded text-sm font-medium text-white",
|
|
307
|
+
style: { background: brand.primaryColor },
|
|
308
|
+
children: section.ctaLabel
|
|
309
|
+
})
|
|
310
|
+
]
|
|
311
|
+
}, i);
|
|
312
|
+
if (section.type === "body") return jsx("p", {
|
|
313
|
+
className: "text-sm leading-relaxed whitespace-pre-wrap",
|
|
314
|
+
children: section.text
|
|
315
|
+
}, i);
|
|
316
|
+
if (section.type === "feature") return jsxs("div", {
|
|
317
|
+
className: "flex gap-3 items-start",
|
|
318
|
+
children: [section.imageUrl && jsx("img", {
|
|
319
|
+
src: section.imageUrl,
|
|
320
|
+
alt: "",
|
|
321
|
+
className: "w-16 h-16 object-cover rounded shrink-0"
|
|
322
|
+
}), jsxs("div", { children: [jsx("div", {
|
|
323
|
+
className: "text-sm font-semibold",
|
|
324
|
+
children: section.headline
|
|
325
|
+
}), jsx("div", {
|
|
326
|
+
className: "text-xs text-muted-foreground mt-0.5",
|
|
327
|
+
children: section.description
|
|
328
|
+
})] })]
|
|
329
|
+
}, i);
|
|
330
|
+
if (section.type === "testimonial") return jsxs("blockquote", {
|
|
331
|
+
className: "border-l-2 pl-3 italic text-sm text-muted-foreground",
|
|
332
|
+
style: { borderColor: brand.accentColor },
|
|
333
|
+
children: [jsxs("p", { children: [
|
|
334
|
+
"\"",
|
|
335
|
+
section.quote,
|
|
336
|
+
"\""
|
|
337
|
+
] }), jsxs("footer", {
|
|
338
|
+
className: "mt-1 text-xs not-italic font-medium",
|
|
339
|
+
children: [section.author, section.role ? `, ${section.role}` : ""]
|
|
340
|
+
})]
|
|
341
|
+
}, i);
|
|
342
|
+
if (section.type === "cta") return jsxs("div", {
|
|
343
|
+
className: "text-center py-3 space-y-1",
|
|
344
|
+
children: [jsx("a", {
|
|
345
|
+
href: section.url,
|
|
346
|
+
className: "inline-block px-5 py-2.5 rounded font-medium text-white text-sm",
|
|
347
|
+
style: { background: brand.primaryColor },
|
|
348
|
+
children: section.label
|
|
349
|
+
}), section.subtext && jsx("p", {
|
|
350
|
+
className: "text-xs text-muted-foreground",
|
|
351
|
+
children: section.subtext
|
|
352
|
+
})]
|
|
353
|
+
}, i);
|
|
354
|
+
if (section.type === "divider") return jsx("hr", { className: "border-border" }, i);
|
|
355
|
+
return null;
|
|
356
|
+
})
|
|
357
|
+
})
|
|
358
|
+
]
|
|
359
|
+
});
|
|
361
360
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
import { Fragment } from "react";
|
|
365
|
-
import { Play, Film, Loader2 } from "lucide-react";
|
|
366
|
-
import { Button } from "@tangle-network/ui/primitives";
|
|
367
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/assets/preview/video-preview.tsx
|
|
368
363
|
function VideoPreview({ content, brand, onRenderRequest, isRendering, className }) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
364
|
+
if (content.renderedUrl) return /* @__PURE__ */ jsx("div", {
|
|
365
|
+
className: cn("rounded overflow-hidden aspect-[9/16] bg-black", className),
|
|
366
|
+
children: /* @__PURE__ */ jsx("video", {
|
|
367
|
+
src: content.renderedUrl,
|
|
368
|
+
controls: true,
|
|
369
|
+
className: "w-full h-full object-contain",
|
|
370
|
+
playsInline: true
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
const sceneSummary = content.scenes.map((s) => {
|
|
374
|
+
if (s.type === "text-animation") return s.headline;
|
|
375
|
+
if (s.type === "image-reveal") return s.caption ?? "Image";
|
|
376
|
+
if (s.type === "slide") return "Slide";
|
|
377
|
+
if (s.type === "countdown") return `${s.from}…`;
|
|
378
|
+
return "Scene";
|
|
379
|
+
});
|
|
380
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
381
|
+
className: cn("flex flex-col gap-3", className),
|
|
382
|
+
children: [
|
|
383
|
+
/* @__PURE__ */ jsxs("div", {
|
|
384
|
+
className: "relative rounded overflow-hidden aspect-[9/16] flex flex-col items-center justify-center gap-3",
|
|
385
|
+
style: {
|
|
386
|
+
background: brand.primaryColor,
|
|
387
|
+
color: brand.textColor
|
|
388
|
+
},
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ jsx(Film, {
|
|
391
|
+
size: 32,
|
|
392
|
+
className: "opacity-60"
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ jsx("div", {
|
|
395
|
+
className: "text-sm font-medium text-center px-4",
|
|
396
|
+
children: brand.businessName
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ jsxs("div", {
|
|
399
|
+
className: "text-xs opacity-60",
|
|
400
|
+
children: [
|
|
401
|
+
content.scenes.length,
|
|
402
|
+
" scenes ",
|
|
403
|
+
"·",
|
|
404
|
+
" ",
|
|
405
|
+
content.durationSeconds,
|
|
406
|
+
"s"
|
|
407
|
+
]
|
|
408
|
+
})
|
|
409
|
+
]
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ jsxs("div", {
|
|
412
|
+
className: "space-y-1",
|
|
413
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
414
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
415
|
+
children: "Scenes"
|
|
416
|
+
}), sceneSummary.map((label, i) => /* @__PURE__ */ jsxs("div", {
|
|
417
|
+
className: "text-xs text-muted-foreground flex gap-1.5 items-center",
|
|
418
|
+
children: [
|
|
419
|
+
/* @__PURE__ */ jsx("span", {
|
|
420
|
+
className: "font-mono text-[10px] w-4 text-right opacity-50",
|
|
421
|
+
children: i + 1
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
424
|
+
/* @__PURE__ */ jsxs("span", {
|
|
425
|
+
className: "opacity-40",
|
|
426
|
+
children: [
|
|
427
|
+
"·",
|
|
428
|
+
" ",
|
|
429
|
+
content.scenes[i].durationSeconds,
|
|
430
|
+
"s"
|
|
431
|
+
]
|
|
432
|
+
})
|
|
433
|
+
]
|
|
434
|
+
}, i))]
|
|
435
|
+
}),
|
|
436
|
+
onRenderRequest && /* @__PURE__ */ jsx(Button, {
|
|
437
|
+
size: "sm",
|
|
438
|
+
variant: "outline",
|
|
439
|
+
onClick: onRenderRequest,
|
|
440
|
+
disabled: isRendering,
|
|
441
|
+
className: "w-full gap-2",
|
|
442
|
+
children: isRendering ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Loader2, {
|
|
443
|
+
size: 14,
|
|
444
|
+
className: "animate-spin",
|
|
445
|
+
"data-motion": "essential"
|
|
446
|
+
}), "Rendering…"] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Play, { size: 14 }), "Render in sandbox"] })
|
|
447
|
+
})
|
|
448
|
+
]
|
|
449
|
+
});
|
|
438
450
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
"email-subject": 60
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/assets/preview/copy-preview.tsx
|
|
453
|
+
const PLATFORM_LIMITS = {
|
|
454
|
+
instagram: 2200,
|
|
455
|
+
tiktok: 2200,
|
|
456
|
+
x: 280,
|
|
457
|
+
linkedin: 3e3,
|
|
458
|
+
sms: 160,
|
|
459
|
+
"email-subject": 60
|
|
449
460
|
};
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
461
|
+
const PLATFORM_LABELS = {
|
|
462
|
+
instagram: "Instagram",
|
|
463
|
+
tiktok: "TikTok",
|
|
464
|
+
x: "X / Twitter",
|
|
465
|
+
linkedin: "LinkedIn",
|
|
466
|
+
sms: "SMS",
|
|
467
|
+
"email-subject": "Email Subject"
|
|
457
468
|
};
|
|
458
469
|
function CopyPreview({ content, className }) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
470
|
+
const limit = PLATFORM_LIMITS[content.platform];
|
|
471
|
+
const bodyLen = content.body.length;
|
|
472
|
+
const isOverLimit = limit !== null && bodyLen > limit;
|
|
473
|
+
const warningThreshold = limit !== null ? limit * .9 : null;
|
|
474
|
+
const isNearLimit = !isOverLimit && warningThreshold !== null && bodyLen >= warningThreshold;
|
|
475
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
476
|
+
className: cn("flex flex-col gap-2", className),
|
|
477
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
478
|
+
className: "flex items-center justify-between",
|
|
479
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
480
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
481
|
+
children: PLATFORM_LABELS[content.platform]
|
|
482
|
+
}), limit !== null && /* @__PURE__ */ jsxs("span", {
|
|
483
|
+
className: cn("text-xs tabular-nums", isOverLimit ? "text-destructive font-medium" : isNearLimit ? "text-warning" : "text-muted-foreground"),
|
|
484
|
+
children: [
|
|
485
|
+
bodyLen,
|
|
486
|
+
" / ",
|
|
487
|
+
limit
|
|
488
|
+
]
|
|
489
|
+
})]
|
|
490
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
491
|
+
className: "rounded border border-border p-3 space-y-2 bg-card",
|
|
492
|
+
children: [
|
|
493
|
+
content.headline && /* @__PURE__ */ jsx("div", {
|
|
494
|
+
className: "text-sm font-semibold",
|
|
495
|
+
children: content.headline
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ jsx("p", {
|
|
498
|
+
className: "text-sm whitespace-pre-wrap leading-relaxed",
|
|
499
|
+
children: content.body
|
|
500
|
+
}),
|
|
501
|
+
content.hashtags && content.hashtags.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
502
|
+
className: "text-sm text-blue-500 flex flex-wrap gap-1",
|
|
503
|
+
children: content.hashtags.map((tag) => /* @__PURE__ */ jsxs("span", { children: ["#", tag] }, tag))
|
|
504
|
+
})
|
|
505
|
+
]
|
|
506
|
+
})]
|
|
507
|
+
});
|
|
482
508
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/assets/asset-editor.tsx
|
|
486
511
|
function BrandPanel({ brand, onChange }) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
512
|
+
const [open, setOpen] = React$1.useState(false);
|
|
513
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
514
|
+
className: "border border-border rounded",
|
|
515
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
516
|
+
type: "button",
|
|
517
|
+
className: "flex w-full items-center justify-between px-3 py-2 text-xs font-medium text-muted-foreground hover:text-foreground",
|
|
518
|
+
onClick: () => setOpen((o) => !o),
|
|
519
|
+
children: ["Brand tokens", open ? /* @__PURE__ */ jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 })]
|
|
520
|
+
}), open && /* @__PURE__ */ jsxs("div", {
|
|
521
|
+
className: "px-3 pb-3 space-y-2 border-t border-border pt-2",
|
|
522
|
+
children: [
|
|
523
|
+
[
|
|
524
|
+
"primaryColor",
|
|
525
|
+
"accentColor",
|
|
526
|
+
"textColor"
|
|
527
|
+
].map((key) => /* @__PURE__ */ jsxs("div", {
|
|
528
|
+
className: "flex items-center gap-2",
|
|
529
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
530
|
+
type: "color",
|
|
531
|
+
value: brand[key],
|
|
532
|
+
onChange: (e) => onChange({
|
|
533
|
+
...brand,
|
|
534
|
+
[key]: e.target.value
|
|
535
|
+
}),
|
|
536
|
+
className: "w-6 h-6 rounded cursor-pointer border-0"
|
|
537
|
+
}), /* @__PURE__ */ jsx(Label, {
|
|
538
|
+
className: "text-xs capitalize",
|
|
539
|
+
children: key.replace(/Color/, " color")
|
|
540
|
+
})]
|
|
541
|
+
}, key)),
|
|
542
|
+
/* @__PURE__ */ jsxs("div", {
|
|
543
|
+
className: "space-y-1",
|
|
544
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
545
|
+
className: "text-xs",
|
|
546
|
+
children: "Font family"
|
|
547
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
548
|
+
value: brand.fontFamily,
|
|
549
|
+
onChange: (e) => onChange({
|
|
550
|
+
...brand,
|
|
551
|
+
fontFamily: e.target.value
|
|
552
|
+
}),
|
|
553
|
+
className: "h-7 text-xs"
|
|
554
|
+
})]
|
|
555
|
+
}),
|
|
556
|
+
/* @__PURE__ */ jsxs("div", {
|
|
557
|
+
className: "space-y-1",
|
|
558
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
559
|
+
className: "text-xs",
|
|
560
|
+
children: "Logo URL"
|
|
561
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
562
|
+
value: brand.logoUrl ?? "",
|
|
563
|
+
onChange: (e) => onChange({
|
|
564
|
+
...brand,
|
|
565
|
+
logoUrl: e.target.value || void 0
|
|
566
|
+
}),
|
|
567
|
+
className: "h-7 text-xs",
|
|
568
|
+
placeholder: "https://…"
|
|
569
|
+
})]
|
|
570
|
+
})
|
|
571
|
+
]
|
|
572
|
+
})]
|
|
573
|
+
});
|
|
539
574
|
}
|
|
540
575
|
function EmailEditor({ spec, onChange }) {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
576
|
+
const content = spec.content;
|
|
577
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
578
|
+
className: "space-y-3",
|
|
579
|
+
children: [
|
|
580
|
+
/* @__PURE__ */ jsxs("div", {
|
|
581
|
+
className: "space-y-1",
|
|
582
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
583
|
+
className: "text-xs",
|
|
584
|
+
children: "Subject"
|
|
585
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
586
|
+
value: content.subject,
|
|
587
|
+
onChange: (e) => onChange({
|
|
588
|
+
...spec,
|
|
589
|
+
content: {
|
|
590
|
+
...content,
|
|
591
|
+
subject: e.target.value
|
|
592
|
+
}
|
|
593
|
+
}),
|
|
594
|
+
className: "h-8 text-sm"
|
|
595
|
+
})]
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ jsxs("div", {
|
|
598
|
+
className: "space-y-1",
|
|
599
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
600
|
+
className: "text-xs",
|
|
601
|
+
children: "Preheader"
|
|
602
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
603
|
+
value: content.preheader ?? "",
|
|
604
|
+
onChange: (e) => onChange({
|
|
605
|
+
...spec,
|
|
606
|
+
content: {
|
|
607
|
+
...content,
|
|
608
|
+
preheader: e.target.value || void 0
|
|
609
|
+
}
|
|
610
|
+
}),
|
|
611
|
+
className: "h-8 text-sm",
|
|
612
|
+
placeholder: "Preview text…"
|
|
613
|
+
})]
|
|
614
|
+
}),
|
|
615
|
+
content.sections.map((section, i) => {
|
|
616
|
+
if (section.type === "hero" || section.type === "body" || section.type === "cta") {
|
|
617
|
+
const textField = section.type === "body" ? "text" : section.type === "cta" ? "label" : "headline";
|
|
618
|
+
const val = section[textField] ?? "";
|
|
619
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
620
|
+
className: "space-y-1",
|
|
621
|
+
children: [/* @__PURE__ */ jsxs(Label, {
|
|
622
|
+
className: "text-xs capitalize",
|
|
623
|
+
children: [
|
|
624
|
+
section.type,
|
|
625
|
+
" — ",
|
|
626
|
+
textField
|
|
627
|
+
]
|
|
628
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
629
|
+
value: val,
|
|
630
|
+
onChange: (e) => {
|
|
631
|
+
const updated = [...content.sections];
|
|
632
|
+
updated[i] = {
|
|
633
|
+
...updated[i],
|
|
634
|
+
[textField]: e.target.value
|
|
635
|
+
};
|
|
636
|
+
onChange({
|
|
637
|
+
...spec,
|
|
638
|
+
content: {
|
|
639
|
+
...content,
|
|
640
|
+
sections: updated
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
},
|
|
644
|
+
className: "text-sm min-h-[60px]"
|
|
645
|
+
})]
|
|
646
|
+
}, i);
|
|
647
|
+
}
|
|
648
|
+
return null;
|
|
649
|
+
})
|
|
650
|
+
]
|
|
651
|
+
});
|
|
593
652
|
}
|
|
594
653
|
function CopyEditor({ spec, onChange }) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
654
|
+
const content = spec.content;
|
|
655
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
656
|
+
className: "space-y-3",
|
|
657
|
+
children: [
|
|
658
|
+
/* @__PURE__ */ jsxs("div", {
|
|
659
|
+
className: "space-y-1",
|
|
660
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
661
|
+
className: "text-xs",
|
|
662
|
+
children: "Headline"
|
|
663
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
664
|
+
value: content.headline,
|
|
665
|
+
onChange: (e) => onChange({
|
|
666
|
+
...spec,
|
|
667
|
+
content: {
|
|
668
|
+
...content,
|
|
669
|
+
headline: e.target.value
|
|
670
|
+
}
|
|
671
|
+
}),
|
|
672
|
+
className: "h-8 text-sm"
|
|
673
|
+
})]
|
|
674
|
+
}),
|
|
675
|
+
/* @__PURE__ */ jsxs("div", {
|
|
676
|
+
className: "space-y-1",
|
|
677
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
678
|
+
className: "text-xs",
|
|
679
|
+
children: "Body"
|
|
680
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
681
|
+
value: content.body,
|
|
682
|
+
onChange: (e) => onChange({
|
|
683
|
+
...spec,
|
|
684
|
+
content: {
|
|
685
|
+
...content,
|
|
686
|
+
body: e.target.value
|
|
687
|
+
}
|
|
688
|
+
}),
|
|
689
|
+
className: "text-sm min-h-[80px]"
|
|
690
|
+
})]
|
|
691
|
+
}),
|
|
692
|
+
/* @__PURE__ */ jsxs("div", {
|
|
693
|
+
className: "space-y-1",
|
|
694
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
695
|
+
className: "text-xs",
|
|
696
|
+
children: "Hashtags (comma-separated)"
|
|
697
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
698
|
+
value: (content.hashtags ?? []).join(", "),
|
|
699
|
+
onChange: (e) => onChange({
|
|
700
|
+
...spec,
|
|
701
|
+
content: {
|
|
702
|
+
...content,
|
|
703
|
+
hashtags: e.target.value.split(",").map((t) => t.trim()).filter(Boolean)
|
|
704
|
+
}
|
|
705
|
+
}),
|
|
706
|
+
className: "h-8 text-sm",
|
|
707
|
+
placeholder: "marketing, growth, saas"
|
|
708
|
+
})]
|
|
709
|
+
})
|
|
710
|
+
]
|
|
711
|
+
});
|
|
632
712
|
}
|
|
633
713
|
function Preview({ spec, previewUrl, isRendering, onRenderRequest }) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
714
|
+
const { format, brand, content } = spec;
|
|
715
|
+
if (format === "email") return /* @__PURE__ */ jsx(EmailPreview, {
|
|
716
|
+
content,
|
|
717
|
+
brand,
|
|
718
|
+
previewUrl
|
|
719
|
+
});
|
|
720
|
+
if (format.startsWith("image:")) return /* @__PURE__ */ jsx(ImagePreview, {
|
|
721
|
+
content,
|
|
722
|
+
brand,
|
|
723
|
+
format: format === "image:story" ? "story" : format === "image:carousel" ? "carousel" : "feed"
|
|
724
|
+
});
|
|
725
|
+
if (format.startsWith("video:")) return /* @__PURE__ */ jsx(VideoPreview, {
|
|
726
|
+
content,
|
|
727
|
+
brand,
|
|
728
|
+
onRenderRequest,
|
|
729
|
+
isRendering
|
|
730
|
+
});
|
|
731
|
+
if (format.startsWith("copy:")) return /* @__PURE__ */ jsx(CopyPreview, { content });
|
|
732
|
+
return null;
|
|
647
733
|
}
|
|
648
734
|
function AssetEditor({ spec, previewUrl, isRendering, onSave, onRenderRequest, onRevisionRequest, className }) {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
735
|
+
const [draft, setDraft] = React$1.useState(spec);
|
|
736
|
+
const [revisionInput, setRevisionInput] = React$1.useState("");
|
|
737
|
+
const isDirty = JSON.stringify(draft) !== JSON.stringify(spec);
|
|
738
|
+
React$1.useEffect(() => {
|
|
739
|
+
setDraft(spec);
|
|
740
|
+
}, [spec]);
|
|
741
|
+
const handleRevision = () => {
|
|
742
|
+
if (!revisionInput.trim()) return;
|
|
743
|
+
onRevisionRequest?.(revisionInput.trim());
|
|
744
|
+
setRevisionInput("");
|
|
745
|
+
};
|
|
746
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
747
|
+
className: cn("grid grid-cols-2 gap-4 h-full min-h-0", className),
|
|
748
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
749
|
+
className: "flex flex-col gap-3 overflow-y-auto pr-1",
|
|
750
|
+
children: [
|
|
751
|
+
/* @__PURE__ */ jsxs("div", {
|
|
752
|
+
className: "flex items-center justify-between",
|
|
753
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
754
|
+
className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider",
|
|
755
|
+
children: draft.format
|
|
756
|
+
}), isDirty && onSave && /* @__PURE__ */ jsxs(Button, {
|
|
757
|
+
size: "sm",
|
|
758
|
+
variant: "default",
|
|
759
|
+
onClick: () => onSave(draft),
|
|
760
|
+
className: "h-7 gap-1.5 text-xs",
|
|
761
|
+
children: [/* @__PURE__ */ jsx(Save, { size: 12 }), "Save"]
|
|
762
|
+
})]
|
|
763
|
+
}),
|
|
764
|
+
draft.format === "email" && /* @__PURE__ */ jsx(EmailEditor, {
|
|
765
|
+
spec: draft,
|
|
766
|
+
onChange: (s) => setDraft(s)
|
|
767
|
+
}),
|
|
768
|
+
(draft.format === "copy:caption" || draft.format === "copy:headline" || draft.format === "copy:sms") && /* @__PURE__ */ jsx(CopyEditor, {
|
|
769
|
+
spec: draft,
|
|
770
|
+
onChange: (s) => setDraft(s)
|
|
771
|
+
}),
|
|
772
|
+
/* @__PURE__ */ jsx(BrandPanel, {
|
|
773
|
+
brand: draft.brand,
|
|
774
|
+
onChange: (b) => setDraft((d) => ({
|
|
775
|
+
...d,
|
|
776
|
+
brand: b
|
|
777
|
+
}))
|
|
778
|
+
}),
|
|
779
|
+
onRevisionRequest && /* @__PURE__ */ jsxs("div", {
|
|
780
|
+
className: "space-y-1.5",
|
|
781
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
782
|
+
className: "text-xs",
|
|
783
|
+
children: "Ask agent to revise"
|
|
784
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
785
|
+
className: "flex gap-1.5",
|
|
786
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
787
|
+
value: revisionInput,
|
|
788
|
+
onChange: (e) => setRevisionInput(e.target.value),
|
|
789
|
+
placeholder: "Make the CTA more urgent…",
|
|
790
|
+
className: "h-8 text-sm",
|
|
791
|
+
onKeyDown: (e) => {
|
|
792
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
793
|
+
e.preventDefault();
|
|
794
|
+
handleRevision();
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
798
|
+
size: "sm",
|
|
799
|
+
variant: "outline",
|
|
800
|
+
onClick: handleRevision,
|
|
801
|
+
disabled: !revisionInput.trim(),
|
|
802
|
+
className: "h-8 px-2",
|
|
803
|
+
children: /* @__PURE__ */ jsx(MessageSquare, { size: 14 })
|
|
804
|
+
})]
|
|
805
|
+
})]
|
|
806
|
+
})
|
|
807
|
+
]
|
|
808
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
809
|
+
className: "overflow-y-auto",
|
|
810
|
+
children: /* @__PURE__ */ jsx(Preview, {
|
|
811
|
+
spec: draft,
|
|
812
|
+
previewUrl,
|
|
813
|
+
isRendering,
|
|
814
|
+
onRenderRequest
|
|
815
|
+
})
|
|
816
|
+
})]
|
|
817
|
+
});
|
|
714
818
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
819
|
+
//#endregion
|
|
820
|
+
//#region src/assets/approval-queue.tsx
|
|
821
|
+
const FORMAT_OPTIONS = [
|
|
822
|
+
{
|
|
823
|
+
value: "all",
|
|
824
|
+
label: "All formats"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
value: "email",
|
|
828
|
+
label: "Email"
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
value: "image:feed",
|
|
832
|
+
label: "Feed image"
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
value: "image:story",
|
|
836
|
+
label: "Story"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
value: "image:carousel",
|
|
840
|
+
label: "Carousel"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
value: "video:reel",
|
|
844
|
+
label: "Reel"
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
value: "video:feed",
|
|
848
|
+
label: "Video"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
value: "copy:caption",
|
|
852
|
+
label: "Caption"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
value: "copy:headline",
|
|
856
|
+
label: "Headline"
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
value: "copy:sms",
|
|
860
|
+
label: "SMS"
|
|
861
|
+
}
|
|
729
862
|
];
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
863
|
+
const STATUS_OPTIONS = [
|
|
864
|
+
{
|
|
865
|
+
value: "all",
|
|
866
|
+
label: "All statuses"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
value: "pending_review",
|
|
870
|
+
label: "Needs review"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
value: "approved",
|
|
874
|
+
label: "Approved"
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
value: "rejected",
|
|
878
|
+
label: "Rejected"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
value: "scheduled",
|
|
882
|
+
label: "Scheduled"
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
value: "published",
|
|
886
|
+
label: "Published"
|
|
887
|
+
}
|
|
737
888
|
];
|
|
738
|
-
function ApprovalQueue({
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
a.id
|
|
870
|
-
)) })
|
|
871
|
-
] });
|
|
889
|
+
function ApprovalQueue({ assets, variantCounts = {}, onApprove, onReject, onEdit, onSave, onRevisionRequest, onRenderRequest, renderingIds = /* @__PURE__ */ new Set(), previewUrls = {}, className }) {
|
|
890
|
+
const [search, setSearch] = React$1.useState("");
|
|
891
|
+
const [formatFilter, setFormatFilter] = React$1.useState("all");
|
|
892
|
+
const [statusFilter, setStatusFilter] = React$1.useState("pending_review");
|
|
893
|
+
const [editingId, setEditingId] = React$1.useState(null);
|
|
894
|
+
const [scheduleDate, setScheduleDate] = React$1.useState("");
|
|
895
|
+
const filtered = assets.filter((a) => {
|
|
896
|
+
if (formatFilter !== "all" && a.format !== formatFilter) return false;
|
|
897
|
+
if (statusFilter !== "all" && a.status !== statusFilter) return false;
|
|
898
|
+
if (search) {
|
|
899
|
+
const q = search.toLowerCase();
|
|
900
|
+
if (!a.id.includes(q) && !a.format.includes(q) && !a.brand.businessName.toLowerCase().includes(q)) return false;
|
|
901
|
+
}
|
|
902
|
+
return true;
|
|
903
|
+
});
|
|
904
|
+
const pendingCount = assets.filter((a) => a.status === "pending_review").length;
|
|
905
|
+
const handleBulkApprove = () => {
|
|
906
|
+
filtered.filter((a) => a.status === "pending_review").forEach((a) => onApprove?.(a.id, scheduleDate || void 0));
|
|
907
|
+
};
|
|
908
|
+
const editingSpec = editingId ? assets.find((a) => a.id === editingId) : null;
|
|
909
|
+
if (editingSpec) return /* @__PURE__ */ jsxs("div", {
|
|
910
|
+
className: cn("flex flex-col gap-3 h-full", className),
|
|
911
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
912
|
+
className: "flex items-center justify-between",
|
|
913
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
914
|
+
type: "button",
|
|
915
|
+
onClick: () => setEditingId(null),
|
|
916
|
+
className: "text-xs text-muted-foreground hover:text-foreground",
|
|
917
|
+
children: "← Back to queue"
|
|
918
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
919
|
+
className: "flex gap-2",
|
|
920
|
+
children: [onReject && editingSpec.status === "pending_review" && /* @__PURE__ */ jsx(Button, {
|
|
921
|
+
size: "sm",
|
|
922
|
+
variant: "outline",
|
|
923
|
+
onClick: () => {
|
|
924
|
+
onReject(editingSpec.id);
|
|
925
|
+
setEditingId(null);
|
|
926
|
+
},
|
|
927
|
+
children: "Reject"
|
|
928
|
+
}), onApprove && editingSpec.status === "pending_review" && /* @__PURE__ */ jsx(Button, {
|
|
929
|
+
size: "sm",
|
|
930
|
+
onClick: () => {
|
|
931
|
+
onApprove(editingSpec.id, scheduleDate || void 0);
|
|
932
|
+
setEditingId(null);
|
|
933
|
+
},
|
|
934
|
+
children: "Approve"
|
|
935
|
+
})]
|
|
936
|
+
})]
|
|
937
|
+
}), /* @__PURE__ */ jsx(AssetEditor, {
|
|
938
|
+
spec: editingSpec,
|
|
939
|
+
previewUrl: previewUrls[editingSpec.id],
|
|
940
|
+
isRendering: renderingIds.has(editingSpec.id),
|
|
941
|
+
onSave: (s) => {
|
|
942
|
+
onSave?.(s);
|
|
943
|
+
setEditingId(null);
|
|
944
|
+
},
|
|
945
|
+
onRenderRequest: () => onRenderRequest?.(editingSpec.id),
|
|
946
|
+
onRevisionRequest: (instr) => onRevisionRequest?.(editingSpec.id, instr),
|
|
947
|
+
className: "flex-1"
|
|
948
|
+
})]
|
|
949
|
+
});
|
|
950
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
951
|
+
className: cn("flex flex-col gap-3", className),
|
|
952
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
953
|
+
className: "flex flex-wrap gap-2 items-center",
|
|
954
|
+
children: [
|
|
955
|
+
/* @__PURE__ */ jsxs("div", {
|
|
956
|
+
className: "relative flex-1 min-w-40",
|
|
957
|
+
children: [/* @__PURE__ */ jsx(Search, {
|
|
958
|
+
size: 12,
|
|
959
|
+
className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
960
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
961
|
+
value: search,
|
|
962
|
+
onChange: (e) => setSearch(e.target.value),
|
|
963
|
+
placeholder: "Filter assets…",
|
|
964
|
+
className: "h-8 pl-7 text-sm"
|
|
965
|
+
})]
|
|
966
|
+
}),
|
|
967
|
+
/* @__PURE__ */ jsx("select", {
|
|
968
|
+
value: formatFilter,
|
|
969
|
+
onChange: (e) => setFormatFilter(e.target.value),
|
|
970
|
+
className: "h-8 px-2 text-xs rounded border border-input bg-background",
|
|
971
|
+
children: FORMAT_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", {
|
|
972
|
+
value: o.value,
|
|
973
|
+
children: o.label
|
|
974
|
+
}, o.value))
|
|
975
|
+
}),
|
|
976
|
+
/* @__PURE__ */ jsx("select", {
|
|
977
|
+
value: statusFilter,
|
|
978
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
979
|
+
className: "h-8 px-2 text-xs rounded border border-input bg-background",
|
|
980
|
+
children: STATUS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", {
|
|
981
|
+
value: o.value,
|
|
982
|
+
children: o.label
|
|
983
|
+
}, o.value))
|
|
984
|
+
}),
|
|
985
|
+
pendingCount > 0 && onApprove && /* @__PURE__ */ jsxs("div", {
|
|
986
|
+
className: "flex items-center gap-1.5",
|
|
987
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
988
|
+
type: "date",
|
|
989
|
+
value: scheduleDate,
|
|
990
|
+
onChange: (e) => setScheduleDate(e.target.value),
|
|
991
|
+
className: "h-8 px-2 text-xs rounded border border-input bg-background w-32"
|
|
992
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
993
|
+
size: "sm",
|
|
994
|
+
variant: "outline",
|
|
995
|
+
onClick: handleBulkApprove,
|
|
996
|
+
className: "h-8 gap-1.5 text-xs",
|
|
997
|
+
children: [
|
|
998
|
+
/* @__PURE__ */ jsx(CheckCheck, { size: 13 }),
|
|
999
|
+
"Approve all (",
|
|
1000
|
+
pendingCount,
|
|
1001
|
+
")"
|
|
1002
|
+
]
|
|
1003
|
+
})]
|
|
1004
|
+
})
|
|
1005
|
+
]
|
|
1006
|
+
}), filtered.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
1007
|
+
className: "py-12 text-center text-sm text-muted-foreground",
|
|
1008
|
+
children: "No assets match your filters."
|
|
1009
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1010
|
+
className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3",
|
|
1011
|
+
children: filtered.map((a) => /* @__PURE__ */ jsx(AssetCard, {
|
|
1012
|
+
spec: a,
|
|
1013
|
+
variantCount: variantCounts[a.id],
|
|
1014
|
+
onApprove,
|
|
1015
|
+
onReject,
|
|
1016
|
+
onEdit: () => setEditingId(a.id)
|
|
1017
|
+
}, a.id))
|
|
1018
|
+
})]
|
|
1019
|
+
});
|
|
872
1020
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
import { Button as Button4, Badge as Badge2 } from "@tangle-network/ui/primitives";
|
|
876
|
-
import { Trophy } from "lucide-react";
|
|
877
|
-
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/assets/variant-compare.tsx
|
|
878
1023
|
function VariantCompare({ variants, onPromote, onSave, className }) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1024
|
+
const cols = Math.min(variants.length, 3);
|
|
1025
|
+
if (variants.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
1026
|
+
className: cn("py-12 text-center text-sm text-muted-foreground", className),
|
|
1027
|
+
children: "No variants to compare."
|
|
1028
|
+
});
|
|
1029
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1030
|
+
className: cn("flex flex-col gap-3", className),
|
|
1031
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1032
|
+
className: "text-xs text-muted-foreground",
|
|
1033
|
+
children: [
|
|
1034
|
+
"Comparing ",
|
|
1035
|
+
variants.length,
|
|
1036
|
+
" variant",
|
|
1037
|
+
variants.length !== 1 ? "s" : "",
|
|
1038
|
+
".",
|
|
1039
|
+
onPromote && " Promote one to mark it approved and archive the rest."
|
|
1040
|
+
]
|
|
1041
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1042
|
+
className: "grid gap-3",
|
|
1043
|
+
style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
|
|
1044
|
+
children: variants.slice(0, 3).map((variant) => /* @__PURE__ */ jsxs("div", {
|
|
1045
|
+
className: "flex flex-col gap-2 rounded-lg border border-border p-3",
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1048
|
+
className: "flex items-center justify-between",
|
|
1049
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1050
|
+
className: "flex items-center gap-1.5",
|
|
1051
|
+
children: [
|
|
1052
|
+
/* @__PURE__ */ jsx("span", {
|
|
1053
|
+
className: "text-xs font-medium",
|
|
1054
|
+
children: variant.label
|
|
1055
|
+
}),
|
|
1056
|
+
variant.approvedAt && /* @__PURE__ */ jsx(Badge, {
|
|
1057
|
+
variant: "default",
|
|
1058
|
+
className: "text-[10px] h-4 px-1.5",
|
|
1059
|
+
children: "Approved"
|
|
1060
|
+
}),
|
|
1061
|
+
variant.rejectedAt && /* @__PURE__ */ jsx(Badge, {
|
|
1062
|
+
variant: "destructive",
|
|
1063
|
+
className: "text-[10px] h-4 px-1.5",
|
|
1064
|
+
children: "Rejected"
|
|
1065
|
+
})
|
|
1066
|
+
]
|
|
1067
|
+
}), onPromote && !variant.approvedAt && /* @__PURE__ */ jsxs(Button, {
|
|
1068
|
+
size: "sm",
|
|
1069
|
+
variant: "outline",
|
|
1070
|
+
onClick: () => onPromote(variant.id),
|
|
1071
|
+
className: "h-6 gap-1 text-[11px] px-2",
|
|
1072
|
+
children: [/* @__PURE__ */ jsx(Trophy, { size: 11 }), "Pick this"]
|
|
1073
|
+
})]
|
|
1074
|
+
}),
|
|
1075
|
+
/* @__PURE__ */ jsx(AssetEditor, {
|
|
1076
|
+
spec: variant.spec,
|
|
1077
|
+
onSave: (spec) => onSave?.({
|
|
1078
|
+
...variant,
|
|
1079
|
+
spec
|
|
1080
|
+
}),
|
|
1081
|
+
className: "min-h-[300px]"
|
|
1082
|
+
}),
|
|
1083
|
+
variant.editLog.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
1084
|
+
className: "text-[10px] text-muted-foreground space-y-0.5",
|
|
1085
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1086
|
+
className: "font-medium",
|
|
1087
|
+
children: "Edit history"
|
|
1088
|
+
}), variant.editLog.slice(-3).map((ev, i) => /* @__PURE__ */ jsxs("div", { children: [ev.action, ev.editedFields?.length ? ` (${ev.editedFields.join(", ")})` : ""] }, i))]
|
|
1089
|
+
})
|
|
1090
|
+
]
|
|
1091
|
+
}, variant.id))
|
|
1092
|
+
})]
|
|
1093
|
+
});
|
|
937
1094
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
AssetCard,
|
|
941
|
-
AssetEditor,
|
|
942
|
-
CopyPreview,
|
|
943
|
-
EmailPreview,
|
|
944
|
-
ImagePreview,
|
|
945
|
-
VariantCompare,
|
|
946
|
-
VideoPreview
|
|
947
|
-
};
|
|
1095
|
+
//#endregion
|
|
1096
|
+
export { ApprovalQueue, AssetCard, AssetEditor, CopyPreview, EmailPreview, ImagePreview, VariantCompare, VideoPreview };
|