camox 0.28.0 → 0.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,8 @@ import * as React from "react";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
10
10
  import { Button } from "@camox/ui/button";
11
- import { ChevronDown, Download, Upload } from "lucide-react";
11
+ import { AlertCircle, ChevronDown, Download, Upload } from "lucide-react";
12
+ import { Alert, AlertDescription } from "@camox/ui/alert";
12
13
  import { Badge } from "@camox/ui/badge";
13
14
  import { Separator } from "@camox/ui/separator";
14
15
  import { Spinner } from "@camox/ui/spinner";
@@ -34,10 +35,10 @@ function formatReason(reason, direction) {
34
35
  }
35
36
  }
36
37
  const EnvironmentMenu = () => {
37
- const $ = c(80);
38
- if ($[0] !== "1f0c4a40f8c8f7e8cc223d91ecc208bcc158a215f699a477b4952e9fe211174f") {
39
- for (let $i = 0; $i < 80; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
40
- $[0] = "1f0c4a40f8c8f7e8cc223d91ecc208bcc158a215f699a477b4952e9fe211174f";
38
+ const $ = c(84);
39
+ if ($[0] !== "42128d7498b871de7c9ecaaeb2e1b0e858fc9e8ce0ed44b99ccfaf471a4c55ca") {
40
+ for (let $i = 0; $i < 84; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
41
+ $[0] = "42128d7498b871de7c9ecaaeb2e1b0e858fc9e8ce0ed44b99ccfaf471a4c55ca";
41
42
  }
42
43
  const [open, setOpen] = React.useState(false);
43
44
  const [pendingDirection, setPendingDirection] = React.useState(null);
@@ -163,72 +164,75 @@ const EnvironmentMenu = () => {
163
164
  $[29] = t13;
164
165
  } else t13 = $[29];
165
166
  const handleConfirm = t13;
167
+ const pushReason = pushCheck.data && !pushCheck.data.compatible ? pushCheck.data.reasons[0] : null;
168
+ const pullReason = pullCheck.data && !pullCheck.data.compatible ? pullCheck.data.reasons[0] : null;
166
169
  let t14;
167
- if ($[30] !== pullCheck || $[31] !== pushCheck || $[32] !== replicate.isPending) {
168
- t14 = (direction) => {
170
+ if ($[30] !== pullReason || $[31] !== pushReason) {
171
+ t14 = pushReason ? formatReason(pushReason, "push") : pullReason ? formatReason(pullReason, "pull") : null;
172
+ $[30] = pullReason;
173
+ $[31] = pushReason;
174
+ $[32] = t14;
175
+ } else t14 = $[32];
176
+ const firstCompatibilityError = t14;
177
+ let t15;
178
+ if ($[33] !== pullCheck || $[34] !== pushCheck || $[35] !== replicate.isPending) {
179
+ t15 = (direction) => {
169
180
  const check = direction === "push" ? pushCheck : pullCheck;
170
181
  const checking = check.isLoading;
171
182
  const compatible = check.data?.compatible ?? false;
172
- const reason = check.data && !check.data.compatible ? check.data.reasons[0] : null;
173
183
  const Icon = direction === "push" ? Upload : Download;
174
184
  const actionLabel = direction === "push" ? "Push to production" : "Pull from production";
175
- return /* @__PURE__ */ jsxs("div", {
176
- className: "flex flex-col gap-1",
177
- children: [/* @__PURE__ */ jsxs(Button, {
178
- variant: "outline",
179
- size: "sm",
180
- className: "w-full justify-start gap-2",
181
- disabled: checking || !compatible || replicate.isPending,
182
- onClick: () => setPendingDirection(direction),
183
- children: [checking ? /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" }) : /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground size-4" }), /* @__PURE__ */ jsx("span", { children: actionLabel })]
184
- }), reason ? /* @__PURE__ */ jsx("p", {
185
- className: "text-destructive text-xs leading-tight",
186
- children: formatReason(reason, direction)
187
- }) : null]
185
+ return /* @__PURE__ */ jsxs(Button, {
186
+ variant: "outline",
187
+ size: "sm",
188
+ className: "w-full justify-start gap-2",
189
+ disabled: checking || !compatible || replicate.isPending,
190
+ onClick: () => setPendingDirection(direction),
191
+ children: [checking ? /* @__PURE__ */ jsx(Spinner, { className: "text-muted-foreground" }) : /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground size-4" }), /* @__PURE__ */ jsx("span", { children: actionLabel })]
188
192
  });
189
193
  };
190
- $[30] = pullCheck;
191
- $[31] = pushCheck;
192
- $[32] = replicate.isPending;
193
- $[33] = t14;
194
- } else t14 = $[33];
195
- const renderActionButton = t14;
196
- let t15;
197
- if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
198
- t15 = /* @__PURE__ */ jsx(Button, {
194
+ $[33] = pullCheck;
195
+ $[34] = pushCheck;
196
+ $[35] = replicate.isPending;
197
+ $[36] = t15;
198
+ } else t15 = $[36];
199
+ const renderActionButton = t15;
200
+ let t16;
201
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
202
+ t16 = /* @__PURE__ */ jsx(Button, {
199
203
  variant: "ghost",
200
204
  className: "gap-2"
201
205
  });
202
- $[34] = t15;
203
- } else t15 = $[34];
204
- let t16;
205
- if ($[35] !== badgeClassName || $[36] !== label) {
206
- t16 = /* @__PURE__ */ jsx(Badge, {
206
+ $[37] = t16;
207
+ } else t16 = $[37];
208
+ let t17;
209
+ if ($[38] !== badgeClassName || $[39] !== label) {
210
+ t17 = /* @__PURE__ */ jsx(Badge, {
207
211
  variant: "secondary",
208
212
  className: badgeClassName,
209
213
  children: label
210
214
  });
211
- $[35] = badgeClassName;
212
- $[36] = label;
213
- $[37] = t16;
214
- } else t16 = $[37];
215
- let t17;
216
- if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
217
- t17 = /* @__PURE__ */ jsx(ChevronDown, { className: "shrink-0 opacity-50" });
218
- $[38] = t17;
219
- } else t17 = $[38];
215
+ $[38] = badgeClassName;
216
+ $[39] = label;
217
+ $[40] = t17;
218
+ } else t17 = $[40];
220
219
  let t18;
221
- if ($[39] !== t16) {
222
- t18 = /* @__PURE__ */ jsxs(PopoverTrigger, {
223
- render: t15,
224
- children: [t16, t17]
225
- });
226
- $[39] = t16;
227
- $[40] = t18;
228
- } else t18 = $[40];
220
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
221
+ t18 = /* @__PURE__ */ jsx(ChevronDown, { className: "shrink-0 opacity-50" });
222
+ $[41] = t18;
223
+ } else t18 = $[41];
229
224
  let t19;
230
- if ($[41] !== isProduction || $[42] !== renderActionButton) {
231
- t19 = /* @__PURE__ */ jsx(PopoverContent, {
225
+ if ($[42] !== t17) {
226
+ t19 = /* @__PURE__ */ jsxs(PopoverTrigger, {
227
+ render: t16,
228
+ children: [t17, t18]
229
+ });
230
+ $[42] = t17;
231
+ $[43] = t19;
232
+ } else t19 = $[43];
233
+ let t20;
234
+ if ($[44] !== firstCompatibilityError || $[45] !== isProduction || $[46] !== renderActionButton) {
235
+ t20 = /* @__PURE__ */ jsx(PopoverContent, {
232
236
  className: "w-96 p-0",
233
237
  align: "start",
234
238
  side: "bottom",
@@ -249,46 +253,55 @@ const EnvironmentMenu = () => {
249
253
  }),
250
254
  /* @__PURE__ */ jsxs("div", {
251
255
  className: "flex flex-col gap-2 px-4",
252
- children: [renderActionButton("push"), renderActionButton("pull")]
256
+ children: [
257
+ renderActionButton("push"),
258
+ renderActionButton("pull"),
259
+ firstCompatibilityError ? /* @__PURE__ */ jsxs(Alert, {
260
+ variant: "destructive",
261
+ className: "mt-1",
262
+ children: [/* @__PURE__ */ jsx(AlertCircle, { className: "size-4" }), /* @__PURE__ */ jsx(AlertDescription, { children: firstCompatibilityError })]
263
+ }) : null
264
+ ]
253
265
  })
254
266
  ] })
255
267
  })
256
268
  });
257
- $[41] = isProduction;
258
- $[42] = renderActionButton;
259
- $[43] = t19;
260
- } else t19 = $[43];
261
- let t20;
262
- if ($[44] !== open || $[45] !== t18 || $[46] !== t19) {
263
- t20 = /* @__PURE__ */ jsxs(Popover, {
269
+ $[44] = firstCompatibilityError;
270
+ $[45] = isProduction;
271
+ $[46] = renderActionButton;
272
+ $[47] = t20;
273
+ } else t20 = $[47];
274
+ let t21;
275
+ if ($[48] !== open || $[49] !== t19 || $[50] !== t20) {
276
+ t21 = /* @__PURE__ */ jsxs(Popover, {
264
277
  open,
265
278
  onOpenChange: setOpen,
266
- children: [t18, t19]
279
+ children: [t19, t20]
267
280
  });
268
- $[44] = open;
269
- $[45] = t18;
270
- $[46] = t19;
271
- $[47] = t20;
272
- } else t20 = $[47];
273
- const t21 = !!pendingDirection;
274
- let t22;
275
- if ($[48] !== replicate.isPending) {
276
- t22 = (o) => {
281
+ $[48] = open;
282
+ $[49] = t19;
283
+ $[50] = t20;
284
+ $[51] = t21;
285
+ } else t21 = $[51];
286
+ const t22 = !!pendingDirection;
287
+ let t23;
288
+ if ($[52] !== replicate.isPending) {
289
+ t23 = (o) => {
277
290
  if (!o && !replicate.isPending) setPendingDirection(null);
278
291
  };
279
- $[48] = replicate.isPending;
280
- $[49] = t22;
281
- } else t22 = $[49];
282
- const t23 = pendingDirection === "push" ? "Push to production?" : "Pull from production?";
283
- let t24;
284
- if ($[50] !== t23) {
285
- t24 = /* @__PURE__ */ jsx(AlertDialogTitle, { children: t23 });
286
- $[50] = t23;
287
- $[51] = t24;
288
- } else t24 = $[51];
292
+ $[52] = replicate.isPending;
293
+ $[53] = t23;
294
+ } else t23 = $[53];
295
+ const t24 = pendingDirection === "push" ? "Push to production?" : "Pull from production?";
289
296
  let t25;
290
- if ($[52] !== environmentName || $[53] !== pendingDirection) {
291
- t25 = /* @__PURE__ */ jsx(AlertDialogDescription, { children: pendingDirection === "push" ? /* @__PURE__ */ jsxs(Fragment, { children: [
297
+ if ($[54] !== t24) {
298
+ t25 = /* @__PURE__ */ jsx(AlertDialogTitle, { children: t24 });
299
+ $[54] = t24;
300
+ $[55] = t25;
301
+ } else t25 = $[55];
302
+ let t26;
303
+ if ($[56] !== environmentName || $[57] !== pendingDirection) {
304
+ t26 = /* @__PURE__ */ jsx(AlertDialogDescription, { children: pendingDirection === "push" ? /* @__PURE__ */ jsxs(Fragment, { children: [
292
305
  "This will replace all content in",
293
306
  " ",
294
307
  /* @__PURE__ */ jsx("span", {
@@ -316,83 +329,83 @@ const EnvironmentMenu = () => {
316
329
  }),
317
330
  ". This action cannot be undone."
318
331
  ] }) });
319
- $[52] = environmentName;
320
- $[53] = pendingDirection;
321
- $[54] = t25;
322
- } else t25 = $[54];
323
- let t26;
324
- if ($[55] !== t24 || $[56] !== t25) {
325
- t26 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t24, t25] });
326
- $[55] = t24;
327
- $[56] = t25;
328
- $[57] = t26;
329
- } else t26 = $[57];
332
+ $[56] = environmentName;
333
+ $[57] = pendingDirection;
334
+ $[58] = t26;
335
+ } else t26 = $[58];
330
336
  let t27;
331
- if ($[58] !== replicate.isPending) {
332
- t27 = /* @__PURE__ */ jsx(AlertDialogCancel, {
337
+ if ($[59] !== t25 || $[60] !== t26) {
338
+ t27 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t25, t26] });
339
+ $[59] = t25;
340
+ $[60] = t26;
341
+ $[61] = t27;
342
+ } else t27 = $[61];
343
+ let t28;
344
+ if ($[62] !== replicate.isPending) {
345
+ t28 = /* @__PURE__ */ jsx(AlertDialogCancel, {
333
346
  variant: "outline",
334
347
  size: "default",
335
348
  disabled: replicate.isPending,
336
349
  children: "Cancel"
337
350
  });
338
- $[58] = replicate.isPending;
339
- $[59] = t27;
340
- } else t27 = $[59];
341
- let t28;
342
- if ($[60] !== replicate.isPending) {
343
- t28 = replicate.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
344
- $[60] = replicate.isPending;
345
- $[61] = t28;
346
- } else t28 = $[61];
347
- const t29 = pendingDirection === "push" ? "Push" : "Pull";
348
- let t30;
349
- if ($[62] !== handleConfirm || $[63] !== replicate.isPending || $[64] !== t28 || $[65] !== t29) {
350
- t30 = /* @__PURE__ */ jsxs(AlertDialogAction, {
351
+ $[62] = replicate.isPending;
352
+ $[63] = t28;
353
+ } else t28 = $[63];
354
+ let t29;
355
+ if ($[64] !== replicate.isPending) {
356
+ t29 = replicate.isPending ? /* @__PURE__ */ jsx(Spinner, {}) : null;
357
+ $[64] = replicate.isPending;
358
+ $[65] = t29;
359
+ } else t29 = $[65];
360
+ const t30 = pendingDirection === "push" ? "Push" : "Pull";
361
+ let t31;
362
+ if ($[66] !== handleConfirm || $[67] !== replicate.isPending || $[68] !== t29 || $[69] !== t30) {
363
+ t31 = /* @__PURE__ */ jsxs(AlertDialogAction, {
351
364
  variant: "destructive",
352
365
  onClick: handleConfirm,
353
366
  disabled: replicate.isPending,
354
- children: [t28, t29]
367
+ children: [t29, t30]
355
368
  });
356
- $[62] = handleConfirm;
357
- $[63] = replicate.isPending;
358
- $[64] = t28;
359
- $[65] = t29;
360
- $[66] = t30;
361
- } else t30 = $[66];
362
- let t31;
363
- if ($[67] !== t27 || $[68] !== t30) {
364
- t31 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t27, t30] });
365
- $[67] = t27;
366
- $[68] = t30;
367
- $[69] = t31;
368
- } else t31 = $[69];
369
+ $[66] = handleConfirm;
370
+ $[67] = replicate.isPending;
371
+ $[68] = t29;
372
+ $[69] = t30;
373
+ $[70] = t31;
374
+ } else t31 = $[70];
369
375
  let t32;
370
- if ($[70] !== t26 || $[71] !== t31) {
371
- t32 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t26, t31] });
372
- $[70] = t26;
373
- $[71] = t31;
374
- $[72] = t32;
375
- } else t32 = $[72];
376
+ if ($[71] !== t28 || $[72] !== t31) {
377
+ t32 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t28, t31] });
378
+ $[71] = t28;
379
+ $[72] = t31;
380
+ $[73] = t32;
381
+ } else t32 = $[73];
376
382
  let t33;
