@gallop.software/studio 0.1.96 → 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) => {
@@ -5202,6 +5214,7 @@ function StudioUI({ onClose, isVisible = true }) {
5202
5214
  const [scanRequested, setScanRequested] = useState10(false);
5203
5215
  const [searchQuery, setSearchQuery] = useState10("");
5204
5216
  const [error, setError] = useState10(null);
5217
+ const [fileItems, setFileItems] = useState10([]);
5205
5218
  const [isDragging, setIsDragging] = useState10(false);
5206
5219
  const triggerRefresh = useCallback5(() => {
5207
5220
  setRefreshKey((k) => k + 1);
@@ -5355,7 +5368,9 @@ function StudioUI({ onClose, isVisible = true }) {
5355
5368
  setSearchQuery,
5356
5369
  error,
5357
5370
  showError,
5358
- clearError
5371
+ clearError,
5372
+ fileItems,
5373
+ setFileItems
5359
5374
  };
5360
5375
  return /* @__PURE__ */ jsx11(StudioContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs11("div", { css: styles11.container, children: [
5361
5376
  /* @__PURE__ */ jsxs11("div", { css: styles11.header, children: [
@@ -5437,4 +5452,4 @@ export {
5437
5452
  StudioUI,
5438
5453
  StudioUI_default as default
5439
5454
  };
5440
- //# sourceMappingURL=StudioUI-V2JRKBTG.mjs.map
5455
+ //# sourceMappingURL=StudioUI-3TE62FRZ.mjs.map