@gallop.software/studio 0.1.106 → 0.1.108

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.
@@ -358,7 +358,20 @@ function ProgressModal({
358
358
  " before stopping."
359
359
  ] }) : isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
360
360
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { css: styles.message, children: [
361
- progress.isScan ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
361
+ progress.isMove ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
362
+ "Moved ",
363
+ progress.processed,
364
+ " file",
365
+ progress.processed !== 1 ? "s" : "",
366
+ ".",
367
+ progress.errors !== void 0 && progress.errors > 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
368
+ " ",
369
+ progress.errors,
370
+ " error",
371
+ progress.errors !== 1 ? "s" : "",
372
+ " occurred."
373
+ ] }) : null
374
+ ] }) : progress.isScan ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
362
375
  progress.alreadyProcessed !== void 0 && progress.alreadyProcessed > 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
363
376
  progress.alreadyProcessed,
364
377
  " image",
@@ -388,13 +401,6 @@ function ProgressModal({
388
401
  " orphaned thumbnail",
389
402
  progress.orphansRemoved !== 1 ? "s" : "",
390
403
  "."
391
- ] }) : null,
392
- progress.errors !== void 0 && progress.errors > 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
393
- " ",
394
- progress.errors,
395
- " error",
396
- progress.errors !== 1 ? "s" : "",
397
- " occurred."
398
404
  ] }) : null
399
405
  ] }),
400
406
  progress.errorMessages && progress.errorMessages.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { css: progressStyles.errorList, children: [
@@ -2306,34 +2312,76 @@ function StudioToolbar() {
2306
2312
  setShowMoveModal(true);
2307
2313
  }, [selectedItems]);
2308
2314
  const handleMoveConfirm = _react.useCallback.call(void 0, async (destination) => {
2315
+ const paths = Array.from(selectedItems);
2316
+ setProgressTitle("Moving Files");
2317
+ setShowProgress(true);
2318
+ setProgressState({
2319
+ current: 0,
2320
+ total: paths.length,
2321
+ percent: 0,
2322
+ status: "processing"
2323
+ });
2309
2324
  try {
2310
2325
  const response = await fetch("/api/studio/move", {
2311
2326
  method: "POST",
2312
2327
  headers: { "Content-Type": "application/json" },
2313
- body: JSON.stringify({ paths: Array.from(selectedItems), destination })
2328
+ body: JSON.stringify({ paths, destination })
2314
2329
  });
2315
- const data = await response.json();
2316
- if (response.ok) {
2317
- clearSelection();
2318
- triggerRefresh();
2319
- if (data.errors && data.errors.length > 0) {
2320
- setAlertMessage({
2321
- title: "Move Completed with Errors",
2322
- message: data.errors.join("\n")
2323
- });
2330
+ if (!response.body) {
2331
+ throw new Error("No response body");
2332
+ }
2333
+ const reader = response.body.getReader();
2334
+ const decoder = new TextDecoder();
2335
+ let buffer = "";
2336
+ while (true) {
2337
+ const { done, value } = await reader.read();
2338
+ if (done) break;
2339
+ buffer += decoder.decode(value, { stream: true });
2340
+ const lines = buffer.split("\n\n");
2341
+ buffer = lines.pop() || "";
2342
+ for (const line of lines) {
2343
+ if (!line.startsWith("data: ")) continue;
2344
+ try {
2345
+ const data = JSON.parse(line.slice(6));
2346
+ if (data.type === "start") {
2347
+ setProgressState((prev) => ({ ...prev, total: data.total }));
2348
+ } else if (data.type === "progress") {
2349
+ setProgressState({
2350
+ current: data.current,
2351
+ total: data.total,
2352
+ percent: data.percent,
2353
+ currentFile: data.currentFile,
2354
+ status: "processing"
2355
+ });
2356
+ } else if (data.type === "complete") {
2357
+ setProgressState((prev) => ({
2358
+ ...prev,
2359
+ status: "complete",
2360
+ processed: data.moved,
2361
+ errors: data.errors,
2362
+ errorMessages: data.errorMessages,
2363
+ isMove: true
2364
+ }));
2365
+ clearSelection();
2366
+ triggerRefresh();
2367
+ } else if (data.type === "error") {
2368
+ setProgressState((prev) => ({
2369
+ ...prev,
2370
+ status: "error",
2371
+ errorMessage: data.message
2372
+ }));
2373
+ }
2374
+ } catch (e4) {
2375
+ }
2324
2376
  }
2325
- } else {
2326
- setAlertMessage({
2327
- title: "Move Failed",
2328
- message: data.error || "Unknown error"
2329
- });
2330
2377
  }
2331
2378
  } catch (error) {
2332
2379
  console.error("Move error:", error);
2333
- setAlertMessage({
2334
- title: "Move Failed",
2335
- message: "Failed to move items. Check console for details."
2336
- });
2380
+ setProgressState((prev) => ({
2381
+ ...prev,
2382
+ status: "error",
2383
+ errorMessage: "Failed to move items. Check console for details."
2384
+ }));
2337
2385
  }
2338
2386
  }, [selectedItems, clearSelection, triggerRefresh]);
2339
2387
  const { searchQuery, setSearchQuery } = useStudio();
@@ -2348,7 +2396,7 @@ function StudioToolbar() {
2348
2396
  }
2349
2397
  }, [setSearchQuery]);
2350
2398
  const hasSelection = selectedItems.size > 0;
2351
- const hasCloudOnlySelection = hasSelection && Array.from(selectedItems).some((path) => {
2399
+ const hasCloudSelection = hasSelection && Array.from(selectedItems).some((path) => {
2352
2400
  const item = fileItems.find((f) => f.path === path);
2353
2401
  return item && item.cdnPushed;
2354
2402
  });
@@ -2555,8 +2603,7 @@ function StudioToolbar() {
2555
2603
  {
2556
2604
  css: styles5.btn,
2557
2605
  onClick: handleMoveClick,
2558
- disabled: !hasSelection || hasCloudOnlySelection,
2559
- title: hasCloudOnlySelection ? "Cannot move files that are in the cloud" : void 0,
2606
+ disabled: !hasSelection,
2560
2607
  children: [
2561
2608
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MoveIcon, {}),
2562
2609
  "Move"
@@ -2568,8 +2615,8 @@ function StudioToolbar() {
2568
2615
  {
2569
2616
  css: styles5.btn,
2570
2617
  onClick: handleSyncClick,
2571
- disabled: !hasSelection || hasCloudOnlySelection,
2572
- title: hasCloudOnlySelection ? "Selected files are already in the cloud" : void 0,
2618
+ disabled: !hasSelection || hasCloudSelection,
2619
+ title: hasCloudSelection ? "Selected files are already in the cloud" : void 0,
2573
2620
  children: [
2574
2621
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CloudIcon, {}),
2575
2622
  "Push CDN"
@@ -4421,7 +4468,7 @@ function StudioDetailView() {
4421
4468
  try {
4422
4469
  const data = JSON.parse(line.slice(6));
4423
4470
  setProcessProgress(data);
4424
- } catch (e4) {
4471
+ } catch (e5) {
4425
4472
  }
4426
4473
  }
4427
4474
  }
@@ -5567,4 +5614,4 @@ var StudioUI_default = StudioUI;
5567
5614
 
5568
5615
 
5569
5616
  exports.StudioUI = StudioUI; exports.default = StudioUI_default;
5570
- //# sourceMappingURL=StudioUI-4MJ3CHCX.js.map
5617
+ //# sourceMappingURL=StudioUI-JE22LQN7.js.map