camox 0.68.0 → 0.71.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/createBlock.js +14 -7
- package/dist/core/hooks/useArtifactHost.js +56 -46
- package/dist/core/lib/artifact.d.ts +4 -0
- package/dist/core/lib/artifactHost.js +40 -0
- package/dist/core/lib/artifactRuntime.js +20 -1
- package/dist/features/canvas/canvasFrameDocument.js +25 -2
- package/dist/features/canvas/useCanvasFrame.js +6 -2
- package/dist/features/preview/components/previewStyles.js +11 -2
- package/dist/features/provider/AuthenticatedCamoxProvider.js +33 -28
- package/dist/features/renderer/RendererApp.js +202 -154
- package/dist/features/renderer/RendererFrames.js +87 -55
- package/dist/features/renderer/definitionAnswers.js +1 -0
- package/dist/features/renderer/rendererHost.js +4 -0
- package/dist/features/renderer/studioConnection.js +9 -1
- package/dist/features/runtime/pageApp.js +7 -3
- package/dist/features/runtime/pageNavigation.js +93 -17
- package/dist/features/runtime/rendererClient.js +13 -6
- package/dist/features/studio/agentRunToast.js +71 -0
- package/dist/features/studio/components/ChatWidget.js +2 -0
- package/dist/features/studio/components/DraftBar.js +2 -3
- package/dist/features/studio/components/DraftsControl.js +181 -198
- package/dist/features/studio/components/LocalePicker.js +22 -4
- package/dist/features/studio/components/ReviewDraftSheet.js +345 -568
- package/dist/features/studio/draftLabel.js +1 -1
- package/dist/features/studio/studioStore.js +5 -17
- package/dist/features/studio/viewSwitch.js +62 -0
- package/dist/lib/auth.js +5 -1
- package/dist/lib/draft-scope.js +28 -15
- package/dist/lib/studio-reads.js +46 -13
- package/dist/lib/view-switch.js +64 -0
- package/dist/package.js +1 -1
- package/dist/studio.css +1 -1
- package/package.json +6 -4
- package/skills/camox/references/artifacts.md +85 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { reads, useReadQuery, useStudioCache } from "../../../lib/studio-reads.js";
|
|
1
|
+
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
3
2
|
import { cn } from "../../../lib/utils.js";
|
|
4
|
-
import { getDraftReadClient } from "../../../lib/api-client.js";
|
|
5
3
|
import { draftMutations, patrolMutations } from "../../../lib/queries.js";
|
|
6
4
|
import { previewStore } from "../../preview/previewStore.js";
|
|
7
5
|
import { studioStore } from "../studioStore.js";
|
|
@@ -9,6 +7,7 @@ import { localeLabel } from "../localeOptions.js";
|
|
|
9
7
|
import { askAgentMessage, findingSentence, fixLabel } from "../findingSentence.js";
|
|
10
8
|
import { useShowInCanvas } from "../showInCanvas.js";
|
|
11
9
|
import { draftLabel, plural, timeAgo } from "../draftLabel.js";
|
|
10
|
+
import { useLeaveDraft } from "../viewSwitch.js";
|
|
12
11
|
import { c } from "react/compiler-runtime";
|
|
13
12
|
import * as React from "react";
|
|
14
13
|
import { CHECKS_RUNNING_ERROR, CONFLICTS_CHANGED_ERROR, FINDINGS_OPEN_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR } from "@camox/api-contract/drafts";
|
|
@@ -954,7 +953,7 @@ function _temp5(locale) {
|
|
|
954
953
|
* draft.
|
|
955
954
|
*/
|
|
956
955
|
function DraftOverview(t0) {
|
|
957
|
-
const $ = c(
|
|
956
|
+
const $ = c(35);
|
|
958
957
|
const { projectId, preview } = t0;
|
|
959
958
|
const { overview, changes } = preview;
|
|
960
959
|
let t1;
|
|
@@ -967,34 +966,36 @@ function DraftOverview(t0) {
|
|
|
967
966
|
} else t1 = $[0];
|
|
968
967
|
const retry = useMutation(t1);
|
|
969
968
|
if (changes.length === 0) {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
969
|
+
const t2 = preview.code ? "This draft changes the website's code." : "This draft has no changes.";
|
|
970
|
+
let t3;
|
|
971
|
+
if ($[1] !== t2) {
|
|
972
|
+
t3 = /* @__PURE__ */ jsx("p", {
|
|
973
973
|
className: "text-muted-foreground text-sm",
|
|
974
|
-
children:
|
|
974
|
+
children: t2
|
|
975
975
|
});
|
|
976
976
|
$[1] = t2;
|
|
977
|
-
|
|
978
|
-
|
|
977
|
+
$[2] = t3;
|
|
978
|
+
} else t3 = $[2];
|
|
979
|
+
return t3;
|
|
979
980
|
}
|
|
980
981
|
if (overview.status === "ready") {
|
|
981
982
|
let t2;
|
|
982
|
-
if ($[
|
|
983
|
+
if ($[3] !== overview.bullets) {
|
|
983
984
|
t2 = overview.bullets.map(_temp11);
|
|
984
|
-
$[
|
|
985
|
-
$[
|
|
986
|
-
} else t2 = $[
|
|
985
|
+
$[3] = overview.bullets;
|
|
986
|
+
$[4] = t2;
|
|
987
|
+
} else t2 = $[4];
|
|
987
988
|
let t3;
|
|
988
|
-
if ($[
|
|
989
|
+
if ($[5] !== t2) {
|
|
989
990
|
t3 = /* @__PURE__ */ jsx("ul", {
|
|
990
991
|
className: "text-foreground/85 flex list-disc flex-col gap-1.5 pl-5 leading-relaxed",
|
|
991
992
|
children: t2
|
|
992
993
|
});
|
|
993
|
-
$[
|
|
994
|
-
$[
|
|
995
|
-
} else t3 = $[
|
|
994
|
+
$[5] = t2;
|
|
995
|
+
$[6] = t3;
|
|
996
|
+
} else t3 = $[6];
|
|
996
997
|
let t4;
|
|
997
|
-
if ($[
|
|
998
|
+
if ($[7] !== overview.stale) {
|
|
998
999
|
t4 = overview.stale && /* @__PURE__ */ jsxs("p", {
|
|
999
1000
|
className: "text-muted-foreground flex items-center gap-1.5 text-xs",
|
|
1000
1001
|
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
@@ -1002,53 +1003,53 @@ function DraftOverview(t0) {
|
|
|
1002
1003
|
className: "size-3"
|
|
1003
1004
|
}), "Updating…"]
|
|
1004
1005
|
});
|
|
1005
|
-
$[
|
|
1006
|
-
$[
|
|
1007
|
-
} else t4 = $[
|
|
1006
|
+
$[7] = overview.stale;
|
|
1007
|
+
$[8] = t4;
|
|
1008
|
+
} else t4 = $[8];
|
|
1008
1009
|
let t5;
|
|
1009
|
-
if ($[
|
|
1010
|
+
if ($[9] !== t3 || $[10] !== t4) {
|
|
1010
1011
|
t5 = /* @__PURE__ */ jsxs("div", {
|
|
1011
1012
|
"data-overview": true,
|
|
1012
1013
|
className: "flex flex-col gap-2",
|
|
1013
1014
|
children: [t3, t4]
|
|
1014
1015
|
});
|
|
1015
|
-
$[
|
|
1016
|
-
$[
|
|
1017
|
-
$[
|
|
1018
|
-
} else t5 = $[
|
|
1016
|
+
$[9] = t3;
|
|
1017
|
+
$[10] = t4;
|
|
1018
|
+
$[11] = t5;
|
|
1019
|
+
} else t5 = $[11];
|
|
1019
1020
|
return t5;
|
|
1020
1021
|
}
|
|
1021
1022
|
if (overview.status === "failed") {
|
|
1022
1023
|
let t2;
|
|
1023
|
-
if ($[
|
|
1024
|
+
if ($[12] !== changes) {
|
|
1024
1025
|
t2 = new Set(changes.map(_temp12));
|
|
1025
|
-
$[
|
|
1026
|
-
$[
|
|
1027
|
-
} else t2 = $[
|
|
1026
|
+
$[12] = changes;
|
|
1027
|
+
$[13] = t2;
|
|
1028
|
+
} else t2 = $[13];
|
|
1028
1029
|
const places = t2.size;
|
|
1029
1030
|
let t3;
|
|
1030
|
-
if ($[
|
|
1031
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1031
1032
|
t3 = /* @__PURE__ */ jsx("p", {
|
|
1032
1033
|
className: "text-sm font-medium",
|
|
1033
1034
|
children: "Couldn't summarize this draft"
|
|
1034
1035
|
});
|
|
1035
|
-
$[
|
|
1036
|
-
} else t3 = $[
|
|
1036
|
+
$[14] = t3;
|
|
1037
|
+
} else t3 = $[14];
|
|
1037
1038
|
let t4;
|
|
1038
|
-
if ($[
|
|
1039
|
+
if ($[15] !== projectId || $[16] !== retry) {
|
|
1039
1040
|
t4 = () => retry.mutate({ projectId });
|
|
1040
|
-
$[
|
|
1041
|
-
$[
|
|
1042
|
-
$[
|
|
1043
|
-
} else t4 = $[
|
|
1041
|
+
$[15] = projectId;
|
|
1042
|
+
$[16] = retry;
|
|
1043
|
+
$[17] = t4;
|
|
1044
|
+
} else t4 = $[17];
|
|
1044
1045
|
let t5;
|
|
1045
|
-
if ($[
|
|
1046
|
+
if ($[18] !== retry.isPending) {
|
|
1046
1047
|
t5 = retry.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1047
|
-
$[
|
|
1048
|
-
$[
|
|
1049
|
-
} else t5 = $[
|
|
1048
|
+
$[18] = retry.isPending;
|
|
1049
|
+
$[19] = t5;
|
|
1050
|
+
} else t5 = $[19];
|
|
1050
1051
|
let t6;
|
|
1051
|
-
if ($[
|
|
1052
|
+
if ($[20] !== retry.isPending || $[21] !== t4 || $[22] !== t5) {
|
|
1052
1053
|
t6 = /* @__PURE__ */ jsxs("div", {
|
|
1053
1054
|
className: "flex items-center gap-3",
|
|
1054
1055
|
children: [t3, /* @__PURE__ */ jsxs(Button, {
|
|
@@ -1060,25 +1061,25 @@ function DraftOverview(t0) {
|
|
|
1060
1061
|
children: [t5, "Retry"]
|
|
1061
1062
|
})]
|
|
1062
1063
|
});
|
|
1063
|
-
$[
|
|
1064
|
-
$[
|
|
1065
|
-
$[
|
|
1066
|
-
$[
|
|
1067
|
-
} else t6 = $[
|
|
1064
|
+
$[20] = retry.isPending;
|
|
1065
|
+
$[21] = t4;
|
|
1066
|
+
$[22] = t5;
|
|
1067
|
+
$[23] = t6;
|
|
1068
|
+
} else t6 = $[23];
|
|
1068
1069
|
let t7;
|
|
1069
|
-
if ($[
|
|
1070
|
+
if ($[24] !== changes.length) {
|
|
1070
1071
|
t7 = plural(changes.length, "change");
|
|
1071
|
-
$[
|
|
1072
|
-
$[
|
|
1073
|
-
} else t7 = $[
|
|
1072
|
+
$[24] = changes.length;
|
|
1073
|
+
$[25] = t7;
|
|
1074
|
+
} else t7 = $[25];
|
|
1074
1075
|
let t8;
|
|
1075
|
-
if ($[
|
|
1076
|
+
if ($[26] !== places) {
|
|
1076
1077
|
t8 = plural(places, "place");
|
|
1077
|
-
$[
|
|
1078
|
-
$[
|
|
1079
|
-
} else t8 = $[
|
|
1078
|
+
$[26] = places;
|
|
1079
|
+
$[27] = t8;
|
|
1080
|
+
} else t8 = $[27];
|
|
1080
1081
|
let t9;
|
|
1081
|
-
if ($[
|
|
1082
|
+
if ($[28] !== t7 || $[29] !== t8) {
|
|
1082
1083
|
t9 = /* @__PURE__ */ jsxs("p", {
|
|
1083
1084
|
className: "text-muted-foreground text-sm",
|
|
1084
1085
|
children: [
|
|
@@ -1087,26 +1088,26 @@ function DraftOverview(t0) {
|
|
|
1087
1088
|
t8
|
|
1088
1089
|
]
|
|
1089
1090
|
});
|
|
1090
|
-
$[
|
|
1091
|
-
$[
|
|
1092
|
-
$[
|
|
1093
|
-
} else t9 = $[
|
|
1091
|
+
$[28] = t7;
|
|
1092
|
+
$[29] = t8;
|
|
1093
|
+
$[30] = t9;
|
|
1094
|
+
} else t9 = $[30];
|
|
1094
1095
|
let t10;
|
|
1095
|
-
if ($[
|
|
1096
|
+
if ($[31] !== t6 || $[32] !== t9) {
|
|
1096
1097
|
t10 = /* @__PURE__ */ jsxs("div", {
|
|
1097
1098
|
"data-overview": true,
|
|
1098
1099
|
className: "flex flex-col gap-2",
|
|
1099
1100
|
children: [t6, t9]
|
|
1100
1101
|
});
|
|
1101
|
-
$[
|
|
1102
|
-
$[
|
|
1103
|
-
$[
|
|
1104
|
-
} else t10 = $[
|
|
1102
|
+
$[31] = t6;
|
|
1103
|
+
$[32] = t9;
|
|
1104
|
+
$[33] = t10;
|
|
1105
|
+
} else t10 = $[33];
|
|
1105
1106
|
return t10;
|
|
1106
1107
|
}
|
|
1107
1108
|
if (overview.status === "none") return null;
|
|
1108
1109
|
let t2;
|
|
1109
|
-
if ($[
|
|
1110
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1110
1111
|
t2 = /* @__PURE__ */ jsxs("div", {
|
|
1111
1112
|
"data-overview": true,
|
|
1112
1113
|
className: "flex flex-col gap-2",
|
|
@@ -1120,8 +1121,8 @@ function DraftOverview(t0) {
|
|
|
1120
1121
|
})
|
|
1121
1122
|
]
|
|
1122
1123
|
});
|
|
1123
|
-
$[
|
|
1124
|
-
} else t2 = $[
|
|
1124
|
+
$[34] = t2;
|
|
1125
|
+
} else t2 = $[34];
|
|
1125
1126
|
return t2;
|
|
1126
1127
|
}
|
|
1127
1128
|
function _temp12(change) {
|
|
@@ -1133,290 +1134,110 @@ function _temp11(bullet, index) {
|
|
|
1133
1134
|
function _temp10(error) {
|
|
1134
1135
|
return toast.error(error.message || "Could not summarize the draft");
|
|
1135
1136
|
}
|
|
1136
|
-
/** Switches the studio to Live once its draft ended here, replacing the draft's URL entry. */
|
|
1137
|
-
function useLeaveDraft() {
|
|
1138
|
-
const $ = c(2);
|
|
1139
|
-
const draftScope = useDraftScope();
|
|
1140
|
-
let t0;
|
|
1141
|
-
if ($[0] !== draftScope) {
|
|
1142
|
-
t0 = (ended, t1) => {
|
|
1143
|
-
const { discarded: t2 } = t1 === void 0 ? {} : t1;
|
|
1144
|
-
const discarded = t2 === void 0 ? false : t2;
|
|
1145
|
-
draftScope.leave(ended);
|
|
1146
|
-
if (!ended) return;
|
|
1147
|
-
const what = discarded ? "Changes discarded" : `Draft ${ended.outcome}`;
|
|
1148
|
-
toast.success(`${what}. You're now viewing Live.`);
|
|
1149
|
-
};
|
|
1150
|
-
$[0] = draftScope;
|
|
1151
|
-
$[1] = t0;
|
|
1152
|
-
} else t0 = $[1];
|
|
1153
|
-
return t0;
|
|
1154
|
-
}
|
|
1155
|
-
/**
|
|
1156
|
-
* Renames a regular draft, whichever draft the studio views: the request names the draft it
|
|
1157
|
-
* renames. A blank name clears it, so the draft shows its computed label again.
|
|
1158
|
-
*/
|
|
1159
|
-
function useRenameDraft(projectId) {
|
|
1160
|
-
const $ = c(8);
|
|
1161
|
-
const studioCache = useStudioCache();
|
|
1162
|
-
let t0;
|
|
1163
|
-
if ($[0] !== projectId) {
|
|
1164
|
-
t0 = (t1) => {
|
|
1165
|
-
const { draftId, name } = t1;
|
|
1166
|
-
return getDraftReadClient(draftId).drafts.rename({
|
|
1167
|
-
projectId,
|
|
1168
|
-
name
|
|
1169
|
-
});
|
|
1170
|
-
};
|
|
1171
|
-
$[0] = projectId;
|
|
1172
|
-
$[1] = t0;
|
|
1173
|
-
} else t0 = $[1];
|
|
1174
|
-
let t1;
|
|
1175
|
-
if ($[2] !== projectId || $[3] !== studioCache) {
|
|
1176
|
-
t1 = (renamed) => {
|
|
1177
|
-
studioCache.set(reads.draft({
|
|
1178
|
-
projectId,
|
|
1179
|
-
draftId: renamed.id
|
|
1180
|
-
}), renamed);
|
|
1181
|
-
studioCache.invalidate(reads.draftList({ projectId }));
|
|
1182
|
-
};
|
|
1183
|
-
$[2] = projectId;
|
|
1184
|
-
$[3] = studioCache;
|
|
1185
|
-
$[4] = t1;
|
|
1186
|
-
} else t1 = $[4];
|
|
1187
|
-
let t2;
|
|
1188
|
-
if ($[5] !== t0 || $[6] !== t1) {
|
|
1189
|
-
t2 = {
|
|
1190
|
-
mutationFn: t0,
|
|
1191
|
-
onSuccess: t1,
|
|
1192
|
-
onError: _temp13
|
|
1193
|
-
};
|
|
1194
|
-
$[5] = t0;
|
|
1195
|
-
$[6] = t1;
|
|
1196
|
-
$[7] = t2;
|
|
1197
|
-
} else t2 = $[7];
|
|
1198
|
-
return useMutation(t2);
|
|
1199
|
-
}
|
|
1200
|
-
function _temp13(error) {
|
|
1201
|
-
return toast.error(error.message || "Could not rename the draft");
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* The draft's name in the review's header, renamed in place by any member (#203), like a page
|
|
1205
|
-
* nickname in the Canvas Inspector: a title whose border shows on hover or focus, without
|
|
1206
|
-
* moving the text. An unnamed draft shows its computed label until focused. Saves on Enter or
|
|
1207
|
-
* blur, and a blank name clears it; Escape puts the name back.
|
|
1208
|
-
*/
|
|
1209
|
-
function DraftNameInput(t0) {
|
|
1210
|
-
const $ = c(23);
|
|
1211
|
-
const { projectId, draft, ref, className } = t0;
|
|
1212
|
-
const rename = useRenameDraft(projectId);
|
|
1213
|
-
const name = draft.name ?? "";
|
|
1214
|
-
let t1;
|
|
1215
|
-
if ($[0] !== draft.id || $[1] !== draft.name || $[2] !== name || $[3] !== rename) {
|
|
1216
|
-
t1 = (input) => {
|
|
1217
|
-
if ((input.value.trim() || null) === draft.name) {
|
|
1218
|
-
input.value = name;
|
|
1219
|
-
return;
|
|
1220
|
-
}
|
|
1221
|
-
rename.mutate({
|
|
1222
|
-
draftId: draft.id,
|
|
1223
|
-
name: input.value
|
|
1224
|
-
}, { onError: () => void (input.value = name) });
|
|
1225
|
-
};
|
|
1226
|
-
$[0] = draft.id;
|
|
1227
|
-
$[1] = draft.name;
|
|
1228
|
-
$[2] = name;
|
|
1229
|
-
$[3] = rename;
|
|
1230
|
-
$[4] = t1;
|
|
1231
|
-
} else t1 = $[4];
|
|
1232
|
-
const save = t1;
|
|
1233
|
-
let t2;
|
|
1234
|
-
if ($[5] !== draft) {
|
|
1235
|
-
t2 = draftLabel({
|
|
1236
|
-
...draft,
|
|
1237
|
-
name: null
|
|
1238
|
-
});
|
|
1239
|
-
$[5] = draft;
|
|
1240
|
-
$[6] = t2;
|
|
1241
|
-
} else t2 = $[6];
|
|
1242
|
-
let t3;
|
|
1243
|
-
if ($[7] !== draft) {
|
|
1244
|
-
t3 = draftLabel(draft);
|
|
1245
|
-
$[7] = draft;
|
|
1246
|
-
$[8] = t3;
|
|
1247
|
-
} else t3 = $[8];
|
|
1248
|
-
let t4;
|
|
1249
|
-
if ($[9] !== className) {
|
|
1250
|
-
t4 = cn("hover:border-input focus-visible:border-ring focus-visible:ring-ring/50 placeholder:text-foreground focus:placeholder:text-muted-foreground -mx-1.5 h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-transparent px-1.5 text-base font-medium transition-[color,box-shadow,border-color] outline-none hover:shadow-xs focus-visible:ring-3", className);
|
|
1251
|
-
$[9] = className;
|
|
1252
|
-
$[10] = t4;
|
|
1253
|
-
} else t4 = $[10];
|
|
1254
|
-
let t5;
|
|
1255
|
-
if ($[11] !== save) {
|
|
1256
|
-
t5 = (event) => save(event.currentTarget);
|
|
1257
|
-
$[11] = save;
|
|
1258
|
-
$[12] = t5;
|
|
1259
|
-
} else t5 = $[12];
|
|
1260
|
-
let t6;
|
|
1261
|
-
if ($[13] !== name) {
|
|
1262
|
-
t6 = (event_0) => {
|
|
1263
|
-
if (event_0.key === "Enter") {
|
|
1264
|
-
event_0.preventDefault();
|
|
1265
|
-
event_0.currentTarget.blur();
|
|
1266
|
-
}
|
|
1267
|
-
if (event_0.key !== "Escape") return;
|
|
1268
|
-
event_0.stopPropagation();
|
|
1269
|
-
event_0.currentTarget.value = name;
|
|
1270
|
-
event_0.currentTarget.blur();
|
|
1271
|
-
};
|
|
1272
|
-
$[13] = name;
|
|
1273
|
-
$[14] = t6;
|
|
1274
|
-
} else t6 = $[14];
|
|
1275
|
-
let t7;
|
|
1276
|
-
if ($[15] !== name || $[16] !== ref || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
|
|
1277
|
-
t7 = /* @__PURE__ */ jsx("input", {
|
|
1278
|
-
ref,
|
|
1279
|
-
"aria-label": "Draft name",
|
|
1280
|
-
defaultValue: name,
|
|
1281
|
-
placeholder: t2,
|
|
1282
|
-
title: t3,
|
|
1283
|
-
maxLength: 200,
|
|
1284
|
-
className: t4,
|
|
1285
|
-
onBlur: t5,
|
|
1286
|
-
onKeyDown: t6
|
|
1287
|
-
}, name);
|
|
1288
|
-
$[15] = name;
|
|
1289
|
-
$[16] = ref;
|
|
1290
|
-
$[17] = t2;
|
|
1291
|
-
$[18] = t3;
|
|
1292
|
-
$[19] = t4;
|
|
1293
|
-
$[20] = t5;
|
|
1294
|
-
$[21] = t6;
|
|
1295
|
-
$[22] = t7;
|
|
1296
|
-
} else t7 = $[22];
|
|
1297
|
-
return t7;
|
|
1298
|
-
}
|
|
1299
1137
|
/**
|
|
1300
1138
|
* Reviews a draft before publishing it whole, or deletes it (ADR 0009). Publishing sends back
|
|
1301
1139
|
* the token of the preview shown; when Live changed since, nothing is published and the new
|
|
1302
1140
|
* preview is shown. Once the draft ends, the studio switches to Live.
|
|
1303
1141
|
*/
|
|
1304
1142
|
function ReviewDraftSheet(t0) {
|
|
1305
|
-
const $ = c(
|
|
1306
|
-
const { projectId, draftId, open,
|
|
1307
|
-
const startRenaming = t1 === void 0 ? false : t1;
|
|
1143
|
+
const $ = c(74);
|
|
1144
|
+
const { projectId, draftId, open, onOpenChange } = t0;
|
|
1308
1145
|
const [confirmingDelete, setConfirmingDelete] = React.useState(false);
|
|
1309
|
-
let
|
|
1146
|
+
let t1;
|
|
1310
1147
|
if ($[0] !== draftId || $[1] !== projectId) {
|
|
1311
|
-
|
|
1148
|
+
t1 = reads.publishPreview({
|
|
1312
1149
|
projectId,
|
|
1313
1150
|
draftId
|
|
1314
1151
|
});
|
|
1315
1152
|
$[0] = draftId;
|
|
1316
1153
|
$[1] = projectId;
|
|
1317
|
-
$[2] =
|
|
1318
|
-
} else
|
|
1319
|
-
let
|
|
1154
|
+
$[2] = t1;
|
|
1155
|
+
} else t1 = $[2];
|
|
1156
|
+
let t2;
|
|
1320
1157
|
if ($[3] !== open) {
|
|
1321
|
-
|
|
1158
|
+
t2 = { enabled: open };
|
|
1322
1159
|
$[3] = open;
|
|
1323
|
-
$[4] =
|
|
1324
|
-
} else
|
|
1325
|
-
const preview = useReadQuery(
|
|
1326
|
-
let
|
|
1160
|
+
$[4] = t2;
|
|
1161
|
+
} else t2 = $[4];
|
|
1162
|
+
const preview = useReadQuery(t1, t2);
|
|
1163
|
+
let t3;
|
|
1327
1164
|
if ($[5] !== draftId || $[6] !== projectId) {
|
|
1328
|
-
|
|
1165
|
+
t3 = reads.draft({
|
|
1329
1166
|
projectId,
|
|
1330
1167
|
draftId
|
|
1331
1168
|
});
|
|
1332
1169
|
$[5] = draftId;
|
|
1333
1170
|
$[6] = projectId;
|
|
1334
|
-
$[7] =
|
|
1335
|
-
} else
|
|
1336
|
-
let
|
|
1171
|
+
$[7] = t3;
|
|
1172
|
+
} else t3 = $[7];
|
|
1173
|
+
let t4;
|
|
1337
1174
|
if ($[8] !== open) {
|
|
1338
|
-
|
|
1175
|
+
t4 = { enabled: open };
|
|
1339
1176
|
$[8] = open;
|
|
1340
|
-
$[9] =
|
|
1341
|
-
} else
|
|
1342
|
-
const draft = useReadQuery(
|
|
1343
|
-
let
|
|
1177
|
+
$[9] = t4;
|
|
1178
|
+
} else t4 = $[9];
|
|
1179
|
+
const draft = useReadQuery(t3, t4);
|
|
1180
|
+
let t5;
|
|
1344
1181
|
if ($[10] !== projectId) {
|
|
1345
|
-
|
|
1182
|
+
t5 = reads.localeList({ projectId });
|
|
1346
1183
|
$[10] = projectId;
|
|
1347
|
-
$[11] =
|
|
1348
|
-
} else
|
|
1349
|
-
let
|
|
1184
|
+
$[11] = t5;
|
|
1185
|
+
} else t5 = $[11];
|
|
1186
|
+
let t6;
|
|
1350
1187
|
if ($[12] !== open) {
|
|
1351
|
-
|
|
1188
|
+
t6 = { enabled: open };
|
|
1352
1189
|
$[12] = open;
|
|
1353
|
-
$[13] =
|
|
1354
|
-
} else
|
|
1355
|
-
const locales = useReadQuery(
|
|
1190
|
+
$[13] = t6;
|
|
1191
|
+
} else t6 = $[13];
|
|
1192
|
+
const locales = useReadQuery(t5, t6);
|
|
1356
1193
|
const leaveDraft = useLeaveDraft();
|
|
1357
1194
|
const showInCanvas = useShowInCanvas();
|
|
1358
1195
|
const popup = React.useRef(null);
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
}
|
|
1367
|
-
return popup.current;
|
|
1368
|
-
};
|
|
1369
|
-
$[14] = startRenaming;
|
|
1370
|
-
$[15] = t8;
|
|
1371
|
-
} else t8 = $[15];
|
|
1372
|
-
const initialFocus = t8;
|
|
1373
|
-
let t9;
|
|
1374
|
-
if ($[16] !== draft.data?.translatingLocales) {
|
|
1375
|
-
t9 = draft.data?.translatingLocales.join(",");
|
|
1376
|
-
$[16] = draft.data?.translatingLocales;
|
|
1377
|
-
$[17] = t9;
|
|
1378
|
-
} else t9 = $[17];
|
|
1379
|
-
const pending = t9;
|
|
1196
|
+
let t7;
|
|
1197
|
+
if ($[14] !== draft.data?.translatingLocales) {
|
|
1198
|
+
t7 = draft.data?.translatingLocales.join(",");
|
|
1199
|
+
$[14] = draft.data?.translatingLocales;
|
|
1200
|
+
$[15] = t7;
|
|
1201
|
+
} else t7 = $[15];
|
|
1202
|
+
const pending = t7;
|
|
1380
1203
|
const seenPending = React.useRef(pending);
|
|
1381
1204
|
const { refetch } = preview;
|
|
1382
|
-
let
|
|
1383
|
-
let
|
|
1384
|
-
if ($[
|
|
1385
|
-
|
|
1205
|
+
let t8;
|
|
1206
|
+
let t9;
|
|
1207
|
+
if ($[16] !== pending || $[17] !== refetch) {
|
|
1208
|
+
t8 = () => {
|
|
1386
1209
|
if (seenPending.current !== void 0 && seenPending.current !== pending) refetch();
|
|
1387
1210
|
seenPending.current = pending;
|
|
1388
1211
|
};
|
|
1389
|
-
|
|
1390
|
-
$[
|
|
1391
|
-
$[
|
|
1392
|
-
$[
|
|
1393
|
-
$[
|
|
1212
|
+
t9 = [pending, refetch];
|
|
1213
|
+
$[16] = pending;
|
|
1214
|
+
$[17] = refetch;
|
|
1215
|
+
$[18] = t8;
|
|
1216
|
+
$[19] = t9;
|
|
1394
1217
|
} else {
|
|
1395
|
-
|
|
1396
|
-
|
|
1218
|
+
t8 = $[18];
|
|
1219
|
+
t9 = $[19];
|
|
1397
1220
|
}
|
|
1398
|
-
React.useEffect(
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
t12 = (ended) => {
|
|
1221
|
+
React.useEffect(t8, t9);
|
|
1222
|
+
let t10;
|
|
1223
|
+
if ($[20] !== leaveDraft || $[21] !== onOpenChange) {
|
|
1224
|
+
t10 = (ended) => {
|
|
1403
1225
|
onOpenChange(false);
|
|
1404
|
-
leaveDraft(ended
|
|
1226
|
+
leaveDraft(ended);
|
|
1405
1227
|
};
|
|
1406
|
-
$[
|
|
1407
|
-
$[
|
|
1408
|
-
$[
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
t14 = (result) => {
|
|
1228
|
+
$[20] = leaveDraft;
|
|
1229
|
+
$[21] = onOpenChange;
|
|
1230
|
+
$[22] = t10;
|
|
1231
|
+
} else t10 = $[22];
|
|
1232
|
+
const leave = t10;
|
|
1233
|
+
let t11;
|
|
1234
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1235
|
+
t11 = draftMutations.publish();
|
|
1236
|
+
$[23] = t11;
|
|
1237
|
+
} else t11 = $[23];
|
|
1238
|
+
let t12;
|
|
1239
|
+
if ($[24] !== leave || $[25] !== preview) {
|
|
1240
|
+
t12 = (result) => {
|
|
1420
1241
|
if ("publishing" in result && result.publishing) {
|
|
1421
1242
|
preview.refetch();
|
|
1422
1243
|
return;
|
|
@@ -1426,13 +1247,13 @@ function ReviewDraftSheet(t0) {
|
|
|
1426
1247
|
toast.info("This draft has no changes, so there is nothing to publish.");
|
|
1427
1248
|
preview.refetch();
|
|
1428
1249
|
};
|
|
1429
|
-
$[
|
|
1430
|
-
$[
|
|
1431
|
-
$[
|
|
1432
|
-
} else
|
|
1433
|
-
let
|
|
1434
|
-
if ($[
|
|
1435
|
-
|
|
1250
|
+
$[24] = leave;
|
|
1251
|
+
$[25] = preview;
|
|
1252
|
+
$[26] = t12;
|
|
1253
|
+
} else t12 = $[26];
|
|
1254
|
+
let t13;
|
|
1255
|
+
if ($[27] !== preview) {
|
|
1256
|
+
t13 = (error) => {
|
|
1436
1257
|
if (error.code === CONFLICTS_CHANGED_ERROR) {
|
|
1437
1258
|
toast.error("Live changed since you opened this review. Check the new list.");
|
|
1438
1259
|
preview.refetch();
|
|
@@ -1457,37 +1278,35 @@ function ReviewDraftSheet(t0) {
|
|
|
1457
1278
|
toast.error(error.message || "Could not publish the draft");
|
|
1458
1279
|
preview.refetch();
|
|
1459
1280
|
};
|
|
1460
|
-
$[
|
|
1461
|
-
$[
|
|
1462
|
-
} else
|
|
1463
|
-
let
|
|
1464
|
-
if ($[
|
|
1465
|
-
|
|
1466
|
-
...
|
|
1467
|
-
onSuccess:
|
|
1468
|
-
onError:
|
|
1281
|
+
$[27] = preview;
|
|
1282
|
+
$[28] = t13;
|
|
1283
|
+
} else t13 = $[28];
|
|
1284
|
+
let t14;
|
|
1285
|
+
if ($[29] !== t12 || $[30] !== t13) {
|
|
1286
|
+
t14 = {
|
|
1287
|
+
...t11,
|
|
1288
|
+
onSuccess: t12,
|
|
1289
|
+
onError: t13
|
|
1469
1290
|
};
|
|
1470
|
-
$[
|
|
1471
|
-
$[
|
|
1472
|
-
$[
|
|
1473
|
-
} else
|
|
1474
|
-
const publish = useMutation(
|
|
1291
|
+
$[29] = t12;
|
|
1292
|
+
$[30] = t13;
|
|
1293
|
+
$[31] = t14;
|
|
1294
|
+
} else t14 = $[31];
|
|
1295
|
+
const publish = useMutation(t14);
|
|
1475
1296
|
const data = preview.data;
|
|
1476
1297
|
const headline = data?.overview.status === "ready" ? data.overview.headline : null;
|
|
1477
1298
|
const busy = publish.isPending;
|
|
1478
1299
|
const ready = !!data && data.blockers.length === 0 && data.translating.length === 0 && data.findings.length === 0 && data.checking.length === 0 && !data.code?.building && !data.code?.publishing && !busy && !preview.isFetching;
|
|
1479
|
-
let
|
|
1480
|
-
if ($[
|
|
1481
|
-
|
|
1300
|
+
let t15;
|
|
1301
|
+
if ($[32] !== draft.data || $[33] !== headline) {
|
|
1302
|
+
t15 = /* @__PURE__ */ jsx("div", {
|
|
1482
1303
|
className: "flex flex-col gap-1 border-b p-4 pr-12",
|
|
1483
|
-
children: headline ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */
|
|
1304
|
+
children: headline ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetDescription, {
|
|
1484
1305
|
className: "flex min-w-0 items-center gap-1",
|
|
1485
|
-
children:
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
className: "placeholder:text-muted-foreground text-muted-foreground field-sizing-content h-6 w-auto max-w-full text-sm font-normal"
|
|
1490
|
-
}), draft.data && /* @__PURE__ */ jsxs("span", {
|
|
1306
|
+
children: draft.data && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1307
|
+
className: "truncate",
|
|
1308
|
+
children: draftLabel(draft.data)
|
|
1309
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
1491
1310
|
className: "shrink-0",
|
|
1492
1311
|
children: [
|
|
1493
1312
|
"· ",
|
|
@@ -1495,30 +1314,22 @@ function ReviewDraftSheet(t0) {
|
|
|
1495
1314
|
", started ",
|
|
1496
1315
|
timeAgo(draft.data.createdAt)
|
|
1497
1316
|
]
|
|
1498
|
-
})]
|
|
1317
|
+
})] })
|
|
1499
1318
|
}), /* @__PURE__ */ jsx(SheetTitle, {
|
|
1500
1319
|
className: "text-lg leading-snug font-semibold",
|
|
1501
1320
|
children: headline
|
|
1502
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1503
|
-
className: "
|
|
1504
|
-
children: draftLabel(draft.data)
|
|
1505
|
-
}), /* @__PURE__ */ jsx(DraftNameInput, {
|
|
1506
|
-
ref: nameInput,
|
|
1507
|
-
projectId,
|
|
1508
|
-
draft: draft.data
|
|
1509
|
-
})] }) : /* @__PURE__ */ jsx(SheetTitle, {
|
|
1510
|
-
className: "text-base",
|
|
1511
|
-
children: "Draft"
|
|
1321
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetTitle, {
|
|
1322
|
+
className: "truncate text-base",
|
|
1323
|
+
children: draft.data ? draftLabel(draft.data) : "Draft"
|
|
1512
1324
|
}), /* @__PURE__ */ jsx(SheetDescription, { children: draft.data ? `${draft.data.createdBy.name} · started ${timeAgo(draft.data.createdAt)}` : "Publishing applies this whole draft to Live." })] })
|
|
1513
1325
|
});
|
|
1514
|
-
$[
|
|
1515
|
-
$[
|
|
1516
|
-
$[
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
t18 = data ? /* @__PURE__ */ jsxs("div", {
|
|
1326
|
+
$[32] = draft.data;
|
|
1327
|
+
$[33] = headline;
|
|
1328
|
+
$[34] = t15;
|
|
1329
|
+
} else t15 = $[34];
|
|
1330
|
+
let t16;
|
|
1331
|
+
if ($[35] !== data || $[36] !== locales || $[37] !== onOpenChange || $[38] !== preview || $[39] !== projectId || $[40] !== showInCanvas) {
|
|
1332
|
+
t16 = data ? /* @__PURE__ */ jsxs("div", {
|
|
1522
1333
|
className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4",
|
|
1523
1334
|
children: [
|
|
1524
1335
|
/* @__PURE__ */ jsx(DraftOverview, {
|
|
@@ -1547,264 +1358,230 @@ function ReviewDraftSheet(t0) {
|
|
|
1547
1358
|
className: "flex flex-1 items-center justify-center",
|
|
1548
1359
|
children: /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" })
|
|
1549
1360
|
});
|
|
1550
|
-
$[
|
|
1551
|
-
$[
|
|
1552
|
-
$[
|
|
1553
|
-
$[
|
|
1554
|
-
$[
|
|
1555
|
-
$[
|
|
1556
|
-
$[
|
|
1557
|
-
} else
|
|
1558
|
-
let
|
|
1559
|
-
let
|
|
1560
|
-
if ($[
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
$[
|
|
1564
|
-
$[
|
|
1361
|
+
$[35] = data;
|
|
1362
|
+
$[36] = locales;
|
|
1363
|
+
$[37] = onOpenChange;
|
|
1364
|
+
$[38] = preview;
|
|
1365
|
+
$[39] = projectId;
|
|
1366
|
+
$[40] = showInCanvas;
|
|
1367
|
+
$[41] = t16;
|
|
1368
|
+
} else t16 = $[41];
|
|
1369
|
+
let t17;
|
|
1370
|
+
let t18;
|
|
1371
|
+
if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1372
|
+
t17 = () => setConfirmingDelete(true);
|
|
1373
|
+
t18 = /* @__PURE__ */ jsx(Trash2, {});
|
|
1374
|
+
$[42] = t17;
|
|
1375
|
+
$[43] = t18;
|
|
1565
1376
|
} else {
|
|
1566
|
-
|
|
1567
|
-
|
|
1377
|
+
t17 = $[42];
|
|
1378
|
+
t18 = $[43];
|
|
1568
1379
|
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
t22 = /* @__PURE__ */ jsxs(Button, {
|
|
1380
|
+
let t19;
|
|
1381
|
+
if ($[44] !== busy) {
|
|
1382
|
+
t19 = /* @__PURE__ */ jsxs(Button, {
|
|
1573
1383
|
variant: "ghost",
|
|
1574
1384
|
className: "text-destructive",
|
|
1575
1385
|
disabled: busy,
|
|
1576
|
-
onClick:
|
|
1577
|
-
children: [
|
|
1386
|
+
onClick: t17,
|
|
1387
|
+
children: [t18, "Delete draft"]
|
|
1578
1388
|
});
|
|
1579
|
-
$[
|
|
1389
|
+
$[44] = busy;
|
|
1390
|
+
$[45] = t19;
|
|
1391
|
+
} else t19 = $[45];
|
|
1392
|
+
const t20 = !ready;
|
|
1393
|
+
let t21;
|
|
1394
|
+
if ($[46] !== data || $[47] !== projectId || $[48] !== publish) {
|
|
1395
|
+
t21 = () => data && publish.mutate(publishInput(projectId, data));
|
|
1396
|
+
$[46] = data;
|
|
1397
|
+
$[47] = projectId;
|
|
1398
|
+
$[48] = publish;
|
|
1580
1399
|
$[49] = t21;
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
} else t24 = $[54];
|
|
1592
|
-
let t25;
|
|
1593
|
-
if ($[55] !== publish.isPending) {
|
|
1594
|
-
t25 = publish.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1595
|
-
$[55] = publish.isPending;
|
|
1596
|
-
$[56] = t25;
|
|
1597
|
-
} else t25 = $[56];
|
|
1598
|
-
let t26;
|
|
1599
|
-
if ($[57] !== t23 || $[58] !== t24 || $[59] !== t25) {
|
|
1600
|
-
t26 = /* @__PURE__ */ jsxs(Button, {
|
|
1400
|
+
} else t21 = $[49];
|
|
1401
|
+
let t22;
|
|
1402
|
+
if ($[50] !== publish.isPending) {
|
|
1403
|
+
t22 = publish.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1404
|
+
$[50] = publish.isPending;
|
|
1405
|
+
$[51] = t22;
|
|
1406
|
+
} else t22 = $[51];
|
|
1407
|
+
let t23;
|
|
1408
|
+
if ($[52] !== t20 || $[53] !== t21 || $[54] !== t22) {
|
|
1409
|
+
t23 = /* @__PURE__ */ jsxs(Button, {
|
|
1601
1410
|
className: "ml-auto",
|
|
1602
|
-
disabled:
|
|
1603
|
-
onClick:
|
|
1604
|
-
children: [
|
|
1411
|
+
disabled: t20,
|
|
1412
|
+
onClick: t21,
|
|
1413
|
+
children: [t22, "Publish"]
|
|
1605
1414
|
});
|
|
1606
|
-
$[
|
|
1607
|
-
$[
|
|
1608
|
-
$[
|
|
1609
|
-
$[
|
|
1610
|
-
} else
|
|
1611
|
-
let
|
|
1612
|
-
if ($[
|
|
1613
|
-
|
|
1415
|
+
$[52] = t20;
|
|
1416
|
+
$[53] = t21;
|
|
1417
|
+
$[54] = t22;
|
|
1418
|
+
$[55] = t23;
|
|
1419
|
+
} else t23 = $[55];
|
|
1420
|
+
let t24;
|
|
1421
|
+
if ($[56] !== t19 || $[57] !== t23) {
|
|
1422
|
+
t24 = /* @__PURE__ */ jsx("div", {
|
|
1614
1423
|
className: "flex flex-col gap-3 border-t p-4",
|
|
1615
1424
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1616
1425
|
className: "flex items-center gap-2",
|
|
1617
|
-
children: [
|
|
1426
|
+
children: [t19, t23]
|
|
1618
1427
|
})
|
|
1619
1428
|
});
|
|
1620
|
-
$[
|
|
1621
|
-
$[
|
|
1622
|
-
$[
|
|
1623
|
-
} else
|
|
1624
|
-
let
|
|
1625
|
-
if ($[
|
|
1626
|
-
|
|
1429
|
+
$[56] = t19;
|
|
1430
|
+
$[57] = t23;
|
|
1431
|
+
$[58] = t24;
|
|
1432
|
+
} else t24 = $[58];
|
|
1433
|
+
let t25;
|
|
1434
|
+
if ($[59] !== t15 || $[60] !== t16 || $[61] !== t24) {
|
|
1435
|
+
t25 = /* @__PURE__ */ jsxs(SheetContent, {
|
|
1627
1436
|
ref: popup,
|
|
1628
|
-
initialFocus,
|
|
1437
|
+
initialFocus: popup,
|
|
1629
1438
|
side: "right",
|
|
1630
1439
|
className: "w-full gap-0 data-[side=right]:sm:max-w-lg",
|
|
1631
1440
|
children: [
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1441
|
+
t15,
|
|
1442
|
+
t16,
|
|
1443
|
+
t24
|
|
1635
1444
|
]
|
|
1636
1445
|
});
|
|
1637
|
-
$[
|
|
1638
|
-
$[
|
|
1639
|
-
$[
|
|
1640
|
-
$[
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
t29 = /* @__PURE__ */ jsx(Sheet, {
|
|
1446
|
+
$[59] = t15;
|
|
1447
|
+
$[60] = t16;
|
|
1448
|
+
$[61] = t24;
|
|
1449
|
+
$[62] = t25;
|
|
1450
|
+
} else t25 = $[62];
|
|
1451
|
+
let t26;
|
|
1452
|
+
if ($[63] !== onOpenChange || $[64] !== open || $[65] !== t25) {
|
|
1453
|
+
t26 = /* @__PURE__ */ jsx(Sheet, {
|
|
1646
1454
|
open,
|
|
1647
1455
|
onOpenChange,
|
|
1648
|
-
children:
|
|
1456
|
+
children: t25
|
|
1649
1457
|
});
|
|
1650
|
-
$[
|
|
1651
|
-
$[
|
|
1652
|
-
$[
|
|
1653
|
-
$[
|
|
1654
|
-
} else
|
|
1655
|
-
let
|
|
1656
|
-
if ($[
|
|
1657
|
-
|
|
1458
|
+
$[63] = onOpenChange;
|
|
1459
|
+
$[64] = open;
|
|
1460
|
+
$[65] = t25;
|
|
1461
|
+
$[66] = t26;
|
|
1462
|
+
} else t26 = $[66];
|
|
1463
|
+
let t27;
|
|
1464
|
+
if ($[67] !== confirmingDelete || $[68] !== leave || $[69] !== projectId) {
|
|
1465
|
+
t27 = /* @__PURE__ */ jsx(DeleteDraftDialog, {
|
|
1658
1466
|
projectId,
|
|
1659
1467
|
open: confirmingDelete,
|
|
1660
|
-
discard,
|
|
1661
1468
|
onOpenChange: setConfirmingDelete,
|
|
1662
1469
|
onDeleted: leave
|
|
1663
1470
|
});
|
|
1664
|
-
$[
|
|
1665
|
-
$[
|
|
1666
|
-
$[
|
|
1667
|
-
$[
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
$[
|
|
1674
|
-
$[
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
return t31;
|
|
1471
|
+
$[67] = confirmingDelete;
|
|
1472
|
+
$[68] = leave;
|
|
1473
|
+
$[69] = projectId;
|
|
1474
|
+
$[70] = t27;
|
|
1475
|
+
} else t27 = $[70];
|
|
1476
|
+
let t28;
|
|
1477
|
+
if ($[71] !== t26 || $[72] !== t27) {
|
|
1478
|
+
t28 = /* @__PURE__ */ jsxs(Fragment, { children: [t26, t27] });
|
|
1479
|
+
$[71] = t26;
|
|
1480
|
+
$[72] = t27;
|
|
1481
|
+
$[73] = t28;
|
|
1482
|
+
} else t28 = $[73];
|
|
1483
|
+
return t28;
|
|
1678
1484
|
}
|
|
1679
|
-
/**
|
|
1680
|
-
* Asks before deleting the draft the studio is in, then deletes it. Deleting an unnamed draft
|
|
1681
|
-
* is discarding its changes: nobody kept them as a draft yet.
|
|
1682
|
-
*/
|
|
1485
|
+
/** Asks before deleting the draft the studio is in, then deletes it. */
|
|
1683
1486
|
function DeleteDraftDialog(t0) {
|
|
1684
|
-
const $ = c(
|
|
1685
|
-
const { projectId, open,
|
|
1686
|
-
|
|
1687
|
-
let t2;
|
|
1487
|
+
const $ = c(26);
|
|
1488
|
+
const { projectId, open, onOpenChange, onDeleted } = t0;
|
|
1489
|
+
let t1;
|
|
1688
1490
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1689
|
-
|
|
1690
|
-
$[0] =
|
|
1691
|
-
} else
|
|
1692
|
-
let
|
|
1491
|
+
t1 = draftMutations.delete();
|
|
1492
|
+
$[0] = t1;
|
|
1493
|
+
} else t1 = $[0];
|
|
1494
|
+
let t2;
|
|
1693
1495
|
if ($[1] !== onDeleted || $[2] !== onOpenChange) {
|
|
1694
|
-
|
|
1695
|
-
...
|
|
1696
|
-
onSuccess: (
|
|
1697
|
-
const { ended } =
|
|
1496
|
+
t2 = {
|
|
1497
|
+
...t1,
|
|
1498
|
+
onSuccess: (t3) => {
|
|
1499
|
+
const { ended } = t3;
|
|
1698
1500
|
onOpenChange(false);
|
|
1699
1501
|
onDeleted(ended);
|
|
1700
1502
|
},
|
|
1701
|
-
onError:
|
|
1503
|
+
onError: _temp13
|
|
1702
1504
|
};
|
|
1703
1505
|
$[1] = onDeleted;
|
|
1704
1506
|
$[2] = onOpenChange;
|
|
1705
|
-
$[3] =
|
|
1706
|
-
} else
|
|
1707
|
-
const deleteDraft = useMutation(
|
|
1708
|
-
let
|
|
1507
|
+
$[3] = t2;
|
|
1508
|
+
} else t2 = $[3];
|
|
1509
|
+
const deleteDraft = useMutation(t2);
|
|
1510
|
+
let t3;
|
|
1709
1511
|
if ($[4] !== deleteDraft.isPending || $[5] !== onOpenChange) {
|
|
1710
|
-
|
|
1512
|
+
t3 = (next) => {
|
|
1711
1513
|
if (!deleteDraft.isPending) onOpenChange(next);
|
|
1712
1514
|
};
|
|
1713
1515
|
$[4] = deleteDraft.isPending;
|
|
1714
1516
|
$[5] = onOpenChange;
|
|
1715
|
-
$[6] =
|
|
1716
|
-
} else
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
let t8;
|
|
1726
|
-
if ($[9] !== t7) {
|
|
1727
|
-
t8 = /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [t7, " deleted for everyone. Live stays as it is. This can't be undone."] });
|
|
1728
|
-
$[9] = t7;
|
|
1729
|
-
$[10] = t8;
|
|
1730
|
-
} else t8 = $[10];
|
|
1731
|
-
let t9;
|
|
1732
|
-
if ($[11] !== t6 || $[12] !== t8) {
|
|
1733
|
-
t9 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t6, t8] });
|
|
1734
|
-
$[11] = t6;
|
|
1735
|
-
$[12] = t8;
|
|
1736
|
-
$[13] = t9;
|
|
1737
|
-
} else t9 = $[13];
|
|
1738
|
-
let t10;
|
|
1739
|
-
if ($[14] !== deleteDraft.isPending) {
|
|
1740
|
-
t10 = /* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
1517
|
+
$[6] = t3;
|
|
1518
|
+
} else t3 = $[6];
|
|
1519
|
+
let t4;
|
|
1520
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1521
|
+
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." })] });
|
|
1522
|
+
$[7] = t4;
|
|
1523
|
+
} else t4 = $[7];
|
|
1524
|
+
let t5;
|
|
1525
|
+
if ($[8] !== deleteDraft.isPending) {
|
|
1526
|
+
t5 = /* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
1741
1527
|
variant: "outline",
|
|
1742
1528
|
size: "default",
|
|
1743
1529
|
disabled: deleteDraft.isPending,
|
|
1744
1530
|
children: "Cancel"
|
|
1745
1531
|
});
|
|
1746
|
-
$[
|
|
1747
|
-
$[
|
|
1748
|
-
} else
|
|
1749
|
-
let
|
|
1750
|
-
if ($[
|
|
1751
|
-
|
|
1752
|
-
$[
|
|
1753
|
-
$[
|
|
1754
|
-
$[
|
|
1755
|
-
} else
|
|
1756
|
-
let
|
|
1757
|
-
if ($[
|
|
1758
|
-
|
|
1759
|
-
$[
|
|
1760
|
-
$[
|
|
1761
|
-
} else
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
t14 = /* @__PURE__ */ jsxs(AlertDialogAction, {
|
|
1532
|
+
$[8] = deleteDraft.isPending;
|
|
1533
|
+
$[9] = t5;
|
|
1534
|
+
} else t5 = $[9];
|
|
1535
|
+
let t6;
|
|
1536
|
+
if ($[10] !== deleteDraft || $[11] !== projectId) {
|
|
1537
|
+
t6 = () => deleteDraft.mutate({ projectId });
|
|
1538
|
+
$[10] = deleteDraft;
|
|
1539
|
+
$[11] = projectId;
|
|
1540
|
+
$[12] = t6;
|
|
1541
|
+
} else t6 = $[12];
|
|
1542
|
+
let t7;
|
|
1543
|
+
if ($[13] !== deleteDraft.isPending) {
|
|
1544
|
+
t7 = deleteDraft.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1545
|
+
$[13] = deleteDraft.isPending;
|
|
1546
|
+
$[14] = t7;
|
|
1547
|
+
} else t7 = $[14];
|
|
1548
|
+
let t8;
|
|
1549
|
+
if ($[15] !== deleteDraft.isPending || $[16] !== t6 || $[17] !== t7) {
|
|
1550
|
+
t8 = /* @__PURE__ */ jsxs(AlertDialogAction, {
|
|
1766
1551
|
variant: "destructive",
|
|
1767
1552
|
disabled: deleteDraft.isPending,
|
|
1768
|
-
onClick:
|
|
1769
|
-
children: [
|
|
1553
|
+
onClick: t6,
|
|
1554
|
+
children: [t7, "Delete draft"]
|
|
1770
1555
|
});
|
|
1771
|
-
$[
|
|
1772
|
-
$[
|
|
1773
|
-
$[
|
|
1774
|
-
$[
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
$[
|
|
1781
|
-
$[
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
t16 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t9, t15] });
|
|
1787
|
-
$[29] = t15;
|
|
1788
|
-
$[30] = t9;
|
|
1789
|
-
$[31] = t16;
|
|
1790
|
-
} else t16 = $[31];
|
|
1791
|
-
let t17;
|
|
1792
|
-
if ($[32] !== open || $[33] !== t16 || $[34] !== t4) {
|
|
1793
|
-
t17 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
1556
|
+
$[15] = deleteDraft.isPending;
|
|
1557
|
+
$[16] = t6;
|
|
1558
|
+
$[17] = t7;
|
|
1559
|
+
$[18] = t8;
|
|
1560
|
+
} else t8 = $[18];
|
|
1561
|
+
let t9;
|
|
1562
|
+
if ($[19] !== t5 || $[20] !== t8) {
|
|
1563
|
+
t9 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t4, /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t5, t8] })] });
|
|
1564
|
+
$[19] = t5;
|
|
1565
|
+
$[20] = t8;
|
|
1566
|
+
$[21] = t9;
|
|
1567
|
+
} else t9 = $[21];
|
|
1568
|
+
let t10;
|
|
1569
|
+
if ($[22] !== open || $[23] !== t3 || $[24] !== t9) {
|
|
1570
|
+
t10 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
1794
1571
|
open,
|
|
1795
|
-
onOpenChange:
|
|
1796
|
-
children:
|
|
1572
|
+
onOpenChange: t3,
|
|
1573
|
+
children: t9
|
|
1797
1574
|
});
|
|
1798
|
-
$[
|
|
1799
|
-
$[
|
|
1800
|
-
$[
|
|
1801
|
-
$[
|
|
1802
|
-
} else
|
|
1803
|
-
return
|
|
1575
|
+
$[22] = open;
|
|
1576
|
+
$[23] = t3;
|
|
1577
|
+
$[24] = t9;
|
|
1578
|
+
$[25] = t10;
|
|
1579
|
+
} else t10 = $[25];
|
|
1580
|
+
return t10;
|
|
1804
1581
|
}
|
|
1805
|
-
function
|
|
1582
|
+
function _temp13(error) {
|
|
1806
1583
|
return toast.error(error.message || "Could not delete the draft");
|
|
1807
1584
|
}
|
|
1808
1585
|
|
|
1809
1586
|
//#endregion
|
|
1810
|
-
export { DeleteDraftDialog, ReviewDraftSheet
|
|
1587
|
+
export { DeleteDraftDialog, ReviewDraftSheet };
|