From 6e93b7f67254607d5a01fb77ae013d53d0a6e4ac Mon Sep 17 00:00:00 2001 From: kamaji Date: Sat, 31 Jan 2026 23:35:16 -0600 Subject: [PATCH] Add receipt extraction, manual crop, and UX improvements - Add Claude Haiku vision integration to extract amount and date from receipt photos, re-reading on photo replacement - Add manual crop overlay with draggable handles for receipt photos - Open camera directly when tapping + to add new receipt - Make add/edit modal scrollable on small screens - Show "Tap to change photo" hint on uploaded photos - Include api-key in Docker image for Anthropic API access Co-Authored-By: Claude Opus 4.5 --- Dockerfile | 2 +- receipts.html | 314 +++++++++++++++++++++++++++++++++++++++++++++++++- server.py | 79 ++++++++++++- 3 files changed, 388 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f248129..0d3abd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -COPY server.py receipts.html ./ +COPY server.py receipts.html api-key ./ EXPOSE 8080 diff --git a/receipts.html b/receipts.html index 4f92b65..8831080 100644 --- a/receipts.html +++ b/receipts.html @@ -82,6 +82,7 @@ z-index: 100; justify-content: center; align-items: flex-end; + overflow-y: auto; } .modal-overlay.open { display: flex; } @@ -89,6 +90,8 @@ background: #fff; width: 100%; max-width: 600px; + max-height: 90vh; + overflow-y: auto; border-radius: 16px 16px 0 0; padding: 24px 20px 32px; animation: slideUp 0.25s ease; @@ -161,6 +164,13 @@ border-radius: 6px; } .photo-area svg { opacity: 0.4; } + .extract-status { + font-size: 0.8rem; + color: #888; + text-align: center; + padding: 6px 0 0; + min-height: 1.4em; + } .btn-row { display: flex; @@ -249,6 +259,51 @@ .empty-state svg { margin-bottom: 12px; opacity: 0.3; } .empty-state p { font-size: 0.95rem; } + /* Manual crop overlay */ + .crop-overlay { + display: none; + position: fixed; + inset: 0; + background: rgba(0,0,0,0.92); + z-index: 150; + flex-direction: column; + align-items: center; + justify-content: center; + } + .crop-overlay.open { display: flex; } + .crop-canvas-wrap { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + overflow: hidden; + padding: 12px; + } + .crop-canvas-wrap canvas { + max-width: 100%; + max-height: 100%; + touch-action: none; + } + .crop-toolbar { + display: flex; + gap: 12px; + padding: 12px 20px 24px; + width: 100%; + max-width: 500px; + } + .crop-toolbar button { + flex: 1; + padding: 12px; + border: none; + border-radius: 8px; + font-size: 1rem; + font-weight: 600; + cursor: pointer; + } + .crop-btn-full { background: rgba(255,255,255,0.15); color: #fff; } + .crop-btn-crop { background: #e94560; color: #fff; } + /* Login overlay */ .login-overlay { position: fixed; @@ -440,6 +495,7 @@ Tap to take photo +
@@ -480,6 +536,17 @@ Receipt photo
+ +
+
+ +
+
+ + +
+
+