Skip to content

fix(esign): place boxes on the page in view, drag them across pages, step through spots - #217

Merged
lorenzocorallo merged 1 commit into
mainfrom
fix/esign-placement-ux
Dec 5, 2026
Merged

lorenzocorallo merged 1 commit into
mainfrom
fix/esign-placement-ux

Conversation

@lorenzocorallo

Copy link
Copy Markdown
Member

Admin only. No backend or agent change, so it can merge and deploy in any order.

1. A new box lands on the page in view

  • Before: "Add a place" lived in the row's menu and waited for a click on a page; a signer added without a label always got a box at the foot of the last page, wherever the user was looking.
  • Now "Add spot" (a visible button under every signer) adds the box at once on the page in the middle of the viewer, in clear space and on screen when there is room (freePlaceOn in places.ts: clear of text, signatures and other boxes, closest to the middle of the visible band). A signer added while the user has scrolled to an earlier page gets their box there; otherwise the documented foot-of-the-last-page layout stays.
  • The viewer's "Page n of N" now follows the page in the middle of the viewer on scroll (the 50%-visible observer missed pages taller than the viewer).

2. Drag across pages, never into an invalid position

  • SignatureBox drags to any page: over another page the box is drawn there and moves to it on drop, re-measured for that page (same size in points) and kept inside it. Near the viewer's top/bottom edge the drag scrolls the pages.
  • Between pages or off them the box turns red with "Drop it on a page"; a drop there snaps back to its last position on a page.
  • placement.ts mirrors the backend's rules (backend/src/esign/placement.ts: page in range, ≥3% a side, ≤1; the backend clamps into the page, the client requires it). Overlap is allowed, as on the backend. A box breaking a rule is red with the reason and keeps Send request / Sign and send / Sign with CIE disabled with the reason under it (New request, request page, Sign together).

3. Several spots per signer, one signing action

Investigated end to end: this already works with one PIN. The backend's job holds all of a signer's places; agentPrepare/agentComplete answer next until every full signature is made, and the first signature's incremental update also draws every mark (PAdES-covered, pades.ts). The agent's signJob (sign-agent internal/server/server.go) loops prepare → SignDigest → complete on one card session opened with one PIN. So the smallest change is UI-only:

  • "Add spot" is now a visible button under each signer (was hidden in the ⋮ menu as "Add a place").
  • Extra spots default to marks (the one PDF signature shown again), switchable to a full signature from the chip; either way one PIN signs them all, as the row now says ("One PIN signs all 3 spots.").

4. Spot navigation

"‹ Spot 2 of 5 ›" in the viewer toolbar plus [ / ] (ignored in fields, menus and dialogs) step through the boxes in reading order, centring each and ringing it for a moment: every box in New request, the viewer's own boxes still to sign on the request page and in Sign together.

Verification

  • pnpm check, pnpm typecheck, pnpm test (new tests/esign-placement.test.mjs), pnpm build.
  • Agent mode against a local backend (origin/main, own DB) with a 4-page PDF (page 3 landscape): Add spot on page 2 placed a mark there in view; dragged it into the gap (red, "Drop it on a page", snapped back on drop), to the landscape page (width re-measured 32% → 22.5%) and back on the request page as the signer; ]/[ stepped through 3 spots; created a request with 1 signature + 2 marks and opened it as the signer and in Sign together.
  • Not verified: an actual CIE signature (no card/soft agent run here); the one-session multi-signature path is existing backend/agent behaviour (tracker item "Real-card check that one PIN can make several signatures in a session" stays open).

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 09702bb7-c616-4dc4-bb1e-90b958f81ba1
Commits

Reviewing files that changed from the base of the PR and between 151fb8a and 49ac77f.

Files selected for processing: 12

  • docs/design.md
  • docs/esign/TRACKER.md
  • src/features/esign/batch-page.tsx
  • src/features/esign/new-request-page.tsx
  • src/features/esign/pdf-viewer.tsx
  • src/features/esign/placement.ts
  • src/features/esign/places.ts
  • src/features/esign/request-page.tsx
  • src/features/esign/signature-box.tsx
  • src/features/esign/signer-rows.tsx
  • src/features/esign/spot-nav.tsx
  • tests/esign-placement.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…step through spots

- "Add spot" under each signer adds a box at once on the page in the middle of
  the viewer, in clear space on screen (`freePlaceOn`), instead of waiting for a
  click; a signer added while looking at an earlier page gets their box there.
- Extra spots are marks by default: one PDF signature, shown again, so one PIN
  signs every spot (full signatures stay available and share the agent's one
  card session, as before). The row says "One PIN signs all N spots."
- Boxes drag to any page: drawn over the page under the pointer, re-measured for
  it on drop and kept inside it; the viewer scrolls near its edges; between or
  off pages the box turns red ("Drop it on a page") and snaps back on drop.
- The backend's placement rules are mirrored in `placement.ts`: a box it would
  refuse is red with the reason and keeps Send / Sign with CIE off.
- "‹ Spot 2 of 5 ›" and `[` / `]` step through the boxes in New request, on the
  request page and in Sign together.
- The viewer's page counter follows the page in its middle on scroll.
@lorenzocorallo
lorenzocorallo merged commit d3198b3 into main Dec 5, 2026
2 checks passed
@lorenzocorallo
lorenzocorallo deleted the fix/esign-placement-ux branch December 5, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant