@gallop.software/studio 1.5.0 → 1.5.1

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.
@@ -4282,7 +4282,14 @@ function StudioDetailView() {
4282
4282
  const [showR2SetupModal, setShowR2SetupModal] = _react.useState.call(void 0, false);
4283
4283
  const [alertMessage, setAlertMessage] = _react.useState.call(void 0, null);
4284
4284
  const [showCopied, setShowCopied] = _react.useState.call(void 0, false);
4285
- const [generatingFavicon, setGeneratingFavicon] = _react.useState.call(void 0, false);
4285
+ const [showFaviconProgress, setShowFaviconProgress] = _react.useState.call(void 0, false);
4286
+ const [faviconProgress, setFaviconProgress] = _react.useState.call(void 0, {
4287
+ current: 0,
4288
+ total: 3,
4289
+ percent: 0,
4290
+ status: "processing",
4291
+ message: "Generating favicons..."
4292
+ });
4286
4293
  const isActionInProgress = actionState.showProgress;
4287
4294
  const isFaviconSource = focusedItem ? focusedItem.name.toLowerCase() === "favicon.png" || focusedItem.name.toLowerCase() === "favicon.jpg" : false;
4288
4295
  if (!focusedItem) return null;
@@ -4333,7 +4340,14 @@ function StudioDetailView() {
4333
4340
  };
4334
4341
  const handleGenerateFavicons = async () => {
4335
4342
  if (!focusedItem) return;
4336
- setGeneratingFavicon(true);
4343
+ setShowFaviconProgress(true);
4344
+ setFaviconProgress({
4345
+ current: 0,
4346
+ total: 3,
4347
+ percent: 0,
4348
+ status: "processing",
4349
+ message: "Generating favicons..."
4350
+ });
4337
4351
  try {
4338
4352
  const response = await fetch("/api/studio/generate-favicon", {
4339
4353
  method: "POST",
@@ -4342,26 +4356,74 @@ function StudioDetailView() {
4342
4356
  imagePath: "/" + focusedItem.path.replace(/^public\//, "")
4343
4357
  })
4344
4358
  });
4345
- const data = await response.json();
4346
- if (response.ok && data.success) {
4347
- setAlertMessage({
4348
- title: "Favicons Generated",
4349
- message: data.message + " Files saved to src/app/"
4350
- });
4351
- } else {
4352
- setAlertMessage({
4353
- title: "Generation Failed",
4354
- message: data.error || data.message || "Failed to generate favicons"
4359
+ if (!response.ok) {
4360
+ const error = await response.json();
4361
+ setFaviconProgress({
4362
+ current: 0,
4363
+ total: 3,
4364
+ percent: 0,
4365
+ status: "error",
4366
+ message: error.error || "Failed to generate favicons"
4355
4367
  });
4368
+ return;
4369
+ }
4370
+ const reader = _optionalChain([response, 'access', _42 => _42.body, 'optionalAccess', _43 => _43.getReader, 'call', _44 => _44()]);
4371
+ const decoder = new TextDecoder();
4372
+ if (reader) {
4373
+ let buffer = "";
4374
+ while (true) {
4375
+ const { done, value } = await reader.read();
4376
+ if (done) break;
4377
+ buffer += decoder.decode(value, { stream: true });
4378
+ const lines = buffer.split("\n");
4379
+ buffer = lines.pop() || "";
4380
+ for (const line of lines) {
4381
+ if (line.startsWith("data: ")) {
4382
+ try {
4383
+ const data = JSON.parse(line.slice(6));
4384
+ if (data.type === "start") {
4385
+ setFaviconProgress((prev) => ({
4386
+ ...prev,
4387
+ total: data.total
4388
+ }));
4389
+ } else if (data.type === "progress") {
4390
+ setFaviconProgress({
4391
+ current: data.current,
4392
+ total: data.total,
4393
+ percent: data.percent,
4394
+ status: "processing",
4395
+ message: data.message
4396
+ });
4397
+ } else if (data.type === "complete") {
4398
+ setFaviconProgress({
4399
+ current: data.processed,
4400
+ total: data.processed,
4401
+ percent: 100,
4402
+ status: data.errors > 0 ? "error" : "complete",
4403
+ message: data.message
4404
+ });
4405
+ } else if (data.type === "error") {
4406
+ setFaviconProgress((prev) => ({
4407
+ ...prev,
4408
+ status: "error",
4409
+ message: data.message
4410
+ }));
4411
+ }
4412
+ } catch (e4) {
4413
+ }
4414
+ }
4415
+ }
4416
+ }
4356
4417
  }
4357
4418
  } catch (error) {
4358
4419
  console.error("Favicon generation error:", error);
4359
- setAlertMessage({
4360
- title: "Generation Failed",
4420
+ setFaviconProgress({
4421
+ current: 0,
4422
+ total: 3,
4423
+ percent: 0,
4424
+ status: "error",
4361
4425
  message: "An error occurred while generating favicons"
4362
4426
  });
4363
- } finally {
4364
- setGeneratingFavicon(false);
4365
4427
  }
4366
4428
  };
4367
4429
  const renderMedia = () => {
@@ -4404,6 +4466,14 @@ function StudioDetailView() {
4404
4466
  onCancel: () => setShowRenameModal(false)
4405
4467
  }
4406
4468
  ),
4469
+ showFaviconProgress && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4470
+ ProgressModal,
4471
+ {
4472
+ title: "Generating Favicons",
4473
+ progress: faviconProgress,
4474
+ onClose: () => setShowFaviconProgress(false)
4475
+ }
4476
+ ),
4407
4477
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { css: styles8.overlay, onClick: handleClose, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { css: styles8.container, onClick: (e) => e.stopPropagation(), children: [
4408
4478
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { css: styles8.main, children: [
4409
4479
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { css: styles8.headerButtons, children: [
@@ -4515,10 +4585,10 @@ function StudioDetailView() {
4515
4585
  {
4516
4586
  css: styles8.actionBtn,
4517
4587
  onClick: handleGenerateFavicons,
4518
- disabled: generatingFavicon || focusedItem.isProtected,
4588
+ disabled: showFaviconProgress || focusedItem.isProtected,
4519
4589
  children: [
4520
4590
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { css: styles8.actionIcon, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" }) }),
4521
- generatingFavicon ? "Generating..." : "Generate Favicons"
4591
+ "Generate Favicons"
4522
4592
  ]
4523
4593
  }
4524
4594
  ),
@@ -5261,7 +5331,7 @@ function useStudioActions({
5261
5331
  });
5262
5332
  return;
5263
5333
  }
5264
- const reader = _optionalChain([response, 'access', _42 => _42.body, 'optionalAccess', _43 => _43.getReader, 'call', _44 => _44()]);
5334
+ const reader = _optionalChain([response, 'access', _45 => _45.body, 'optionalAccess', _46 => _46.getReader, 'call', _47 => _47()]);
5265
5335
  const decoder = new TextDecoder();
5266
5336
  if (reader) {
5267
5337
  let buffer = "";
@@ -5291,7 +5361,7 @@ function useStudioActions({
5291
5361
  status: "complete",
5292
5362
  message: `Moved ${data.moved} file${data.moved !== 1 ? "s" : ""}${data.errors > 0 ? `, ${data.errors} error${data.errors !== 1 ? "s" : ""}` : ""}`
5293
5363
  }));
5294
- if (data.errors > 0 && _optionalChain([data, 'access', _45 => _45.errorMessages, 'optionalAccess', _46 => _46.length]) > 0) {
5364
+ if (data.errors > 0 && _optionalChain([data, 'access', _48 => _48.errorMessages, 'optionalAccess', _49 => _49.length]) > 0) {
5295
5365
  showError("Move Failed", data.errorMessages.join("\n"));
5296
5366
  }
5297
5367
  clearSelection();
@@ -5304,7 +5374,7 @@ function useStudioActions({
5304
5374
  message: data.message || "Unknown error"
5305
5375
  }));
5306
5376
  }
5307
- } catch (e4) {
5377
+ } catch (e5) {
5308
5378
  }
5309
5379
  }
5310
5380
  }
@@ -5419,7 +5489,7 @@ function useStudioActions({
5419
5489
  });
5420
5490
  return;
5421
5491
  }
5422
- const reader = _optionalChain([response, 'access', _47 => _47.body, 'optionalAccess', _48 => _48.getReader, 'call', _49 => _49()]);
5492
+ const reader = _optionalChain([response, 'access', _50 => _50.body, 'optionalAccess', _51 => _51.getReader, 'call', _52 => _52()]);
5423
5493
  const decoder = new TextDecoder();
5424
5494
  if (reader) {
5425
5495
  let buffer = "";
@@ -5468,7 +5538,7 @@ function useStudioActions({
5468
5538
  message: data.message
5469
5539
  }));
5470
5540
  }
5471
- } catch (e5) {
5541
+ } catch (e6) {
5472
5542
  }
5473
5543
  }
5474
5544
  }
@@ -5508,7 +5578,7 @@ function useStudioActions({
5508
5578
  setProgressState((prev) => ({
5509
5579
  ...prev,
5510
5580
  orphanedFiles: void 0,
5511
- message: _optionalChain([prev, 'access', _50 => _50.message, 'optionalAccess', _51 => _51.replace, 'call', _52 => _52(/Found \d+ orphaned thumbnail\(s\).*/, "Orphaned thumbnails deleted.")])
5581
+ message: _optionalChain([prev, 'access', _53 => _53.message, 'optionalAccess', _54 => _54.replace, 'call', _55 => _55(/Found \d+ orphaned thumbnail\(s\).*/, "Orphaned thumbnails deleted.")])
5512
5582
  }));
5513
5583
  triggerRefresh();
5514
5584
  } else {
@@ -6151,4 +6221,4 @@ var StudioUI_default = StudioUI;
6151
6221
 
6152
6222
 
6153
6223
  exports.StudioUI = StudioUI; exports.default = StudioUI_default;
6154
- //# sourceMappingURL=StudioUI-MZENRXN3.js.map
6224
+ //# sourceMappingURL=StudioUI-GULMXZQF.js.map