Build single-page web UI in static/index.html #4

Closed
opened 2026-09-10 23:01:10 +02:00 by tilltheend · 1 comment
Owner

Parent

Parent Map: #1 (Garment Photo Cleaner Web App [Map])

Blocked by

Blocked by: "Implement FastAPI backend and /api/clean endpoint in app.py"

Question

How should the single-page web UI in static/index.html be structured and styled (drag-and-drop file upload, thumbnail preview, preset selector buttons for warm beige / bright white, editable prompt, processing indicator, side-by-side before/after comparison, cost display, and download button) without any frontend build tools?

## Parent Parent Map: #1 (Garment Photo Cleaner Web App [Map]) ## Blocked by Blocked by: "Implement FastAPI backend and /api/clean endpoint in app.py" ## Question How should the single-page web UI in `static/index.html` be structured and styled (drag-and-drop file upload, thumbnail preview, preset selector buttons for warm beige / bright white, editable prompt, processing indicator, side-by-side before/after comparison, cost display, and download button) without any frontend build tools?
tilltheend added the
wayfinder:prototype
label 2026-09-10 23:01:11 +02:00
tilltheend self-assigned this 2026-09-10 23:26:59 +02:00
Author
Owner

Resolution

Created the complete single-page web interface in static/index.html with zero build dependencies or npm requirements.

Key features and design decisions

  1. Zero-build static client: Pure HTML, embedded modern CSS in <style>, and vanilla JS in <script> hosted directly by FastAPI at / and /static/index.html.
  2. Interactive upload: Drag-and-drop file target with dragover visual highlights, fallback file picker, client-side thumbnail rendering using FileReader, and instant dimension calculation via Image natural dimensions.
  3. Studio prompt controls: Pre-filled textarea with tested warm beige catalog prompt, preset toggle buttons for Warm Beige and Bright White, OpenRouter model input defaulting to meta/muse-image, optional API key input with env fallback indication, and restore resolution checkbox.
  4. Resilient form submission: Sends multipart payload to POST /api/clean, handles in-flight states with disabled submission, spinner animation, elapsed timer, and inline error banner extraction for 400/502 errors.
  5. Before-and-after view: Side-by-side catalog comparison displaying generation cost, dimensions before and after, Lanczos restoration badges, and a direct download button saving <filename>_clean.jpg.
  6. Automated verification: DOM element presence, attributes, and script functionality tested in tests/test_ui.py.
## Resolution Created the complete single-page web interface in `static/index.html` with zero build dependencies or npm requirements. ### Key features and design decisions 1. **Zero-build static client**: Pure HTML, embedded modern CSS in `<style>`, and vanilla JS in `<script>` hosted directly by FastAPI at `/` and `/static/index.html`. 2. **Interactive upload**: Drag-and-drop file target with dragover visual highlights, fallback file picker, client-side thumbnail rendering using `FileReader`, and instant dimension calculation via Image natural dimensions. 3. **Studio prompt controls**: Pre-filled textarea with tested warm beige catalog prompt, preset toggle buttons for Warm Beige and Bright White, OpenRouter model input defaulting to `meta/muse-image`, optional API key input with env fallback indication, and restore resolution checkbox. 4. **Resilient form submission**: Sends multipart payload to `POST /api/clean`, handles in-flight states with disabled submission, spinner animation, elapsed timer, and inline error banner extraction for 400/502 errors. 5. **Before-and-after view**: Side-by-side catalog comparison displaying generation cost, dimensions before and after, Lanczos restoration badges, and a direct download button saving `<filename>_clean.jpg`. 6. **Automated verification**: DOM element presence, attributes, and script functionality tested in `tests/test_ui.py`.
Sign in to join this conversation.
No description provided.