MEGAINFRA-WEBAPP/src/app/clock
DEls 068f622c0a feat(clock): photograph several pages, send them as one document
A delivery note that runs to two or three sheets has to arrive as ONE
batch. Sent a page at a time it became separate batches, and then
nothing could tell that page 2's line items belonged to page 1's note —
the totals sat on one batch and the items on another, with no way back.

Pages now accumulate. Take one, then Retake, Add page, or Send all.
A thumbnail strip shows what has been taken so far, ringed green or red
by how each page measured, so a mis-shot can be dropped without starting
the document over and nobody has to remember whether they got page 2.

Several pages are bundled into a single PDF and enter the pipeline
exactly like a scanned multi-page document: split.ts rasterises each
page, extract.ts reads each in isolation, and segment.ts decides from
the printed document numbers whether it is one note over three pages or
three separate notes. The person holding the phone does not have to know
which, which matters, because standing next to a truck they often can't.

The bundle is verified against the pipeline's own tools rather than
assumed compatible: the test writes one and runs pdfinfo and pdftoppm
over it — the exact binaries split.ts shells out to — checking the page
count, that every page rasterises, that portrait stays portrait, and
that page order survives. A bundle the pipeline could not open would
otherwise fail at the far end of an upload, on site, after the truck had
gone.

One page still uploads as its own JPEG: smaller, and it never loads the
PDF library at all. pdf-lib is imported dynamically and webpack keeps it
in a 412K chunk of its own, leaving the clock page's bundle at 24K —
checked in the build output, not hoped for.

Size is checked before sending, mirroring MAX_FILE_BYTES on the upload
route, so an oversized bundle is caught while the document is still in
front of the person rather than as a 400 afterwards.

1027 tests, typecheck clean, production build clean. The capture path
itself still needs a real phone — the browser pane here has no camera
and cannot reach localhost.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 19:10:16 +02:00
..
apple-icon.png
clock-view.tsx feat(clock): photograph a delivery note on site, and check it can be read 2026-09-18 18:36:41 +02:00
document-scanner.tsx feat(clock): photograph several pages, send them as one document 2026-09-18 19:10:16 +02:00
layout.tsx
opengraph-image.alt.txt
opengraph-image.png
page.tsx feat(clock): photograph a delivery note on site, and check it can be read 2026-09-18 18:36:41 +02:00
person-scanner.tsx