diff --git a/src/lib/components/EntryCard.svelte b/src/lib/components/EntryCard.svelte
index 87956b1..05b7918 100644
--- a/src/lib/components/EntryCard.svelte
+++ b/src/lib/components/EntryCard.svelte
@@ -5,8 +5,7 @@
import { slide } from 'svelte/transition';
import ImageGallery from './ImageGallery.svelte';
import ImageUpload from './ImageUpload.svelte';
- import CameraCapture from './CameraCapture.svelte';
-
+
interface EntryWithImages extends Entry {
images: Image[];
}
@@ -21,8 +20,8 @@
let expanded = $state(false);
// Image management state
- let showCamera = $state(false);
let editImagesMode = $state(false);
+ let cameraInput: HTMLInputElement;
// Edit state - use $derived to stay in sync with entry prop
let editTitle = $state(entry.title || '');
@@ -49,6 +48,11 @@
let isSwiping = $state(false);
function handleTouchStart(e: TouchEvent) {
+ // Ignore if touch started on a button or interactive element
+ const target = e.target as HTMLElement;
+ if (target.closest('button, input, textarea, select, a, [role="button"]')) {
+ return;
+ }
touchStartX = e.touches[0].clientX;
isSwiping = true;
}
@@ -151,9 +155,22 @@
// invalidateAll is called by ImageUpload, so nothing extra needed here
}
- function handleCameraCapture() {
- showCamera = false;
- // invalidateAll is called by CameraCapture
+ async function handleCameraInput(e: Event) {
+ const input = e.target as HTMLInputElement;
+ const file = input.files?.[0];
+ if (!file || !file.type.startsWith('image/')) return;
+
+ const formData = new FormData();
+ formData.append('image', file);
+ formData.append('entryId', entry.id);
+
+ await fetch('?/uploadImage', {
+ method: 'POST',
+ body: formData
+ });
+
+ await invalidateAll();
+ input.value = '';
}
@@ -357,7 +374,7 @@
+
@@ -436,10 +461,3 @@
{/if}
-{#if showCamera}
- (showCamera = false)}
- onCapture={handleCameraCapture}
- />
-{/if}