377
- if ($[73] !== t21 || $[74] !== t22 || $[75] !== t32) {
378
- t33 = /* @__PURE__ */ jsx(AlertDialog, {
379
- open: t21,
380
- onOpenChange: t22,
381
- children: t32
382
- });
383
- $[73] = t21;
384
- $[74] = t22;
383
+ if ($[74] !== t27 || $[75] !== t32) {
384
+ t33 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t27, t32] });
385
+ $[74] = t27;
385
386
  $[75] = t32;
386
387
  $[76] = t33;
387
388
  } else t33 = $[76];
388
389
  let t34;
389
- if ($[77] !== t20 || $[78] !== t33) {
390
- t34 = /* @__PURE__ */ jsxs(Fragment, { children: [t20, t33] });
391
- $[77] = t20;
392
- $[78] = t33;
393
- $[79] = t34;
394
- } else t34 = $[79];
395
- return t34;
390
+ if ($[77] !== t22 || $[78] !== t23 || $[79] !== t33) {
391
+ t34 = /* @__PURE__ */ jsx(AlertDialog, {
392
+ open: t22,
393
+ onOpenChange: t23,
394
+ children: t33
395
+ });
396
+ $[77] = t22;
397
+ $[78] = t23;
398
+ $[79] = t33;
399
+ $[80] = t34;
400
+ } else t34 = $[80];
401
+ let t35;
402
+ if ($[81] !== t21 || $[82] !== t34) {
403
+ t35 = /* @__PURE__ */ jsxs(Fragment, { children: [t21, t34] });
404
+ $[81] = t21;
405
+ $[82] = t34;
406
+ $[83] = t35;
407
+ } else t35 = $[83];
408
+ return t35;
396
409
  };
397
410
 
398
411
  //#endregion