camox 0.69.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/runtime/pageApp.js +7 -3
- 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 +150 -176
- package/dist/features/studio/components/ReviewDraftSheet.js +344 -548
- package/dist/features/studio/draftLabel.js +1 -1
- package/dist/features/studio/studioStore.js +5 -17
- package/dist/features/studio/viewSwitch.js +2 -4
- 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,6 +1,5 @@
|
|
|
1
|
-
import { reads, useReadQuery
|
|
1
|
+
import { reads, useReadQuery } from "../../../lib/studio-reads.js";
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
|
-
import { getDraftReadClient } from "../../../lib/api-client.js";
|
|
4
3
|
import { draftMutations, patrolMutations } from "../../../lib/queries.js";
|
|
5
4
|
import { previewStore } from "../../preview/previewStore.js";
|
|
6
5
|
import { studioStore } from "../studioStore.js";
|
|
@@ -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) {
|
|
@@ -1134,270 +1135,109 @@ function _temp10(error) {
|
|
|
1134
1135
|
return toast.error(error.message || "Could not summarize the draft");
|
|
1135
1136
|
}
|
|
1136
1137
|
/**
|
|
1137
|
-
* Renames a regular draft, whichever draft the studio views: the request names the draft it
|
|
1138
|
-
* renames. A blank name clears it, so the draft shows its computed label again.
|
|
1139
|
-
*/
|
|
1140
|
-
function useRenameDraft(projectId) {
|
|
1141
|
-
const $ = c(8);
|
|
1142
|
-
const studioCache = useStudioCache();
|
|
1143
|
-
let t0;
|
|
1144
|
-
if ($[0] !== projectId) {
|
|
1145
|
-
t0 = (t1) => {
|
|
1146
|
-
const { draftId, name } = t1;
|
|
1147
|
-
return getDraftReadClient(draftId).drafts.rename({
|
|
1148
|
-
projectId,
|
|
1149
|
-
name
|
|
1150
|
-
});
|
|
1151
|
-
};
|
|
1152
|
-
$[0] = projectId;
|
|
1153
|
-
$[1] = t0;
|
|
1154
|
-
} else t0 = $[1];
|
|
1155
|
-
let t1;
|
|
1156
|
-
if ($[2] !== projectId || $[3] !== studioCache) {
|
|
1157
|
-
t1 = (renamed) => {
|
|
1158
|
-
studioCache.set(reads.draft({
|
|
1159
|
-
projectId,
|
|
1160
|
-
draftId: renamed.id
|
|
1161
|
-
}), renamed);
|
|
1162
|
-
studioCache.invalidate(reads.draftList({ projectId }));
|
|
1163
|
-
};
|
|
1164
|
-
$[2] = projectId;
|
|
1165
|
-
$[3] = studioCache;
|
|
1166
|
-
$[4] = t1;
|
|
1167
|
-
} else t1 = $[4];
|
|
1168
|
-
let t2;
|
|
1169
|
-
if ($[5] !== t0 || $[6] !== t1) {
|
|
1170
|
-
t2 = {
|
|
1171
|
-
mutationFn: t0,
|
|
1172
|
-
onSuccess: t1,
|
|
1173
|
-
onError: _temp13
|
|
1174
|
-
};
|
|
1175
|
-
$[5] = t0;
|
|
1176
|
-
$[6] = t1;
|
|
1177
|
-
$[7] = t2;
|
|
1178
|
-
} else t2 = $[7];
|
|
1179
|
-
return useMutation(t2);
|
|
1180
|
-
}
|
|
1181
|
-
function _temp13(error) {
|
|
1182
|
-
return toast.error(error.message || "Could not rename the draft");
|
|
1183
|
-
}
|
|
1184
|
-
/**
|
|
1185
|
-
* The draft's name in the review's header, renamed in place by any member (#203), like a page
|
|
1186
|
-
* nickname in the Canvas Inspector: a title whose border shows on hover or focus, without
|
|
1187
|
-
* moving the text. An unnamed draft shows its computed label until focused. Saves on Enter or
|
|
1188
|
-
* blur, and a blank name clears it; Escape puts the name back.
|
|
1189
|
-
*/
|
|
1190
|
-
function DraftNameInput(t0) {
|
|
1191
|
-
const $ = c(23);
|
|
1192
|
-
const { projectId, draft, ref, className } = t0;
|
|
1193
|
-
const rename = useRenameDraft(projectId);
|
|
1194
|
-
const name = draft.name ?? "";
|
|
1195
|
-
let t1;
|
|
1196
|
-
if ($[0] !== draft.id || $[1] !== draft.name || $[2] !== name || $[3] !== rename) {
|
|
1197
|
-
t1 = (input) => {
|
|
1198
|
-
if ((input.value.trim() || null) === draft.name) {
|
|
1199
|
-
input.value = name;
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
rename.mutate({
|
|
1203
|
-
draftId: draft.id,
|
|
1204
|
-
name: input.value
|
|
1205
|
-
}, { onError: () => void (input.value = name) });
|
|
1206
|
-
};
|
|
1207
|
-
$[0] = draft.id;
|
|
1208
|
-
$[1] = draft.name;
|
|
1209
|
-
$[2] = name;
|
|
1210
|
-
$[3] = rename;
|
|
1211
|
-
$[4] = t1;
|
|
1212
|
-
} else t1 = $[4];
|
|
1213
|
-
const save = t1;
|
|
1214
|
-
let t2;
|
|
1215
|
-
if ($[5] !== draft) {
|
|
1216
|
-
t2 = draftLabel({
|
|
1217
|
-
...draft,
|
|
1218
|
-
name: null
|
|
1219
|
-
});
|
|
1220
|
-
$[5] = draft;
|
|
1221
|
-
$[6] = t2;
|
|
1222
|
-
} else t2 = $[6];
|
|
1223
|
-
let t3;
|
|
1224
|
-
if ($[7] !== draft) {
|
|
1225
|
-
t3 = draftLabel(draft);
|
|
1226
|
-
$[7] = draft;
|
|
1227
|
-
$[8] = t3;
|
|
1228
|
-
} else t3 = $[8];
|
|
1229
|
-
let t4;
|
|
1230
|
-
if ($[9] !== className) {
|
|
1231
|
-
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);
|
|
1232
|
-
$[9] = className;
|
|
1233
|
-
$[10] = t4;
|
|
1234
|
-
} else t4 = $[10];
|
|
1235
|
-
let t5;
|
|
1236
|
-
if ($[11] !== save) {
|
|
1237
|
-
t5 = (event) => save(event.currentTarget);
|
|
1238
|
-
$[11] = save;
|
|
1239
|
-
$[12] = t5;
|
|
1240
|
-
} else t5 = $[12];
|
|
1241
|
-
let t6;
|
|
1242
|
-
if ($[13] !== name) {
|
|
1243
|
-
t6 = (event_0) => {
|
|
1244
|
-
if (event_0.key === "Enter") {
|
|
1245
|
-
event_0.preventDefault();
|
|
1246
|
-
event_0.currentTarget.blur();
|
|
1247
|
-
}
|
|
1248
|
-
if (event_0.key !== "Escape") return;
|
|
1249
|
-
event_0.stopPropagation();
|
|
1250
|
-
event_0.currentTarget.value = name;
|
|
1251
|
-
event_0.currentTarget.blur();
|
|
1252
|
-
};
|
|
1253
|
-
$[13] = name;
|
|
1254
|
-
$[14] = t6;
|
|
1255
|
-
} else t6 = $[14];
|
|
1256
|
-
let t7;
|
|
1257
|
-
if ($[15] !== name || $[16] !== ref || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
|
|
1258
|
-
t7 = /* @__PURE__ */ jsx("input", {
|
|
1259
|
-
ref,
|
|
1260
|
-
"aria-label": "Draft name",
|
|
1261
|
-
defaultValue: name,
|
|
1262
|
-
placeholder: t2,
|
|
1263
|
-
title: t3,
|
|
1264
|
-
maxLength: 200,
|
|
1265
|
-
className: t4,
|
|
1266
|
-
onBlur: t5,
|
|
1267
|
-
onKeyDown: t6
|
|
1268
|
-
}, name);
|
|
1269
|
-
$[15] = name;
|
|
1270
|
-
$[16] = ref;
|
|
1271
|
-
$[17] = t2;
|
|
1272
|
-
$[18] = t3;
|
|
1273
|
-
$[19] = t4;
|
|
1274
|
-
$[20] = t5;
|
|
1275
|
-
$[21] = t6;
|
|
1276
|
-
$[22] = t7;
|
|
1277
|
-
} else t7 = $[22];
|
|
1278
|
-
return t7;
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
1138
|
* Reviews a draft before publishing it whole, or deletes it (ADR 0009). Publishing sends back
|
|
1282
1139
|
* the token of the preview shown; when Live changed since, nothing is published and the new
|
|
1283
1140
|
* preview is shown. Once the draft ends, the studio switches to Live.
|
|
1284
1141
|
*/
|
|
1285
1142
|
function ReviewDraftSheet(t0) {
|
|
1286
|
-
const $ = c(
|
|
1287
|
-
const { projectId, draftId, open,
|
|
1288
|
-
const startRenaming = t1 === void 0 ? false : t1;
|
|
1143
|
+
const $ = c(74);
|
|
1144
|
+
const { projectId, draftId, open, onOpenChange } = t0;
|
|
1289
1145
|
const [confirmingDelete, setConfirmingDelete] = React.useState(false);
|
|
1290
|
-
let
|
|
1146
|
+
let t1;
|
|
1291
1147
|
if ($[0] !== draftId || $[1] !== projectId) {
|
|
1292
|
-
|
|
1148
|
+
t1 = reads.publishPreview({
|
|
1293
1149
|
projectId,
|
|
1294
1150
|
draftId
|
|
1295
1151
|
});
|
|
1296
1152
|
$[0] = draftId;
|
|
1297
1153
|
$[1] = projectId;
|
|
1298
|
-
$[2] =
|
|
1299
|
-
} else
|
|
1300
|
-
let
|
|
1154
|
+
$[2] = t1;
|
|
1155
|
+
} else t1 = $[2];
|
|
1156
|
+
let t2;
|
|
1301
1157
|
if ($[3] !== open) {
|
|
1302
|
-
|
|
1158
|
+
t2 = { enabled: open };
|
|
1303
1159
|
$[3] = open;
|
|
1304
|
-
$[4] =
|
|
1305
|
-
} else
|
|
1306
|
-
const preview = useReadQuery(
|
|
1307
|
-
let
|
|
1160
|
+
$[4] = t2;
|
|
1161
|
+
} else t2 = $[4];
|
|
1162
|
+
const preview = useReadQuery(t1, t2);
|
|
1163
|
+
let t3;
|
|
1308
1164
|
if ($[5] !== draftId || $[6] !== projectId) {
|
|
1309
|
-
|
|
1165
|
+
t3 = reads.draft({
|
|
1310
1166
|
projectId,
|
|
1311
1167
|
draftId
|
|
1312
1168
|
});
|
|
1313
1169
|
$[5] = draftId;
|
|
1314
1170
|
$[6] = projectId;
|
|
1315
|
-
$[7] =
|
|
1316
|
-
} else
|
|
1317
|
-
let
|
|
1171
|
+
$[7] = t3;
|
|
1172
|
+
} else t3 = $[7];
|
|
1173
|
+
let t4;
|
|
1318
1174
|
if ($[8] !== open) {
|
|
1319
|
-
|
|
1175
|
+
t4 = { enabled: open };
|
|
1320
1176
|
$[8] = open;
|
|
1321
|
-
$[9] =
|
|
1322
|
-
} else
|
|
1323
|
-
const draft = useReadQuery(
|
|
1324
|
-
let
|
|
1177
|
+
$[9] = t4;
|
|
1178
|
+
} else t4 = $[9];
|
|
1179
|
+
const draft = useReadQuery(t3, t4);
|
|
1180
|
+
let t5;
|
|
1325
1181
|
if ($[10] !== projectId) {
|
|
1326
|
-
|
|
1182
|
+
t5 = reads.localeList({ projectId });
|
|
1327
1183
|
$[10] = projectId;
|
|
1328
|
-
$[11] =
|
|
1329
|
-
} else
|
|
1330
|
-
let
|
|
1184
|
+
$[11] = t5;
|
|
1185
|
+
} else t5 = $[11];
|
|
1186
|
+
let t6;
|
|
1331
1187
|
if ($[12] !== open) {
|
|
1332
|
-
|
|
1188
|
+
t6 = { enabled: open };
|
|
1333
1189
|
$[12] = open;
|
|
1334
|
-
$[13] =
|
|
1335
|
-
} else
|
|
1336
|
-
const locales = useReadQuery(
|
|
1190
|
+
$[13] = t6;
|
|
1191
|
+
} else t6 = $[13];
|
|
1192
|
+
const locales = useReadQuery(t5, t6);
|
|
1337
1193
|
const leaveDraft = useLeaveDraft();
|
|
1338
1194
|
const showInCanvas = useShowInCanvas();
|
|
1339
1195
|
const popup = React.useRef(null);
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
}
|
|
1348
|
-
return popup.current;
|
|
1349
|
-
};
|
|
1350
|
-
$[14] = startRenaming;
|
|
1351
|
-
$[15] = t8;
|
|
1352
|
-
} else t8 = $[15];
|
|
1353
|
-
const initialFocus = t8;
|
|
1354
|
-
let t9;
|
|
1355
|
-
if ($[16] !== draft.data?.translatingLocales) {
|
|
1356
|
-
t9 = draft.data?.translatingLocales.join(",");
|
|
1357
|
-
$[16] = draft.data?.translatingLocales;
|
|
1358
|
-
$[17] = t9;
|
|
1359
|
-
} else t9 = $[17];
|
|
1360
|
-
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;
|
|
1361
1203
|
const seenPending = React.useRef(pending);
|
|
1362
1204
|
const { refetch } = preview;
|
|
1363
|
-
let
|
|
1364
|
-
let
|
|
1365
|
-
if ($[
|
|
1366
|
-
|
|
1205
|
+
let t8;
|
|
1206
|
+
let t9;
|
|
1207
|
+
if ($[16] !== pending || $[17] !== refetch) {
|
|
1208
|
+
t8 = () => {
|
|
1367
1209
|
if (seenPending.current !== void 0 && seenPending.current !== pending) refetch();
|
|
1368
1210
|
seenPending.current = pending;
|
|
1369
1211
|
};
|
|
1370
|
-
|
|
1371
|
-
$[
|
|
1372
|
-
$[
|
|
1373
|
-
$[
|
|
1374
|
-
$[
|
|
1212
|
+
t9 = [pending, refetch];
|
|
1213
|
+
$[16] = pending;
|
|
1214
|
+
$[17] = refetch;
|
|
1215
|
+
$[18] = t8;
|
|
1216
|
+
$[19] = t9;
|
|
1375
1217
|
} else {
|
|
1376
|
-
|
|
1377
|
-
|
|
1218
|
+
t8 = $[18];
|
|
1219
|
+
t9 = $[19];
|
|
1378
1220
|
}
|
|
1379
|
-
React.useEffect(
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
t12 = (ended) => {
|
|
1221
|
+
React.useEffect(t8, t9);
|
|
1222
|
+
let t10;
|
|
1223
|
+
if ($[20] !== leaveDraft || $[21] !== onOpenChange) {
|
|
1224
|
+
t10 = (ended) => {
|
|
1384
1225
|
onOpenChange(false);
|
|
1385
|
-
leaveDraft(ended
|
|
1226
|
+
leaveDraft(ended);
|
|
1386
1227
|
};
|
|
1387
|
-
$[
|
|
1388
|
-
$[
|
|
1389
|
-
$[
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
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) => {
|
|
1401
1241
|
if ("publishing" in result && result.publishing) {
|
|
1402
1242
|
preview.refetch();
|
|
1403
1243
|
return;
|
|
@@ -1407,13 +1247,13 @@ function ReviewDraftSheet(t0) {
|
|
|
1407
1247
|
toast.info("This draft has no changes, so there is nothing to publish.");
|
|
1408
1248
|
preview.refetch();
|
|
1409
1249
|
};
|
|
1410
|
-
$[
|
|
1411
|
-
$[
|
|
1412
|
-
$[
|
|
1413
|
-
} else
|
|
1414
|
-
let
|
|
1415
|
-
if ($[
|
|
1416
|
-
|
|
1250
|
+
$[24] = leave;
|
|
1251
|
+
$[25] = preview;
|
|
1252
|
+
$[26] = t12;
|
|
1253
|
+
} else t12 = $[26];
|
|
1254
|
+
let t13;
|
|
1255
|
+
if ($[27] !== preview) {
|
|
1256
|
+
t13 = (error) => {
|
|
1417
1257
|
if (error.code === CONFLICTS_CHANGED_ERROR) {
|
|
1418
1258
|
toast.error("Live changed since you opened this review. Check the new list.");
|
|
1419
1259
|
preview.refetch();
|
|
@@ -1438,37 +1278,35 @@ function ReviewDraftSheet(t0) {
|
|
|
1438
1278
|
toast.error(error.message || "Could not publish the draft");
|
|
1439
1279
|
preview.refetch();
|
|
1440
1280
|
};
|
|
1441
|
-
$[
|
|
1442
|
-
$[
|
|
1443
|
-
} else
|
|
1444
|
-
let
|
|
1445
|
-
if ($[
|
|
1446
|
-
|
|
1447
|
-
...
|
|
1448
|
-
onSuccess:
|
|
1449
|
-
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
|
|
1450
1290
|
};
|
|
1451
|
-
$[
|
|
1452
|
-
$[
|
|
1453
|
-
$[
|
|
1454
|
-
} else
|
|
1455
|
-
const publish = useMutation(
|
|
1291
|
+
$[29] = t12;
|
|
1292
|
+
$[30] = t13;
|
|
1293
|
+
$[31] = t14;
|
|
1294
|
+
} else t14 = $[31];
|
|
1295
|
+
const publish = useMutation(t14);
|
|
1456
1296
|
const data = preview.data;
|
|
1457
1297
|
const headline = data?.overview.status === "ready" ? data.overview.headline : null;
|
|
1458
1298
|
const busy = publish.isPending;
|
|
1459
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;
|
|
1460
|
-
let
|
|
1461
|
-
if ($[
|
|
1462
|
-
|
|
1300
|
+
let t15;
|
|
1301
|
+
if ($[32] !== draft.data || $[33] !== headline) {
|
|
1302
|
+
t15 = /* @__PURE__ */ jsx("div", {
|
|
1463
1303
|
className: "flex flex-col gap-1 border-b p-4 pr-12",
|
|
1464
|
-
children: headline ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */
|
|
1304
|
+
children: headline ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetDescription, {
|
|
1465
1305
|
className: "flex min-w-0 items-center gap-1",
|
|
1466
|
-
children:
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
className: "placeholder:text-muted-foreground text-muted-foreground field-sizing-content h-6 w-auto max-w-full text-sm font-normal"
|
|
1471
|
-
}), 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", {
|
|
1472
1310
|
className: "shrink-0",
|
|
1473
1311
|
children: [
|
|
1474
1312
|
"· ",
|
|
@@ -1476,30 +1314,22 @@ function ReviewDraftSheet(t0) {
|
|
|
1476
1314
|
", started ",
|
|
1477
1315
|
timeAgo(draft.data.createdAt)
|
|
1478
1316
|
]
|
|
1479
|
-
})]
|
|
1317
|
+
})] })
|
|
1480
1318
|
}), /* @__PURE__ */ jsx(SheetTitle, {
|
|
1481
1319
|
className: "text-lg leading-snug font-semibold",
|
|
1482
1320
|
children: headline
|
|
1483
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1484
|
-
className: "
|
|
1485
|
-
children: draftLabel(draft.data)
|
|
1486
|
-
}), /* @__PURE__ */ jsx(DraftNameInput, {
|
|
1487
|
-
ref: nameInput,
|
|
1488
|
-
projectId,
|
|
1489
|
-
draft: draft.data
|
|
1490
|
-
})] }) : /* @__PURE__ */ jsx(SheetTitle, {
|
|
1491
|
-
className: "text-base",
|
|
1492
|
-
children: "Draft"
|
|
1321
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SheetTitle, {
|
|
1322
|
+
className: "truncate text-base",
|
|
1323
|
+
children: draft.data ? draftLabel(draft.data) : "Draft"
|
|
1493
1324
|
}), /* @__PURE__ */ jsx(SheetDescription, { children: draft.data ? `${draft.data.createdBy.name} · started ${timeAgo(draft.data.createdAt)}` : "Publishing applies this whole draft to Live." })] })
|
|
1494
1325
|
});
|
|
1495
|
-
$[
|
|
1496
|
-
$[
|
|
1497
|
-
$[
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
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", {
|
|
1503
1333
|
className: "flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4",
|
|
1504
1334
|
children: [
|
|
1505
1335
|
/* @__PURE__ */ jsx(DraftOverview, {
|
|
@@ -1528,264 +1358,230 @@ function ReviewDraftSheet(t0) {
|
|
|
1528
1358
|
className: "flex flex-1 items-center justify-center",
|
|
1529
1359
|
children: /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" })
|
|
1530
1360
|
});
|
|
1531
|
-
$[
|
|
1532
|
-
$[
|
|
1533
|
-
$[
|
|
1534
|
-
$[
|
|
1535
|
-
$[
|
|
1536
|
-
$[
|
|
1537
|
-
$[
|
|
1538
|
-
} else
|
|
1539
|
-
let
|
|
1540
|
-
let
|
|
1541
|
-
if ($[
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
$[
|
|
1545
|
-
$[
|
|
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;
|
|
1546
1376
|
} else {
|
|
1547
|
-
|
|
1548
|
-
|
|
1377
|
+
t17 = $[42];
|
|
1378
|
+
t18 = $[43];
|
|
1549
1379
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
t22 = /* @__PURE__ */ jsxs(Button, {
|
|
1380
|
+
let t19;
|
|
1381
|
+
if ($[44] !== busy) {
|
|
1382
|
+
t19 = /* @__PURE__ */ jsxs(Button, {
|
|
1554
1383
|
variant: "ghost",
|
|
1555
1384
|
className: "text-destructive",
|
|
1556
1385
|
disabled: busy,
|
|
1557
|
-
onClick:
|
|
1558
|
-
children: [
|
|
1386
|
+
onClick: t17,
|
|
1387
|
+
children: [t18, "Delete draft"]
|
|
1559
1388
|
});
|
|
1560
|
-
$[
|
|
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;
|
|
1561
1399
|
$[49] = t21;
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
} else t24 = $[54];
|
|
1573
|
-
let t25;
|
|
1574
|
-
if ($[55] !== publish.isPending) {
|
|
1575
|
-
t25 = publish.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
|
|
1576
|
-
$[55] = publish.isPending;
|
|
1577
|
-
$[56] = t25;
|
|
1578
|
-
} else t25 = $[56];
|
|
1579
|
-
let t26;
|
|
1580
|
-
if ($[57] !== t23 || $[58] !== t24 || $[59] !== t25) {
|
|
1581
|
-
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, {
|
|
1582
1410
|
className: "ml-auto",
|
|
1583
|
-
disabled:
|
|
1584
|
-
onClick:
|
|
1585
|
-
children: [
|
|
1411
|
+
disabled: t20,
|
|
1412
|
+
onClick: t21,
|
|
1413
|
+
children: [t22, "Publish"]
|
|
1586
1414
|
});
|
|
1587
|
-
$[
|
|
1588
|
-
$[
|
|
1589
|
-
$[
|
|
1590
|
-
$[
|
|
1591
|
-
} else
|
|
1592
|
-
let
|
|
1593
|
-
if ($[
|
|
1594
|
-
|
|
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", {
|
|
1595
1423
|
className: "flex flex-col gap-3 border-t p-4",
|
|
1596
1424
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1597
1425
|
className: "flex items-center gap-2",
|
|
1598
|
-
children: [
|
|
1426
|
+
children: [t19, t23]
|
|
1599
1427
|
})
|
|
1600
1428
|
});
|
|
1601
|
-
$[
|
|
1602
|
-
$[
|
|
1603
|
-
$[
|
|
1604
|
-
} else
|
|
1605
|
-
let
|
|
1606
|
-
if ($[
|
|
1607
|
-
|
|
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, {
|
|
1608
1436
|
ref: popup,
|
|
1609
|
-
initialFocus,
|
|
1437
|
+
initialFocus: popup,
|
|
1610
1438
|
side: "right",
|
|
1611
1439
|
className: "w-full gap-0 data-[side=right]:sm:max-w-lg",
|
|
1612
1440
|
children: [
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1441
|
+
t15,
|
|
1442
|
+
t16,
|
|
1443
|
+
t24
|
|
1616
1444
|
]
|
|
1617
1445
|
});
|
|
1618
|
-
$[
|
|
1619
|
-
$[
|
|
1620
|
-
$[
|
|
1621
|
-
$[
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
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, {
|
|
1627
1454
|
open,
|
|
1628
1455
|
onOpenChange,
|
|
1629
|
-
children:
|
|
1456
|
+
children: t25
|
|
1630
1457
|
});
|
|
1631
|
-
$[
|
|
1632
|
-
$[
|
|
1633
|
-
$[
|
|
1634
|
-
$[
|
|
1635
|
-
} else
|
|
1636
|
-
let
|
|
1637
|
-
if ($[
|
|
1638
|
-
|
|
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, {
|
|
1639
1466
|
projectId,
|
|
1640
1467
|
open: confirmingDelete,
|
|
1641
|
-
discard,
|
|
1642
1468
|
onOpenChange: setConfirmingDelete,
|
|
1643
1469
|
onDeleted: leave
|
|
1644
1470
|
});
|
|
1645
|
-
$[
|
|
1646
|
-
$[
|
|
1647
|
-
$[
|
|
1648
|
-
$[
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
$[
|
|
1655
|
-
$[
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
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;
|
|
1659
1484
|
}
|
|
1660
|
-
/**
|
|
1661
|
-
* Asks before deleting the draft the studio is in, then deletes it. Deleting an unnamed draft
|
|
1662
|
-
* is discarding its changes: nobody kept them as a draft yet.
|
|
1663
|
-
*/
|
|
1485
|
+
/** Asks before deleting the draft the studio is in, then deletes it. */
|
|
1664
1486
|
function DeleteDraftDialog(t0) {
|
|
1665
|
-
const $ = c(
|
|
1666
|
-
const { projectId, open,
|
|
1667
|
-
|
|
1668
|
-
let t2;
|
|
1487
|
+
const $ = c(26);
|
|
1488
|
+
const { projectId, open, onOpenChange, onDeleted } = t0;
|
|
1489
|
+
let t1;
|
|
1669
1490
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1670
|
-
|
|
1671
|
-
$[0] =
|
|
1672
|
-
} else
|
|
1673
|
-
let
|
|
1491
|
+
t1 = draftMutations.delete();
|
|
1492
|
+
$[0] = t1;
|
|
1493
|
+
} else t1 = $[0];
|
|
1494
|
+
let t2;
|
|
1674
1495
|
if ($[1] !== onDeleted || $[2] !== onOpenChange) {
|
|
1675
|
-
|
|
1676
|
-
...
|
|
1677
|
-
onSuccess: (
|
|
1678
|
-
const { ended } =
|
|
1496
|
+
t2 = {
|
|
1497
|
+
...t1,
|
|
1498
|
+
onSuccess: (t3) => {
|
|
1499
|
+
const { ended } = t3;
|
|
1679
1500
|
onOpenChange(false);
|
|
1680
1501
|
onDeleted(ended);
|
|
1681
1502
|
},
|
|
1682
|
-
onError:
|
|
1503
|
+
onError: _temp13
|
|
1683
1504
|
};
|
|
1684
1505
|
$[1] = onDeleted;
|
|
1685
1506
|
$[2] = onOpenChange;
|
|
1686
|
-
$[3] =
|
|
1687
|
-
} else
|
|
1688
|
-
const deleteDraft = useMutation(
|
|
1689
|
-
let
|
|
1507
|
+
$[3] = t2;
|
|
1508
|
+
} else t2 = $[3];
|
|
1509
|
+
const deleteDraft = useMutation(t2);
|
|
1510
|
+
let t3;
|
|
1690
1511
|
if ($[4] !== deleteDraft.isPending || $[5] !== onOpenChange) {
|
|
1691
|
-
|
|
1512
|
+
t3 = (next) => {
|
|
1692
1513
|
if (!deleteDraft.isPending) onOpenChange(next);
|
|
1693
1514
|
};
|
|
1694
1515
|
$[4] = deleteDraft.isPending;
|
|
1695
1516
|
$[5] = onOpenChange;
|
|
1696
|
-
$[6] =
|
|
1697
|
-
} else
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
let t8;
|
|
1707
|
-
if ($[9] !== t7) {
|
|
1708
|
-
t8 = /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [t7, " deleted for everyone. Live stays as it is. This can't be undone."] });
|
|
1709
|
-
$[9] = t7;
|
|
1710
|
-
$[10] = t8;
|
|
1711
|
-
} else t8 = $[10];
|
|
1712
|
-
let t9;
|
|
1713
|
-
if ($[11] !== t6 || $[12] !== t8) {
|
|
1714
|
-
t9 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t6, t8] });
|
|
1715
|
-
$[11] = t6;
|
|
1716
|
-
$[12] = t8;
|
|
1717
|
-
$[13] = t9;
|
|
1718
|
-
} else t9 = $[13];
|
|
1719
|
-
let t10;
|
|
1720
|
-
if ($[14] !== deleteDraft.isPending) {
|
|
1721
|
-
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, {
|
|
1722
1527
|
variant: "outline",
|
|
1723
1528
|
size: "default",
|
|
1724
1529
|
disabled: deleteDraft.isPending,
|
|
1725
1530
|
children: "Cancel"
|
|
1726
1531
|
});
|
|
1727
|
-
$[
|
|
1728
|
-
$[
|
|
1729
|
-
} else
|
|
1730
|
-
let
|
|
1731
|
-
if ($[
|
|
1732
|
-
|
|
1733
|
-
$[
|
|
1734
|
-
$[
|
|
1735
|
-
$[
|
|
1736
|
-
} else
|
|
1737
|
-
let
|
|
1738
|
-
if ($[
|
|
1739
|
-
|
|
1740
|
-
$[
|
|
1741
|
-
$[
|
|
1742
|
-
} else
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
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, {
|
|
1747
1551
|
variant: "destructive",
|
|
1748
1552
|
disabled: deleteDraft.isPending,
|
|
1749
|
-
onClick:
|
|
1750
|
-
children: [
|
|
1553
|
+
onClick: t6,
|
|
1554
|
+
children: [t7, "Delete draft"]
|
|
1751
1555
|
});
|
|
1752
|
-
$[
|
|
1753
|
-
$[
|
|
1754
|
-
$[
|
|
1755
|
-
$[
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
$[
|
|
1762
|
-
$[
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
t16 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t9, t15] });
|
|
1768
|
-
$[29] = t15;
|
|
1769
|
-
$[30] = t9;
|
|
1770
|
-
$[31] = t16;
|
|
1771
|
-
} else t16 = $[31];
|
|
1772
|
-
let t17;
|
|
1773
|
-
if ($[32] !== open || $[33] !== t16 || $[34] !== t4) {
|
|
1774
|
-
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, {
|
|
1775
1571
|
open,
|
|
1776
|
-
onOpenChange:
|
|
1777
|
-
children:
|
|
1572
|
+
onOpenChange: t3,
|
|
1573
|
+
children: t9
|
|
1778
1574
|
});
|
|
1779
|
-
$[
|
|
1780
|
-
$[
|
|
1781
|
-
$[
|
|
1782
|
-
$[
|
|
1783
|
-
} else
|
|
1784
|
-
return
|
|
1575
|
+
$[22] = open;
|
|
1576
|
+
$[23] = t3;
|
|
1577
|
+
$[24] = t9;
|
|
1578
|
+
$[25] = t10;
|
|
1579
|
+
} else t10 = $[25];
|
|
1580
|
+
return t10;
|
|
1785
1581
|
}
|
|
1786
|
-
function
|
|
1582
|
+
function _temp13(error) {
|
|
1787
1583
|
return toast.error(error.message || "Could not delete the draft");
|
|
1788
1584
|
}
|
|
1789
1585
|
|
|
1790
1586
|
//#endregion
|
|
1791
|
-
export { DeleteDraftDialog, ReviewDraftSheet
|
|
1587
|
+
export { DeleteDraftDialog, ReviewDraftSheet };
|