@gallop.software/studio 0.1.86 → 0.1.87
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.
- package/dist/{StudioUI-QTKNMFLF.mjs → StudioUI-6HTM3QHM.mjs} +45 -5
- package/dist/StudioUI-6HTM3QHM.mjs.map +1 -0
- package/dist/{StudioUI-PH265HCB.js → StudioUI-ZBSTYTUV.js} +50 -10
- package/dist/StudioUI-ZBSTYTUV.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/StudioUI-PH265HCB.js.map +0 -1
- package/dist/StudioUI-QTKNMFLF.mjs.map +0 -1
|
@@ -1266,6 +1266,8 @@ function StudioToolbar() {
|
|
|
1266
1266
|
const [processing, setProcessing] = useState3(false);
|
|
1267
1267
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState3(false);
|
|
1268
1268
|
const [showProcessConfirm, setShowProcessConfirm] = useState3(false);
|
|
1269
|
+
const [showSyncConfirm, setShowSyncConfirm] = useState3(false);
|
|
1270
|
+
const [syncImageCount, setSyncImageCount] = useState3(0);
|
|
1269
1271
|
const [showProgress, setShowProgress] = useState3(false);
|
|
1270
1272
|
const [progressState, setProgressState] = useState3({
|
|
1271
1273
|
current: 0,
|
|
@@ -1631,7 +1633,7 @@ function StudioToolbar() {
|
|
|
1631
1633
|
});
|
|
1632
1634
|
}
|
|
1633
1635
|
}, [selectedItems, clearSelection, triggerRefresh]);
|
|
1634
|
-
const
|
|
1636
|
+
const handleSyncClick = useCallback(async () => {
|
|
1635
1637
|
if (selectedItems.size === 0) return;
|
|
1636
1638
|
const selectedPaths2 = Array.from(selectedItems);
|
|
1637
1639
|
const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
|
|
@@ -1656,14 +1658,42 @@ function StudioToolbar() {
|
|
|
1656
1658
|
console.error("Failed to get folder images:", error);
|
|
1657
1659
|
}
|
|
1658
1660
|
}
|
|
1659
|
-
|
|
1660
|
-
if (imageKeys.length === 0) {
|
|
1661
|
+
if (selectedImagePaths.length === 0) {
|
|
1661
1662
|
setAlertMessage({
|
|
1662
1663
|
title: "No Images Found",
|
|
1663
1664
|
message: "No images found in the selected items."
|
|
1664
1665
|
});
|
|
1665
1666
|
return;
|
|
1666
1667
|
}
|
|
1668
|
+
setSyncImageCount(selectedImagePaths.length);
|
|
1669
|
+
setShowSyncConfirm(true);
|
|
1670
|
+
}, [selectedItems]);
|
|
1671
|
+
const handleSyncConfirm = useCallback(async () => {
|
|
1672
|
+
setShowSyncConfirm(false);
|
|
1673
|
+
const selectedPaths2 = Array.from(selectedItems);
|
|
1674
|
+
const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
|
|
1675
|
+
const selectedImagePaths = selectedPaths2.filter((p) => {
|
|
1676
|
+
const ext = p.split(".").pop()?.toLowerCase() || "";
|
|
1677
|
+
return imageExtensions.includes(ext);
|
|
1678
|
+
});
|
|
1679
|
+
const selectedFolders = selectedPaths2.filter((p) => !p.includes(".") || p.endsWith("/"));
|
|
1680
|
+
if (selectedFolders.length > 0) {
|
|
1681
|
+
try {
|
|
1682
|
+
const response = await fetch(`/api/studio/folder-images?folders=${encodeURIComponent(selectedFolders.join(","))}`);
|
|
1683
|
+
const data = await response.json();
|
|
1684
|
+
if (data.images) {
|
|
1685
|
+
for (const img of data.images) {
|
|
1686
|
+
const fullPath = `public/${img}`;
|
|
1687
|
+
if (!selectedImagePaths.includes(fullPath)) {
|
|
1688
|
+
selectedImagePaths.push(fullPath);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
} catch (error) {
|
|
1693
|
+
console.error("Failed to get folder images:", error);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
const imageKeys = selectedImagePaths.map((p) => "/" + p.replace(/^public\//, ""));
|
|
1667
1697
|
setProgressState({
|
|
1668
1698
|
current: 0,
|
|
1669
1699
|
total: imageKeys.length,
|
|
@@ -1836,6 +1866,16 @@ function StudioToolbar() {
|
|
|
1836
1866
|
onCancel: () => setShowDeleteConfirm(false)
|
|
1837
1867
|
}
|
|
1838
1868
|
),
|
|
1869
|
+
showSyncConfirm && /* @__PURE__ */ jsx4(
|
|
1870
|
+
ConfirmModal,
|
|
1871
|
+
{
|
|
1872
|
+
title: "Sync to CDN",
|
|
1873
|
+
message: `Sync ${syncImageCount} image${syncImageCount !== 1 ? "s" : ""} to Cloudflare R2? Images must be processed first. After syncing, local thumbnails will be deleted.`,
|
|
1874
|
+
confirmLabel: "Sync",
|
|
1875
|
+
onConfirm: handleSyncConfirm,
|
|
1876
|
+
onCancel: () => setShowSyncConfirm(false)
|
|
1877
|
+
}
|
|
1878
|
+
),
|
|
1839
1879
|
showProcessConfirm && /* @__PURE__ */ jsx4(
|
|
1840
1880
|
ConfirmModal,
|
|
1841
1881
|
{
|
|
@@ -1993,7 +2033,7 @@ function StudioToolbar() {
|
|
|
1993
2033
|
"button",
|
|
1994
2034
|
{
|
|
1995
2035
|
css: styles4.btn,
|
|
1996
|
-
onClick:
|
|
2036
|
+
onClick: handleSyncClick,
|
|
1997
2037
|
disabled: !hasSelection,
|
|
1998
2038
|
children: [
|
|
1999
2039
|
/* @__PURE__ */ jsx4(CloudIcon, {}),
|
|
@@ -4621,4 +4661,4 @@ export {
|
|
|
4621
4661
|
StudioUI,
|
|
4622
4662
|
StudioUI_default as default
|
|
4623
4663
|
};
|
|
4624
|
-
//# sourceMappingURL=StudioUI-
|
|
4664
|
+
//# sourceMappingURL=StudioUI-6HTM3QHM.mjs.map
|