@gallop.software/studio 0.1.96 → 0.1.98

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"
@@ -2560,7 +2568,8 @@ function StudioToolbar() {
2560
2568
  {
2561
2569
  css: styles5.btn,
2562
2570
  onClick: handleSyncClick,
2563
- disabled: !hasSelection,
2571
+ disabled: !hasSelection || hasCloudOnlySelection,
2572
+ title: hasCloudOnlySelection ? "Selected files are already in the cloud" : void 0,
2564
2573
  children: [
2565
2574
  /* @__PURE__ */ jsx5(CloudIcon, {}),
2566
2575
  "Push CDN"
@@ -2766,7 +2775,8 @@ function useFileList() {
2766
2775
  triggerRefresh,
2767
2776
  triggerScan,
2768
2777
  searchQuery,
2769
- showError
2778
+ showError,
2779
+ setFileItems
2770
2780
  } = useStudio();
2771
2781
  const [items, setItems] = useState5([]);
2772
2782
  const [loading, setLoading] = useState5(true);
@@ -2782,19 +2792,22 @@ function useFileList() {
2782
2792
  lastPath.current = currentPath;
2783
2793
  try {
2784
2794
  const data = searchQuery && searchQuery.length >= 2 ? await studioApi.search(searchQuery) : await studioApi.list(currentPath);
2785
- setItems(data.items || []);
2795
+ const loadedItems = data.items || [];
2796
+ setItems(loadedItems);
2797
+ setFileItems(loadedItems);
2786
2798
  setMetaEmpty(data.isEmpty === true);
2787
2799
  } catch (error) {
2788
2800
  const message = error instanceof Error ? error.message : "Failed to load items";
2789
2801
  showError("Load Error", message);
2790
2802
  setItems([]);
2803
+ setFileItems([]);
2791
2804
  setMetaEmpty(false);
2792
2805
  }
2793
2806
  setLoading(false);
2794
2807
  isInitialLoad.current = false;
2795
2808
  }
2796
2809
  loadItems();
2797
- }, [currentPath, refreshKey, searchQuery, showError]);
2810
+ }, [currentPath, refreshKey, searchQuery, showError, setFileItems]);
2798
2811
  const isAtRoot = currentPath === "public";
2799
2812
  const isSearching = searchQuery && searchQuery.length >= 2;
2800
2813
  const sortedItems = [...items].sort((a, b) => {
@@ -5202,6 +5215,7 @@ function StudioUI({ onClose, isVisible = true }) {
5202
5215
  const [scanRequested, setScanRequested] = useState10(false);
5203
5216
  const [searchQuery, setSearchQuery] = useState10("");
5204
5217
  const [error, setError] = useState10(null);
5218
+ const [fileItems, setFileItems] = useState10([]);
5205
5219
  const [isDragging, setIsDragging] = useState10(false);
5206
5220
  const triggerRefresh = useCallback5(() => {
5207
5221
  setRefreshKey((k) => k + 1);
@@ -5355,7 +5369,9 @@ function StudioUI({ onClose, isVisible = true }) {
5355
5369
  setSearchQuery,
5356
5370
  error,
5357
5371
  showError,
5358
- clearError
5372
+ clearError,
5373
+ fileItems,
5374
+ setFileItems
5359
5375
  };
5360
5376
  return /* @__PURE__ */ jsx11(StudioContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs11("div", { css: styles11.container, children: [
5361
5377
  /* @__PURE__ */ jsxs11("div", { css: styles11.header, children: [
@@ -5437,4 +5453,4 @@ export {
5437
5453
  StudioUI,
5438
5454
  StudioUI_default as default
5439
5455
  };
5440
- //# sourceMappingURL=StudioUI-V2JRKBTG.mjs.map
5456
+ //# sourceMappingURL=StudioUI-Q3TTI2IQ.mjs.map