@gallop.software/studio 0.1.95 → 0.1.97

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.
@@ -62,6 +62,9 @@ var defaultState = {
62
62
  showError: () => {
63
63
  },
64
64
  clearError: () => {
65
+ },
66
+ fileItems: [],
67
+ setFileItems: () => {
65
68
  }
66
69
  };
67
70
  var StudioContext = createContext(defaultState);
@@ -1681,7 +1684,7 @@ var styles5 = {
1681
1684
  `
1682
1685
  };
1683
1686
  function StudioToolbar() {
1684
- const { selectedItems, viewMode, setViewMode, clearSelection, currentPath, triggerRefresh, focusedItem, scanRequested, clearScanRequest } = useStudio();
1687
+ const { selectedItems, viewMode, setViewMode, clearSelection, currentPath, triggerRefresh, focusedItem, scanRequested, clearScanRequest, fileItems } = useStudio();
1685
1688
  const fileInputRef = useRef2(null);
1686
1689
  const abortControllerRef = useRef2(null);
1687
1690
  const [showAddNewModal, setShowAddNewModal] = useState4(false);
@@ -2345,6 +2348,10 @@ function StudioToolbar() {
2345
2348
  }
2346
2349
  }, [setSearchQuery]);
2347
2350
  const hasSelection = selectedItems.size > 0;
2351
+ const hasCloudOnlySelection = hasSelection && Array.from(selectedItems).some((path) => {
2352
+ const item = fileItems.find((f) => f.path === path);
2353
+ return item && item.cdnPushed;
2354
+ });
2348
2355
  const selectedPaths = Array.from(selectedItems);
2349
2356
  const singleFolderSelected = selectedPaths.length === 1 && !selectedPaths[0].includes(".");
2350
2357
  const selectedFolderPath = singleFolderSelected ? selectedPaths[0] : null;
@@ -2548,7 +2555,8 @@ function StudioToolbar() {
2548
2555
  {
2549
2556
  css: styles5.btn,
2550
2557
  onClick: handleMoveClick,
2551
- disabled: !hasSelection,
2558
+ disabled: !hasSelection || hasCloudOnlySelection,
2559
+ title: hasCloudOnlySelection ? "Cannot move files that are in the cloud" : void 0,
2552
2560
  children: [
2553
2561
  /* @__PURE__ */ jsx5(MoveIcon, {}),
2554
2562
  "Move"
@@ -2766,7 +2774,8 @@ function useFileList() {
2766
2774
  triggerRefresh,
2767
2775
  triggerScan,
2768
2776
  searchQuery,
2769
- showError
2777
+ showError,
2778
+ setFileItems
2770
2779
  } = useStudio();
2771
2780
  const [items, setItems] = useState5([]);
2772
2781
  const [loading, setLoading] = useState5(true);
@@ -2782,19 +2791,22 @@ function useFileList() {
2782
2791
  lastPath.current = currentPath;
2783
2792
  try {
2784
2793
  const data = searchQuery && searchQuery.length >= 2 ? await studioApi.search(searchQuery) : await studioApi.list(currentPath);
2785
- setItems(data.items || []);
2794
+ const loadedItems = data.items || [];
2795
+ setItems(loadedItems);
2796
+ setFileItems(loadedItems);
2786
2797
  setMetaEmpty(data.isEmpty === true);
2787
2798
  } catch (error) {
2788
2799
  const message = error instanceof Error ? error.message : "Failed to load items";
2789
2800
  showError("Load Error", message);
2790
2801
  setItems([]);
2802
+ setFileItems([]);
2791
2803
  setMetaEmpty(false);
2792
2804
  }
2793
2805
  setLoading(false);
2794
2806
  isInitialLoad.current = false;
2795
2807
  }
2796
2808
  loadItems();
2797
- }, [currentPath, refreshKey, searchQuery, showError]);
2809
+ }, [currentPath, refreshKey, searchQuery, showError, setFileItems]);
2798
2810
  const isAtRoot = currentPath === "public";
2799
2811
  const isSearching = searchQuery && searchQuery.length >= 2;
2800
2812
  const sortedItems = [...items].sort((a, b) => {
@@ -3355,7 +3367,7 @@ function GridItem({ item, isSelected, onClick, onOpen, onGenerateThumbnail }) {
3355
3367
  isFolder ? isImagesFolder ? /* @__PURE__ */ jsxs6("div", { css: styles6.imagesFolderWrapper, children: [
3356
3368
  /* @__PURE__ */ jsx6("svg", { css: styles6.imagesFolderIcon, fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { d: "M10 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" }) }),
3357
3369
  /* @__PURE__ */ jsx6("svg", { css: styles6.lockIcon, fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx6("path", { fillRule: "evenodd", d: "M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z", clipRule: "evenodd" }) })
3358
- ] }) : /* @__PURE__ */ jsx6("svg", { css: styles6.folderIcon, fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { d: "M10 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" }) }) : isImage && item.hasThumbnail ? /* @__PURE__ */ jsx6(
3370
+ ] }) : /* @__PURE__ */ jsx6("svg", { css: styles6.folderIcon, fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { d: "M10 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" }) }) : isImage && item.thumbnail ? /* @__PURE__ */ jsx6(
3359
3371
  "img",
3360
3372
  {
3361
3373
  css: styles6.image,
@@ -3363,20 +3375,6 @@ function GridItem({ item, isSelected, onClick, onOpen, onGenerateThumbnail }) {
3363
3375
  alt: item.name,
3364
3376
  loading: "lazy"
3365
3377
  }
3366
- ) : isImage && !item.hasThumbnail ? /* @__PURE__ */ jsxs6(
3367
- "button",
3368
- {
3369
- css: styles6.noThumbnail,
3370
- onClick: (e) => {
3371
- e.stopPropagation();
3372
- onGenerateThumbnail();
3373
- },
3374
- title: "Generate thumbnail",
3375
- children: [
3376
- /* @__PURE__ */ jsx6("svg", { css: styles6.noThumbnailIcon, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
3377
- /* @__PURE__ */ jsx6("span", { css: styles6.noThumbnailText, children: "Generate" })
3378
- ]
3379
- }
3380
3378
  ) : /* @__PURE__ */ jsx6("svg", { css: styles6.fileIcon, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) })
3381
3379
  ] }),
3382
3380
  /* @__PURE__ */ jsx6("div", { css: styles6.label, children: /* @__PURE__ */ jsx6("div", { css: styles6.labelRow, children: /* @__PURE__ */ jsxs6("div", { css: styles6.labelText, children: [
@@ -3872,18 +3870,7 @@ function ListRow({ item, isSelected, onClick, onOpen, onGenerateThumbnail }) {
3872
3870
  isFolder ? isImagesFolder ? /* @__PURE__ */ jsxs7("div", { css: styles7.imagesFolderWrapper, children: [
3873
3871
  /* @__PURE__ */ jsx7("svg", { css: styles7.imagesFolderIcon, fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7("path", { d: "M10 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" }) }),
3874
3872
  /* @__PURE__ */ jsx7("svg", { css: styles7.lockIcon, fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx7("path", { fillRule: "evenodd", d: "M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z", clipRule: "evenodd" }) })
3875
- ] }) : /* @__PURE__ */ jsx7("div", { css: styles7.folderIconWrapper, children: /* @__PURE__ */ jsx7("svg", { css: styles7.folderIcon, fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7("path", { d: "M10 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" }) }) }) : isImage && item.hasThumbnail ? /* @__PURE__ */ jsx7("div", { css: styles7.thumbnailWrapper, children: /* @__PURE__ */ jsx7("img", { css: styles7.thumbnail, src: item.thumbnail, alt: item.name, loading: "lazy" }) }) : isImage && !item.hasThumbnail ? /* @__PURE__ */ jsx7("div", { css: styles7.thumbnailWrapper, children: /* @__PURE__ */ jsx7(
3876
- "button",
3877
- {
3878
- css: styles7.noThumbnail,
3879
- onClick: (e) => {
3880
- e.stopPropagation();
3881
- onGenerateThumbnail();
3882
- },
3883
- title: "Generate thumbnail",
3884
- children: /* @__PURE__ */ jsx7("svg", { css: styles7.noThumbnailIcon, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
3885
- }
3886
- ) }) : /* @__PURE__ */ jsx7("div", { css: styles7.thumbnailWrapper, children: /* @__PURE__ */ jsx7("svg", { css: styles7.fileIcon, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) }) }),
3873
+ ] }) : /* @__PURE__ */ jsx7("div", { css: styles7.folderIconWrapper, children: /* @__PURE__ */ jsx7("svg", { css: styles7.folderIcon, fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7("path", { d: "M10 4H4a2 2 0 00-2 2v12a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-8l-2-2z" }) }) }) : isImage && item.thumbnail ? /* @__PURE__ */ jsx7("div", { css: styles7.thumbnailWrapper, children: /* @__PURE__ */ jsx7("img", { css: styles7.thumbnail, src: item.thumbnail, alt: item.name, loading: "lazy" }) }) : /* @__PURE__ */ jsx7("div", { css: styles7.thumbnailWrapper, children: /* @__PURE__ */ jsx7("svg", { css: styles7.fileIcon, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" }) }) }),
3887
3874
  /* @__PURE__ */ jsx7("span", { css: styles7.name, title: item.name, children: truncateMiddle2(item.name) }),
3888
3875
  /* @__PURE__ */ jsxs7("div", { css: styles7.actionsCell, children: [
3889
3876
  /* @__PURE__ */ jsxs7(
@@ -5227,6 +5214,7 @@ function StudioUI({ onClose, isVisible = true }) {
5227
5214
  const [scanRequested, setScanRequested] = useState10(false);
5228
5215
  const [searchQuery, setSearchQuery] = useState10("");
5229
5216
  const [error, setError] = useState10(null);
5217
+ const [fileItems, setFileItems] = useState10([]);
5230
5218
  const [isDragging, setIsDragging] = useState10(false);
5231
5219
  const triggerRefresh = useCallback5(() => {
5232
5220
  setRefreshKey((k) => k + 1);
@@ -5380,7 +5368,9 @@ function StudioUI({ onClose, isVisible = true }) {
5380
5368
  setSearchQuery,
5381
5369
  error,
5382
5370
  showError,
5383
- clearError
5371
+ clearError,
5372
+ fileItems,
5373
+ setFileItems
5384
5374
  };
5385
5375
  return /* @__PURE__ */ jsx11(StudioContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs11("div", { css: styles11.container, children: [
5386
5376
  /* @__PURE__ */ jsxs11("div", { css: styles11.header, children: [
@@ -5462,4 +5452,4 @@ export {
5462
5452
  StudioUI,
5463
5453
  StudioUI_default as default
5464
5454
  };
5465
- //# sourceMappingURL=StudioUI-GKE5ZWKW.mjs.map
5455
+ //# sourceMappingURL=StudioUI-3TE62FRZ.mjs.map