camox 0.72.0 → 0.75.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/core/lib/artifactRuntime.js +4 -2
- package/dist/features/preview/components/PageInfo.js +121 -98
- package/dist/features/preview/components/SelectionEditor.js +1 -1
- package/dist/features/renderer/RendererFrames.js +47 -41
- package/dist/features/routes/pageRuntime.js +15 -4
- package/dist/features/runtime/ClaimCard.js +192 -0
- package/dist/features/runtime/pageApp.js +4 -3
- package/dist/features/runtime/runtime.js +26 -5
- package/dist/features/runtime/worker.js +2 -2
- package/dist/features/runtime/workerRequest.d.ts +6 -0
- package/dist/features/runtime/workerRequest.js +13 -1
- package/dist/features/runtime/workerRuntime.d.ts +2 -2
- package/dist/features/runtime/workerRuntime.js +2 -2
- package/dist/features/studio/components/AgentSidebar.js +7 -7
- package/dist/features/studio/components/ChatWidget.js +142 -106
- package/dist/features/studio/components/ContentFindings.js +127 -230
- package/dist/features/studio/components/DeleteDraftDialog.js +112 -0
- package/dist/features/studio/components/DraftBar.js +98 -53
- package/dist/features/studio/components/DraftsControl.js +203 -190
- package/dist/features/studio/components/ReviewDraftDialog.js +670 -0
- package/dist/features/studio/components/{Patrol.js → Specialists.js} +291 -330
- package/dist/features/studio/components/Squareling.js +5 -5
- package/dist/features/studio/components/ThreadComposer.js +106 -127
- package/dist/features/studio/components/ThreadMessages.js +246 -71
- package/dist/features/studio/findingSentence.js +14 -12
- package/dist/features/studio/fixMessage.js +23 -0
- package/dist/features/studio/reportSentence.js +1 -1
- package/dist/features/studio/{patrollerBio.js → specialistBio.js} +8 -5
- package/dist/features/studio/studioStore.js +29 -15
- package/dist/features/studio/workingSentence.js +1 -1
- package/dist/lib/api-client.js +5 -1
- package/dist/lib/queries.js +5 -5
- package/dist/lib/studio-reads.d.ts +1 -1
- package/dist/lib/studio-reads.js +5 -5
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { useCurrentDraftId } from "../../../lib/draft-scope.js";
|
|
2
1
|
import { useViewLocale } from "../../../lib/view-locale-context.js";
|
|
3
2
|
import { AuthContext } from "../../../lib/auth.js";
|
|
4
3
|
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
5
|
-
import {
|
|
4
|
+
import { specialistMutations } from "../../../lib/queries.js";
|
|
6
5
|
import { studioStore } from "../studioStore.js";
|
|
7
|
-
import {
|
|
8
|
-
import { useShowInCanvas } from "../showInCanvas.js";
|
|
6
|
+
import { dismissLabel, findingSentenceInPlace, fixWithAgentMessage } from "../findingSentence.js";
|
|
9
7
|
import { c } from "react/compiler-runtime";
|
|
10
8
|
import * as React from "react";
|
|
11
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -16,9 +14,9 @@ import { toast } from "@camox/ui/toaster";
|
|
|
16
14
|
import { Alert, AlertDescription, AlertTitle } from "@camox/ui/alert";
|
|
17
15
|
|
|
18
16
|
//#region src/features/studio/components/ContentFindings.tsx
|
|
19
|
-
/** The open findings of the
|
|
17
|
+
/** The open findings of the Specialists viewed in a subject, in the locale viewed. */
|
|
20
18
|
function useContentFindings(subject) {
|
|
21
|
-
const $ = c(
|
|
19
|
+
const $ = c(21);
|
|
22
20
|
const { projectUuid } = React.useContext(AuthContext);
|
|
23
21
|
let t0;
|
|
24
22
|
if ($[0] !== projectUuid) {
|
|
@@ -29,7 +27,7 @@ function useContentFindings(subject) {
|
|
|
29
27
|
const { data: project } = useReadQuery(t0);
|
|
30
28
|
let t1;
|
|
31
29
|
if ($[2] !== project?.id) {
|
|
32
|
-
t1 = reads.
|
|
30
|
+
t1 = reads.specialists({ projectId: project?.id ?? 0 });
|
|
33
31
|
$[2] = project?.id;
|
|
34
32
|
$[3] = t1;
|
|
35
33
|
} else t1 = $[3];
|
|
@@ -66,32 +64,29 @@ function useContentFindings(subject) {
|
|
|
66
64
|
} else t7 = $[13];
|
|
67
65
|
const tag = t7;
|
|
68
66
|
let t8;
|
|
69
|
-
if ($[14] !== subject || $[15] !== tag || $[16] !== view?.
|
|
70
|
-
t8 = subject === null ? [] : (view?.
|
|
67
|
+
if ($[14] !== subject || $[15] !== tag || $[16] !== view?.specialists) {
|
|
68
|
+
t8 = subject === null ? [] : (view?.specialists ?? []).flatMap((specialist) => specialist.findings.filter((finding) => finding.subject.entity === subject.entity && finding.subject.id === subject.id && finding.locale === tag).map((finding_0) => ({
|
|
71
69
|
...finding_0,
|
|
72
|
-
role:
|
|
70
|
+
role: specialist.role
|
|
73
71
|
})));
|
|
74
72
|
$[14] = subject;
|
|
75
73
|
$[15] = tag;
|
|
76
|
-
$[16] = view?.
|
|
74
|
+
$[16] = view?.specialists;
|
|
77
75
|
$[17] = t8;
|
|
78
76
|
} else t8 = $[17];
|
|
79
77
|
const findings = t8;
|
|
80
78
|
const t9 = project?.id;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
t11 = {
|
|
79
|
+
let t10;
|
|
80
|
+
if ($[18] !== findings || $[19] !== t9) {
|
|
81
|
+
t10 = {
|
|
85
82
|
projectId: t9,
|
|
86
|
-
patrolDraft: t10,
|
|
87
83
|
findings
|
|
88
84
|
};
|
|
89
85
|
$[18] = findings;
|
|
90
|
-
$[19] =
|
|
91
|
-
$[20] =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return t11;
|
|
86
|
+
$[19] = t9;
|
|
87
|
+
$[20] = t10;
|
|
88
|
+
} else t10 = $[20];
|
|
89
|
+
return t10;
|
|
95
90
|
}
|
|
96
91
|
function _temp(locale) {
|
|
97
92
|
return locale.isDefault;
|
|
@@ -107,23 +102,23 @@ function findingsHint(view, field) {
|
|
|
107
102
|
* editor. Without `field`, those in none of `fields`: about the subject as a whole.
|
|
108
103
|
*/
|
|
109
104
|
function ContentFindings(t0) {
|
|
110
|
-
const $ = c(
|
|
105
|
+
const $ = c(18);
|
|
111
106
|
const { view, field, fields, className } = t0;
|
|
112
|
-
const { projectId,
|
|
107
|
+
const { projectId, findings } = view;
|
|
113
108
|
let t1;
|
|
114
109
|
let t2;
|
|
115
110
|
let t3;
|
|
116
111
|
let t4;
|
|
117
|
-
if ($[0] !== className || $[1] !== field || $[2] !== fields || $[3] !== findings || $[4] !==
|
|
112
|
+
if ($[0] !== className || $[1] !== field || $[2] !== fields || $[3] !== findings || $[4] !== projectId) {
|
|
118
113
|
t4 = Symbol.for("react.early_return_sentinel");
|
|
119
114
|
bb0: {
|
|
120
115
|
let t5;
|
|
121
|
-
if ($[
|
|
116
|
+
if ($[9] !== field || $[10] !== fields) {
|
|
122
117
|
t5 = (finding) => field === void 0 ? !fields.includes(finding.field) : finding.field === field;
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
} else t5 = $[
|
|
118
|
+
$[9] = field;
|
|
119
|
+
$[10] = fields;
|
|
120
|
+
$[11] = t5;
|
|
121
|
+
} else t5 = $[11];
|
|
127
122
|
const shown = findings.filter(t5);
|
|
128
123
|
if (projectId === void 0 || shown.length === 0) {
|
|
129
124
|
t4 = null;
|
|
@@ -132,265 +127,167 @@ function ContentFindings(t0) {
|
|
|
132
127
|
t1 = true;
|
|
133
128
|
t2 = className ?? "space-y-2 px-2 pb-4";
|
|
134
129
|
let t6;
|
|
135
|
-
if ($[
|
|
130
|
+
if ($[12] !== projectId) {
|
|
136
131
|
t6 = (finding_0) => /* @__PURE__ */ jsx(FindingAlert, {
|
|
137
132
|
projectId,
|
|
138
|
-
finding: finding_0
|
|
139
|
-
patrolDraft
|
|
133
|
+
finding: finding_0
|
|
140
134
|
}, finding_0.id);
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
|
|
144
|
-
} else t6 = $[15];
|
|
135
|
+
$[12] = projectId;
|
|
136
|
+
$[13] = t6;
|
|
137
|
+
} else t6 = $[13];
|
|
145
138
|
t3 = shown.map(t6);
|
|
146
139
|
}
|
|
147
140
|
$[0] = className;
|
|
148
141
|
$[1] = field;
|
|
149
142
|
$[2] = fields;
|
|
150
143
|
$[3] = findings;
|
|
151
|
-
$[4] =
|
|
152
|
-
$[5] =
|
|
153
|
-
$[6] =
|
|
154
|
-
$[7] =
|
|
155
|
-
$[8] =
|
|
156
|
-
$[9] = t4;
|
|
144
|
+
$[4] = projectId;
|
|
145
|
+
$[5] = t1;
|
|
146
|
+
$[6] = t2;
|
|
147
|
+
$[7] = t3;
|
|
148
|
+
$[8] = t4;
|
|
157
149
|
} else {
|
|
158
|
-
t1 = $[
|
|
159
|
-
t2 = $[
|
|
160
|
-
t3 = $[
|
|
161
|
-
t4 = $[
|
|
150
|
+
t1 = $[5];
|
|
151
|
+
t2 = $[6];
|
|
152
|
+
t3 = $[7];
|
|
153
|
+
t4 = $[8];
|
|
162
154
|
}
|
|
163
155
|
if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
|
|
164
156
|
let t5;
|
|
165
|
-
if ($[
|
|
157
|
+
if ($[14] !== t1 || $[15] !== t2 || $[16] !== t3) {
|
|
166
158
|
t5 = /* @__PURE__ */ jsx("div", {
|
|
167
159
|
"data-content-findings": t1,
|
|
168
160
|
className: t2,
|
|
169
161
|
children: t3
|
|
170
162
|
});
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
} else t5 = $[
|
|
163
|
+
$[14] = t1;
|
|
164
|
+
$[15] = t2;
|
|
165
|
+
$[16] = t3;
|
|
166
|
+
$[17] = t5;
|
|
167
|
+
} else t5 = $[17];
|
|
176
168
|
return t5;
|
|
177
169
|
}
|
|
178
170
|
function FindingAlert(t0) {
|
|
179
|
-
const $ = c(
|
|
180
|
-
const { projectId, finding
|
|
181
|
-
const draftId = useCurrentDraftId();
|
|
171
|
+
const $ = c(29);
|
|
172
|
+
const { projectId, finding } = t0;
|
|
182
173
|
let t1;
|
|
183
174
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
184
175
|
t1 = {
|
|
185
|
-
...
|
|
186
|
-
|
|
187
|
-
onError: _temp3
|
|
176
|
+
...specialistMutations.dismissFinding(),
|
|
177
|
+
onError: _temp2
|
|
188
178
|
};
|
|
189
179
|
$[0] = t1;
|
|
190
180
|
} else t1 = $[0];
|
|
191
|
-
const
|
|
181
|
+
const dismiss = useMutation(t1);
|
|
192
182
|
let t2;
|
|
193
183
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
|
-
t2 = {
|
|
195
|
-
...patrolMutations.dismissFinding(),
|
|
196
|
-
onError: _temp4
|
|
197
|
-
};
|
|
184
|
+
t2 = /* @__PURE__ */ jsx(CircleAlert, {});
|
|
198
185
|
$[1] = t2;
|
|
199
186
|
} else t2 = $[1];
|
|
200
|
-
const dismiss = useMutation(t2);
|
|
201
|
-
const busy = applyFix.isPending || dismiss.isPending;
|
|
202
|
-
const fixesHere = draftId !== null && (!finding.live || draftId === patrolDraft?.id);
|
|
203
187
|
let t3;
|
|
204
|
-
if ($[2]
|
|
205
|
-
t3 =
|
|
206
|
-
$[2] =
|
|
207
|
-
|
|
188
|
+
if ($[2] !== finding) {
|
|
189
|
+
t3 = findingSentenceInPlace(finding);
|
|
190
|
+
$[2] = finding;
|
|
191
|
+
$[3] = t3;
|
|
192
|
+
} else t3 = $[3];
|
|
208
193
|
let t4;
|
|
209
|
-
if ($[
|
|
210
|
-
t4 =
|
|
211
|
-
$[3] = finding;
|
|
212
|
-
$[4] = t4;
|
|
213
|
-
} else t4 = $[4];
|
|
214
|
-
let t5;
|
|
215
|
-
if ($[5] !== t4) {
|
|
216
|
-
t5 = /* @__PURE__ */ jsx(AlertTitle, {
|
|
194
|
+
if ($[4] !== t3) {
|
|
195
|
+
t4 = /* @__PURE__ */ jsx(AlertTitle, {
|
|
217
196
|
className: "text-xs font-normal",
|
|
218
|
-
children:
|
|
197
|
+
children: t3
|
|
219
198
|
});
|
|
199
|
+
$[4] = t3;
|
|
220
200
|
$[5] = t4;
|
|
221
|
-
|
|
222
|
-
|
|
201
|
+
} else t4 = $[5];
|
|
202
|
+
let t5;
|
|
203
|
+
if ($[6] !== finding.role) {
|
|
204
|
+
t5 = /* @__PURE__ */ jsx("p", { children: finding.role });
|
|
205
|
+
$[6] = finding.role;
|
|
206
|
+
$[7] = t5;
|
|
207
|
+
} else t5 = $[7];
|
|
223
208
|
let t6;
|
|
224
|
-
if ($[
|
|
225
|
-
t6 = /* @__PURE__ */ jsx(
|
|
226
|
-
$[7] = finding.role;
|
|
227
|
-
$[8] = t6;
|
|
228
|
-
} else t6 = $[8];
|
|
229
|
-
let t7;
|
|
230
|
-
if ($[9] !== applyFix || $[10] !== busy || $[11] !== finding.fix || $[12] !== finding.id || $[13] !== fixesHere || $[14] !== projectId) {
|
|
231
|
-
t7 = fixesHere && finding.fix && /* @__PURE__ */ jsx(Button, {
|
|
209
|
+
if ($[8] !== finding) {
|
|
210
|
+
t6 = /* @__PURE__ */ jsx(Button, {
|
|
232
211
|
variant: "outline",
|
|
233
212
|
size: "xs",
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
projectId,
|
|
237
|
-
findingId: finding.id
|
|
238
|
-
}),
|
|
239
|
-
children: fixLabel(finding.fix)
|
|
213
|
+
onClick: () => studioStore.trigger.sendToAgent({ text: fixWithAgentMessage(finding, finding.role) }),
|
|
214
|
+
children: "Fix with agent"
|
|
240
215
|
});
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
$[13] = fixesHere;
|
|
246
|
-
$[14] = projectId;
|
|
247
|
-
$[15] = t7;
|
|
248
|
-
} else t7 = $[15];
|
|
216
|
+
$[8] = finding;
|
|
217
|
+
$[9] = t6;
|
|
218
|
+
} else t6 = $[9];
|
|
219
|
+
const t7 = dismiss.isPending;
|
|
249
220
|
let t8;
|
|
250
|
-
if ($[
|
|
251
|
-
t8 =
|
|
252
|
-
variant: "outline",
|
|
253
|
-
size: "xs",
|
|
254
|
-
onClick: () => studioStore.trigger.askAgent({ text: askAgentMessage(finding, finding.role) }),
|
|
255
|
-
children: "Ask the agent"
|
|
256
|
-
});
|
|
257
|
-
$[16] = finding;
|
|
258
|
-
$[17] = fixesHere;
|
|
259
|
-
$[18] = t8;
|
|
260
|
-
} else t8 = $[18];
|
|
261
|
-
let t9;
|
|
262
|
-
if ($[19] !== draftId || $[20] !== finding || $[21] !== patrolDraft) {
|
|
263
|
-
t9 = draftId === null && patrolDraft && /* @__PURE__ */ jsx(OpenInPatrolDraft, {
|
|
264
|
-
finding,
|
|
265
|
-
patrolDraft
|
|
266
|
-
});
|
|
267
|
-
$[19] = draftId;
|
|
268
|
-
$[20] = finding;
|
|
269
|
-
$[21] = patrolDraft;
|
|
270
|
-
$[22] = t9;
|
|
271
|
-
} else t9 = $[22];
|
|
272
|
-
let t10;
|
|
273
|
-
if ($[23] !== dismiss || $[24] !== finding.id || $[25] !== projectId) {
|
|
274
|
-
t10 = () => dismiss.mutate({
|
|
221
|
+
if ($[10] !== dismiss || $[11] !== finding.id || $[12] !== projectId) {
|
|
222
|
+
t8 = () => dismiss.mutate({
|
|
275
223
|
projectId,
|
|
276
224
|
findingId: finding.id
|
|
277
225
|
});
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
} else
|
|
283
|
-
let
|
|
284
|
-
if ($[
|
|
285
|
-
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
} else
|
|
289
|
-
let
|
|
290
|
-
if ($[
|
|
291
|
-
|
|
226
|
+
$[10] = dismiss;
|
|
227
|
+
$[11] = finding.id;
|
|
228
|
+
$[12] = projectId;
|
|
229
|
+
$[13] = t8;
|
|
230
|
+
} else t8 = $[13];
|
|
231
|
+
let t9;
|
|
232
|
+
if ($[14] !== finding.about) {
|
|
233
|
+
t9 = dismissLabel(finding.about);
|
|
234
|
+
$[14] = finding.about;
|
|
235
|
+
$[15] = t9;
|
|
236
|
+
} else t9 = $[15];
|
|
237
|
+
let t10;
|
|
238
|
+
if ($[16] !== dismiss.isPending || $[17] !== t8 || $[18] !== t9) {
|
|
239
|
+
t10 = /* @__PURE__ */ jsx(Button, {
|
|
292
240
|
variant: "ghost",
|
|
293
241
|
size: "xs",
|
|
294
|
-
disabled:
|
|
295
|
-
onClick:
|
|
296
|
-
children:
|
|
242
|
+
disabled: t7,
|
|
243
|
+
onClick: t8,
|
|
244
|
+
children: t9
|
|
297
245
|
});
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
} else
|
|
303
|
-
let
|
|
304
|
-
if ($[
|
|
305
|
-
|
|
246
|
+
$[16] = dismiss.isPending;
|
|
247
|
+
$[17] = t8;
|
|
248
|
+
$[18] = t9;
|
|
249
|
+
$[19] = t10;
|
|
250
|
+
} else t10 = $[19];
|
|
251
|
+
let t11;
|
|
252
|
+
if ($[20] !== t10 || $[21] !== t6) {
|
|
253
|
+
t11 = /* @__PURE__ */ jsxs("span", {
|
|
306
254
|
className: "mt-1.5 flex flex-wrap gap-1",
|
|
307
|
-
children: [
|
|
308
|
-
t7,
|
|
309
|
-
t8,
|
|
310
|
-
t9,
|
|
311
|
-
t12
|
|
312
|
-
]
|
|
255
|
+
children: [t6, t10]
|
|
313
256
|
});
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if ($[38] !== t13 || $[39] !== t6) {
|
|
322
|
-
t14 = /* @__PURE__ */ jsxs(AlertDescription, {
|
|
257
|
+
$[20] = t10;
|
|
258
|
+
$[21] = t6;
|
|
259
|
+
$[22] = t11;
|
|
260
|
+
} else t11 = $[22];
|
|
261
|
+
let t12;
|
|
262
|
+
if ($[23] !== t11 || $[24] !== t5) {
|
|
263
|
+
t12 = /* @__PURE__ */ jsxs(AlertDescription, {
|
|
323
264
|
className: "text-xs",
|
|
324
|
-
children: [
|
|
265
|
+
children: [t5, t11]
|
|
325
266
|
});
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
} else
|
|
330
|
-
let
|
|
331
|
-
if ($[
|
|
332
|
-
|
|
267
|
+
$[23] = t11;
|
|
268
|
+
$[24] = t5;
|
|
269
|
+
$[25] = t12;
|
|
270
|
+
} else t12 = $[25];
|
|
271
|
+
let t13;
|
|
272
|
+
if ($[26] !== t12 || $[27] !== t4) {
|
|
273
|
+
t13 = /* @__PURE__ */ jsxs(Alert, {
|
|
333
274
|
"data-content-finding": true,
|
|
334
275
|
variant: "warning",
|
|
335
276
|
className: "px-3 py-2",
|
|
336
277
|
children: [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
278
|
+
t2,
|
|
279
|
+
t4,
|
|
280
|
+
t12
|
|
340
281
|
]
|
|
341
282
|
});
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
} else
|
|
346
|
-
return
|
|
347
|
-
}
|
|
348
|
-
function _temp4(error_0) {
|
|
349
|
-
return toast.error(error_0.message || "Could not dismiss it");
|
|
350
|
-
}
|
|
351
|
-
function _temp3(error) {
|
|
352
|
-
return toast.error(error.message || "Could not apply the fix");
|
|
353
|
-
}
|
|
354
|
-
function _temp2(t0) {
|
|
355
|
-
const { applied } = t0;
|
|
356
|
-
if (!applied) toast.info("The link changed since it was checked, so it's being checked again.");
|
|
283
|
+
$[26] = t12;
|
|
284
|
+
$[27] = t4;
|
|
285
|
+
$[28] = t13;
|
|
286
|
+
} else t13 = $[28];
|
|
287
|
+
return t13;
|
|
357
288
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
const $ = c(9);
|
|
361
|
-
const { finding, patrolDraft } = t0;
|
|
362
|
-
const showInCanvas = useShowInCanvas();
|
|
363
|
-
const { place } = finding;
|
|
364
|
-
if (place?.kind !== "page") return null;
|
|
365
|
-
let t1;
|
|
366
|
-
if ($[0] !== finding.field || $[1] !== finding.fieldKind || $[2] !== finding.locale || $[3] !== patrolDraft.id || $[4] !== place.blockId || $[5] !== place.itemId || $[6] !== place.pageId || $[7] !== showInCanvas) {
|
|
367
|
-
t1 = /* @__PURE__ */ jsx(Button, {
|
|
368
|
-
variant: "outline",
|
|
369
|
-
size: "xs",
|
|
370
|
-
onClick: () => void showInCanvas({
|
|
371
|
-
pageId: place.pageId,
|
|
372
|
-
locale: finding.locale,
|
|
373
|
-
blockId: place.blockId,
|
|
374
|
-
itemId: place.itemId,
|
|
375
|
-
field: {
|
|
376
|
-
name: finding.field,
|
|
377
|
-
kind: finding.fieldKind
|
|
378
|
-
},
|
|
379
|
-
draft: patrolDraft.id
|
|
380
|
-
}),
|
|
381
|
-
children: "Open the Patrol Draft"
|
|
382
|
-
});
|
|
383
|
-
$[0] = finding.field;
|
|
384
|
-
$[1] = finding.fieldKind;
|
|
385
|
-
$[2] = finding.locale;
|
|
386
|
-
$[3] = patrolDraft.id;
|
|
387
|
-
$[4] = place.blockId;
|
|
388
|
-
$[5] = place.itemId;
|
|
389
|
-
$[6] = place.pageId;
|
|
390
|
-
$[7] = showInCanvas;
|
|
391
|
-
$[8] = t1;
|
|
392
|
-
} else t1 = $[8];
|
|
393
|
-
return t1;
|
|
289
|
+
function _temp2(error) {
|
|
290
|
+
return toast.error(error.message || "Could not dismiss it");
|
|
394
291
|
}
|
|
395
292
|
|
|
396
293
|
//#endregion
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { draftMutations } from "../../../lib/queries.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useMutation } from "@tanstack/react-query";
|
|
5
|
+
import { toast } from "@camox/ui/toaster";
|
|
6
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
7
|
+
import { Spinner } from "@camox/ui/spinner";
|
|
8
|
+
|
|
9
|
+
//#region src/features/studio/components/DeleteDraftDialog.tsx
|
|
10
|
+
/** Asks before deleting the draft the studio is in, then deletes it. */
|
|
11
|
+
function DeleteDraftDialog(t0) {
|
|
12
|
+
const $ = c(26);
|
|
13
|
+
const { projectId, open, onOpenChange, onDeleted } = t0;
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
16
|
+
t1 = draftMutations.delete();
|
|
17
|
+
$[0] = t1;
|
|
18
|
+
} else t1 = $[0];
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[1] !== onDeleted || $[2] !== onOpenChange) {
|
|
21
|
+
t2 = {
|
|
22
|
+
...t1,
|
|
23
|
+
onSuccess: (t3) => {
|
|
24
|
+
const { ended } = t3;
|
|
25
|
+
onOpenChange(false);
|
|
26
|
+
onDeleted(ended);
|
|
27
|
+
},
|
|
28
|
+
onError: _temp
|
|
29
|
+
};
|
|
30
|
+
$[1] = onDeleted;
|
|
31
|
+
$[2] = onOpenChange;
|
|
32
|
+
$[3] = t2;
|
|
33
|
+
} else t2 = $[3];
|
|
34
|
+
const deleteDraft = useMutation(t2);
|
|
35
|
+
let t3;
|
|
36
|
+
if ($[4] !== deleteDraft.isPending || $[5] !== onOpenChange) {
|
|
37
|
+
t3 = (next) => {
|
|
38
|
+
if (!deleteDraft.isPending) onOpenChange(next);
|
|
39
|
+
};
|
|
40
|
+
$[4] = deleteDraft.isPending;
|
|
41
|
+
$[5] = onOpenChange;
|
|
42
|
+
$[6] = t3;
|
|
43
|
+
} else t3 = $[6];
|
|
44
|
+
let t4;
|
|
45
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
46
|
+
t4 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: "Delete this draft?" }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: "Every change in this draft is deleted for everyone. Live stays as it is. This can't be undone." })] });
|
|
47
|
+
$[7] = t4;
|
|
48
|
+
} else t4 = $[7];
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[8] !== deleteDraft.isPending) {
|
|
51
|
+
t5 = /* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
52
|
+
variant: "outline",
|
|
53
|
+
size: "default",
|
|
54
|
+
disabled: deleteDraft.isPending,
|
|
55
|
+
children: "Cancel"
|
|
56
|
+
});
|
|
57
|
+
$[8] = deleteDraft.isPending;
|
|
58
|
+
$[9] = t5;
|
|
59
|
+
} else t5 = $[9];
|
|
60
|
+
let t6;
|
|
61
|
+
if ($[10] !== deleteDraft || $[11] !== projectId) {
|
|
62
|
+
t6 = () => deleteDraft.mutate({ projectId });
|
|
63
|
+
$[10] = deleteDraft;
|
|
64
|
+
$[11] = projectId;
|
|
65
|
+
$[12] = t6;
|
|
66
|
+
} else t6 = $[12];
|
|
67
|
+
let t7;
|
|
68
|
+
if ($[13] !== deleteDraft.isPending) {
|
|
69
|
+
t7 = deleteDraft.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
70
|
+
$[13] = deleteDraft.isPending;
|
|
71
|
+
$[14] = t7;
|
|
72
|
+
} else t7 = $[14];
|
|
73
|
+
let t8;
|
|
74
|
+
if ($[15] !== deleteDraft.isPending || $[16] !== t6 || $[17] !== t7) {
|
|
75
|
+
t8 = /* @__PURE__ */ jsxs(AlertDialogAction, {
|
|
76
|
+
variant: "destructive",
|
|
77
|
+
disabled: deleteDraft.isPending,
|
|
78
|
+
onClick: t6,
|
|
79
|
+
children: [t7, "Delete draft"]
|
|
80
|
+
});
|
|
81
|
+
$[15] = deleteDraft.isPending;
|
|
82
|
+
$[16] = t6;
|
|
83
|
+
$[17] = t7;
|
|
84
|
+
$[18] = t8;
|
|
85
|
+
} else t8 = $[18];
|
|
86
|
+
let t9;
|
|
87
|
+
if ($[19] !== t5 || $[20] !== t8) {
|
|
88
|
+
t9 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t4, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t5, t8] })] });
|
|
89
|
+
$[19] = t5;
|
|
90
|
+
$[20] = t8;
|
|
91
|
+
$[21] = t9;
|
|
92
|
+
} else t9 = $[21];
|
|
93
|
+
let t10;
|
|
94
|
+
if ($[22] !== open || $[23] !== t3 || $[24] !== t9) {
|
|
95
|
+
t10 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
96
|
+
open,
|
|
97
|
+
onOpenChange: t3,
|
|
98
|
+
children: t9
|
|
99
|
+
});
|
|
100
|
+
$[22] = open;
|
|
101
|
+
$[23] = t3;
|
|
102
|
+
$[24] = t9;
|
|
103
|
+
$[25] = t10;
|
|
104
|
+
} else t10 = $[25];
|
|
105
|
+
return t10;
|
|
106
|
+
}
|
|
107
|
+
function _temp(error) {
|
|
108
|
+
return toast.error(error.message || "Could not delete the draft");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
export { DeleteDraftDialog };
|