Skip to content

feat(documents): add document catalog and PDF viewer - #220

Merged
toto04 merged 7 commits into
mainfrom
feat/documents-page
Nov 23, 2026
Merged

toto04 merged 7 commits into
mainfrom
feat/documents-page

Conversation

@BIA3IA

@BIA3IA BIA3IA commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Adds /documents, where visitors browse official association documents, view PDFs and download them. The catalog reads categories and the latest dated PDF version from the backend; official public PDFs fill in documents that have not been uploaded yet.

Requires backend #132 and its published npm types. Keep this PR in draft until @polinetwork/backend has been updated to that release. No local package paths or declaration patches are included.

  • Removes demonstration documents and uses the shared page layout and navigation.
  • Serves catalog PDFs through the same origin with a timeout and no-store on the upstream fetch and all responses, so replacements and deletions take effect on subsequent requests.
  • Preserves fallback documents during partial uploads and distinguishes backend outages from missing documents.
  • Keeps page navigation and zoom usable after a page render failure, limits canvas dimensions, and preserves keyboard focus at page/zoom limits.
  • Uses separate category and heading IDs, UTC date formatting and wrapping for long admin content.

Validation: Biome, typecheck against the final local backend package, all 9 Node tests, and production build pass. Tests cover fallback merging, temporary outages, PDF caching/errors, ID collisions and canvas dimensions.

Admin dashboard: admin #162.

Design: https://www.figma.com/design/oSBlivb9Gm7H3ZkSdAtUHx/PoliNetwork-Website?node-id=6516-8013&m=dev

Review follow-up

  • Depends on @polinetwork/backend ^9.3.0 (backend Navbar on Mobile #132 is merged and published).
  • The PDF proxy's timeout now covers only the wait for upstream headers, so large PDFs on slow connections aren't truncated, and a client that disconnects cancels the upstream request.
  • During a backend outage the viewer shows an Italian "Documento temporaneamente non disponibile" message (noindex) with retry and back links, instead of Next's built-in error page.
  • The document cards fit 320px phones, and titles break at word boundaries.
  • Viewer: long titles are clamped on phones, the zoom reset button announces the current zoom, a failed page shows a single alert, and links inside PDFs work.
  • Fallback documents merge into an admin category that has the same title.

Validation: Biome, typecheck, production build and 12/12 Node tests pass. A local end-to-end run (admin → backend → site, with uploads served from local disk) covered: create, upload, reorder, version deletion, document and category deletion, and the backend being down.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 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 55 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: 9de00234-f682-4c44-a73d-355dd67eca35
Commits

Reviewing files that changed from the base of the PR and between ae1cb4a and e66c2cd.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 16

  • .gitignore
  • package.json
  • scripts/copy-pdf-assets.mjs
  • src/app/documents/file/[slug]/route.ts
  • src/app/documents/page.tsx
  • src/app/documents/view/[slug]/page.tsx
  • src/components/conditional-footer.tsx
  • src/components/documents/document-category-card.tsx
  • src/components/documents/pdf-viewer-loader.tsx
  • src/components/documents/pdf-viewer.tsx
  • src/components/documents/types.ts
  • src/components/documents/utils.ts
  • src/components/header/constants.ts
  • src/queries/documents.ts
  • tests/documents.test.mjs
  • tsconfig.json
  • 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

@BIA3IA BIA3IA changed the title feat(documents): add document page with mock PDFs feat(documents): add document catalog and PDF viewer Nov 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BIA3IA
BIA3IA marked this pull request as draft November 13, 2026 19:41
BIA3IA and others added 3 commits November 13, 2026 20:59
Brings in the web.documents router the documents page reads from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Bound the upstream timeout to the response headers so slow downloads
  are no longer truncated, and cancel the upstream when the client leaves
- Show an Italian, noindexed outage message on the viewer instead of
  Next's built-in error page
- Give document titles room on 320px phones and wrap at word boundaries
- Clamp long titles in the viewer, name the zoom level in the reset
  button, show a single alert when a page fails, enable PDF links
- Merge fallback documents into an admin category with the same title

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BIA3IA
BIA3IA marked this pull request as ready for review November 13, 2026 22:50
@toto04
toto04 merged commit c6c8e27 into main Nov 23, 2026
2 checks passed
@toto04
toto04 deleted the feat/documents-page branch November 23, 2026 13:32
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.

2 participants