Commit Graph

4 Commits

Author SHA1 Message Date
JasonFraser cac895a11f Replace the native PDF iframe with a pdf.js viewer for row highlighting
R.1 (frontend half) of the staged review-screen plan. An <iframe> has
no overlay hook, so drawing a highlight box on a flagged row's own
printed position (source_page/source_bbox, shipped in the previous
commit) needed real rendering control.

New usePdfViewer.js (installs pdfjs-dist) renders each page to its own
canvas, stacked in one scrollable column - the closest behavioral match
to the iframe's own scrollable multi-page view. The browser's native
PDF toolbar goes away as a direct consequence; zoom is rebuilt to match
useImageZoom.js's own -/+/Fit pattern. The coordinate mapping (bbox
value * zoom, no axis flip) is the exact one already verified correct
against real rendered fixtures in the backend half of this work, reused
here rather than re-derived.

useImageZoom.js gained the same highlight/highlightStyle/showHighlight/
clearHighlight shape for an image upload, reusing its own existing zoom
math. SourceDocumentPanel.vue exposes one unified showHighlight(page,
bbox)/clearHighlight() routing to whichever viewer is active - not
called from anywhere yet, since R.2 (the flagged-row UI that would
trigger it) isn't built. R.1 only builds the capability.

Verified: npm run build passes, the pdf.js worker bundles and serves
correctly (curl'd directly, 200). The app container rebuilt and the
served bundle confirmed to contain the new class/function names.
measure.py unaffected (no backend touched this half). Not
machine-verified, more consequential than usual to leave that way:
canvas rendering, worker loading, zoom, and scroll all depend on real
browser behavior a bundle check can't confirm - Claude-in-Chrome did
not connect this session.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-13 11:26:48 -04:00
JasonFraser ca12f2b90d Rebuild the app shell as an enterprise header/sidebar/footer layout
The project sidebar was "not impressive" per direct feedback, pointed
at docs/sample_ui.png (a Cloudflare R2 dashboard) as the reference.
Adds AppHeader (brand + breadcrumb + account menu) and AppFooter, and
rebuilds ProjectSidebar into the reference's own left-nav pattern
(search box, icon-led list, bottom-anchored collapse-to-rail toggle).
ProjectSidebar moves from ExtractorView into App.vue's shell, since
it's account-wide chrome, not page-specific - same reasoning as the
new header/footer.

Every unicode-entity icon left over from the original vanilla-JS build
is replaced with a FontAwesome solid icon (installed as a real npm
dependency, not a CDN link, to keep the Docker build offline-
reproducible) - not just in the sidebar, across every button site-wide,
per the explicit ask. Color theme is untouched.

Verified: npm run build passes with the fonts bundled correctly; every
icon class used was grepped against the installed FontAwesome CSS and
confirmed to exist; the app container was rebuilt and curl-checked
end-to-end (bundle, CSS, and font asset all serve correctly, and the
new component/icon class names are present in the built JS). measure.py
re-run, unaffected. Not machine-verified: the actual rendered page -
Claude-in-Chrome did not connect this session, same as every prior UI
change in this project.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-13 08:05:55 -04:00
JasonFraser 94096554e9 Add PocketBase: accounts (password + Google) + schema for R2-backed docs
New third service alongside app/docling - a deliberate, revisited
decision from the documented "no DB" architecture, not an oversight.

pocketbase/Dockerfile - official minimal pattern (no official image
exists), pinned binary, migrations+hooks copied in and run on startup.

pb_migrations/1_create_collections.js - schema as code: users (auth,
self-registration open), projects (owner-scoped), documents (owner-
AND project-scoped - project is REQUIRED, not optional, since a
planned future per-project category-mapping feature needs every
document scoped from day one), with a sourceFile field for the
original PDF/image (stored in R2 once configured).

pb_hooks/ensure_default_project.pb.js - auto-creates each new user's
"General" project (isDefault:true) the moment their account exists -
covers password and Google signup uniformly, guarantees the required
documents.project relation always has somewhere to point.

configure-secrets.sh - the only place R2/Google secrets are handled,
reading from a gitignored .env and PATCHing PocketBase's own REST API.
Never in a migration (those are committed to git).

Frontend: pocketbaseRepository.js (the one SDK instance),
authService.js (login/signup/Google/logout), authStore.js (Pinia,
synced to the SDK's own authStore), LoginView.vue, and App.vue's new
auth gate - talks to PocketBase directly, not proxied through Flask.

Verified via real REST API calls against the running container (not
just read): migrations create the expected collections/rules; a fresh
signup gets exactly one auto-created "General" project; a second
user's token can't see the first user's data; a document created with
no project correctly fails validation (confirming the frontend must
resolve one itself); authService's actual functions exercised via a
live Node script against the real container (signup, hook-created
project visible, logout, re-login). npm run build passes. measure.py
unaffected (no backend code touched).

Not yet verified - needs real R2/Google credentials this session
doesn't have: configure-secrets.sh itself, and the Google OAuth popup
flow (needs a real browser + real Google Cloud OAuth client, both
outside this repo's control - documented as setup prerequisites in
README.md).

This is Stage B.1 of 3 (schema + auth gate). B.2 (document persistence
moves from localStorage to PocketBase) and B.3 (the project sidebar
UI) are not started yet.
2026-10-13 00:26:41 -04:00
JasonFraser 6e4da3f385 Restructure frontend to Vue 3 + Vite (Stage 2 of 2)
Rebuilds templates/index.html (896 lines of vanilla JS, no framework, no
build step) as frontend/, a Vue 3 app per ENTERPRISE_STANDARDS.md's
frontend layering (views -> components -> composables -> services ->
repositories, Pinia for stores) - same agreed scope as Stage 1 (backend):
structure + commenting, not the full SaaS-shaped doc.

The full original file was read in full before starting (every function
enumerated against the plan, not re-derived from memory) to make sure
nothing documented in CLAUDE.md's "Frontend / UI state" section got
simplified away: sticky side-by-side layout with a draggable resizer,
Hide/Show Source Doc, collapsible Result card, per-row pencil-to-edit,
comma-formatted numbers, localStorage persistence with a restore banner,
image zoom controls, the pencil-icon-color and description-autogrow
fixes from earlier this session.

The original ask that started this whole detour - processing-phase text
with an animated ellipsis during /api/process - lands here as the one
genuinely new feature (useProcessingPhases.js + ProcessingIndicator.vue),
honestly simulated rather than claiming real progress (the backend is
one synchronous request with no streaming signal).

backend/app.py now serves frontend/dist (built via a new Dockerfile
multi-stage build: a node stage runs npm ci && npm run build, the Python
stage copies backend/ + that dist/ output) instead of rendering a Jinja
template - a manual SPA-fallback route serves a real static asset if one
exists at the requested path, else index.html. One real bug caught and
fixed before this ever ran: the first version also left Flask's own
automatic static route enabled, registering a duplicate/conflicting rule
against the same /<path:...> pattern as the manual catch-all - fixed by
disabling Flask's own static handling (static_folder=None) entirely.

Verified without a browser (the extension could not connect, tried
repeatedly): npm run build succeeds, formatService.js's pure functions
tested directly in Node, every prop/emit/store reference cross-checked
by hand across all ~20 new files, and full regression through the real
Docker container (SPA serving, static assets, /health, /api/* routing,
dual-engine extraction, measure.py - all unaffected or identical to
baseline). Actual interactive behavior - upload, drag/drop, the
processing-phase animation, editing, zoom, the resizer, persistence/
restore, download - was verified by the user in their own browser, not
by Claude. templates/index.html was kept in place as a fallback until
that confirmation came back, then deleted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-12 06:32:49 -04:00