diff --git a/src/components/CardGrid.astro b/src/components/CardGrid.astro
index 759e9b5..36eb7f0 100644
--- a/src/components/CardGrid.astro
+++ b/src/components/CardGrid.astro
@@ -1,6 +1,5 @@
---
import BackToTop from "./BackToTop.astro"
-import LeftSidebarDesktop from "./LeftSidebarDesktop.astro"
---
@@ -114,6 +112,9 @@ import LeftSidebarDesktop from "./LeftSidebarDesktop.astro"
// ── Global helpers ────────────────────────────────────────────────────────
window.copyImage = async function(img) {
+ const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) ||
+ (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
+
try {
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
@@ -129,10 +130,17 @@ import LeftSidebarDesktop from "./LeftSidebarDesktop.astro"
clean.src = img.src;
});
+ const blob = await new Promise((resolve, reject) => {
+ canvas.toBlob(b => b ? resolve(b) : reject(new Error('toBlob failed')), 'image/png');
+ });
+
+ if (isIOS) {
+ const file = new File([blob], 'card.png', { type: 'image/png' });
+ await navigator.share({ files: [file] });
+ return;
+ }
+
if (navigator.clipboard && navigator.clipboard.write) {
- const blob = await new Promise((resolve, reject) => {
- canvas.toBlob(b => b ? resolve(b) : reject(new Error('toBlob failed')), 'image/png');
- });
await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
showCopyToast('📋 Image copied!', '#198754');
} else {
@@ -151,6 +159,7 @@ import LeftSidebarDesktop from "./LeftSidebarDesktop.astro"
}
}
} catch (err) {
+ if (err.name === 'AbortError') return;
console.error('Failed:', err);
showCopyToast('❌ Copy failed', '#dc3545');
}
diff --git a/src/layouts/Main.astro b/src/layouts/Main.astro
index 70de6ff..dfe03d6 100644
--- a/src/layouts/Main.astro
+++ b/src/layouts/Main.astro
@@ -42,7 +42,5 @@ const { title } = Astro.props;
-
-