@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] = _react.useState.call(void 0, false);
|
|
1267
1267
|
const [showDeleteConfirm, setShowDeleteConfirm] = _react.useState.call(void 0, false);
|
|
1268
1268
|
const [showProcessConfirm, setShowProcessConfirm] = _react.useState.call(void 0, false);
|
|
1269
|
+
const [showSyncConfirm, setShowSyncConfirm] = _react.useState.call(void 0, false);
|
|
1270
|
+
const [syncImageCount, setSyncImageCount] = _react.useState.call(void 0, 0);
|
|
1269
1271
|
const [showProgress, setShowProgress] = _react.useState.call(void 0, false);
|
|
1270
1272
|
const [progressState, setProgressState] = _react.useState.call(void 0, {
|
|
1271
1273
|
current: 0,
|
|
@@ -1631,7 +1633,7 @@ function StudioToolbar() {
|
|
|
1631
1633
|
});
|
|
1632
1634
|
}
|
|
1633
1635
|
}, [selectedItems, clearSelection, triggerRefresh]);
|
|
1634
|
-
const
|
|
1636
|
+
const handleSyncClick = _react.useCallback.call(void 0, 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 = _react.useCallback.call(void 0, 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 = _optionalChain([p, 'access', _25 => _25.split, 'call', _26 => _26("."), 'access', _27 => _27.pop, 'call', _28 => _28(), 'optionalAccess', _29 => _29.toLowerCase, 'call', _30 => _30()]) || "";
|
|
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,
|
|
@@ -1692,15 +1722,15 @@ function StudioToolbar() {
|
|
|
1692
1722
|
});
|
|
1693
1723
|
const data = await response.json();
|
|
1694
1724
|
if (!response.ok) {
|
|
1695
|
-
if (_optionalChain([data, 'access',
|
|
1725
|
+
if (_optionalChain([data, 'access', _31 => _31.error, 'optionalAccess', _32 => _32.includes, 'call', _33 => _33("R2 not configured")]) || _optionalChain([data, 'access', _34 => _34.error, 'optionalAccess', _35 => _35.includes, 'call', _36 => _36("CLOUDFLARE_R2")])) {
|
|
1696
1726
|
setShowProgress(false);
|
|
1697
1727
|
setShowR2SetupModal(true);
|
|
1698
1728
|
return;
|
|
1699
1729
|
}
|
|
1700
1730
|
errors++;
|
|
1701
|
-
} else if (_optionalChain([data, 'access',
|
|
1731
|
+
} else if (_optionalChain([data, 'access', _37 => _37.synced, 'optionalAccess', _38 => _38.length]) > 0) {
|
|
1702
1732
|
synced++;
|
|
1703
|
-
} else if (_optionalChain([data, 'access',
|
|
1733
|
+
} else if (_optionalChain([data, 'access', _39 => _39.errors, 'optionalAccess', _40 => _40.length]) > 0) {
|
|
1704
1734
|
errors++;
|
|
1705
1735
|
}
|
|
1706
1736
|
} catch (e4) {
|
|
@@ -1836,6 +1866,16 @@ function StudioToolbar() {
|
|
|
1836
1866
|
onCancel: () => setShowDeleteConfirm(false)
|
|
1837
1867
|
}
|
|
1838
1868
|
),
|
|
1869
|
+
showSyncConfirm && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0, CloudIcon, {}),
|
|
@@ -3635,7 +3675,7 @@ function StudioDetailView() {
|
|
|
3635
3675
|
});
|
|
3636
3676
|
triggerRefresh();
|
|
3637
3677
|
} else {
|
|
3638
|
-
if (_optionalChain([data, 'access',
|
|
3678
|
+
if (_optionalChain([data, 'access', _41 => _41.error, 'optionalAccess', _42 => _42.includes, 'call', _43 => _43("R2 not configured")]) || _optionalChain([data, 'access', _44 => _44.error, 'optionalAccess', _45 => _45.includes, 'call', _46 => _46("CLOUDFLARE_R2")])) {
|
|
3639
3679
|
setShowR2SetupModal(true);
|
|
3640
3680
|
} else {
|
|
3641
3681
|
setAlertMessage({
|
|
@@ -3674,7 +3714,7 @@ function StudioDetailView() {
|
|
|
3674
3714
|
if (!response.ok) {
|
|
3675
3715
|
throw new Error("Processing failed");
|
|
3676
3716
|
}
|
|
3677
|
-
const reader = _optionalChain([response, 'access',
|
|
3717
|
+
const reader = _optionalChain([response, 'access', _47 => _47.body, 'optionalAccess', _48 => _48.getReader, 'call', _49 => _49()]);
|
|
3678
3718
|
if (!reader) {
|
|
3679
3719
|
throw new Error("No response body");
|
|
3680
3720
|
}
|
|
@@ -4621,4 +4661,4 @@ var StudioUI_default = StudioUI;
|
|
|
4621
4661
|
|
|
4622
4662
|
|
|
4623
4663
|
exports.StudioUI = StudioUI; exports.default = StudioUI_default;
|
|
4624
|
-
//# sourceMappingURL=StudioUI-
|
|
4664
|
+
//# sourceMappingURL=StudioUI-ZBSTYTUV.js.map
|