Skip to content

[OGL-1376] feat(etno): add pdf media viewer#17

Open
rastislav-chynoransky wants to merge 3 commits into
mainfrom
feat/etno-pdf-viewer
Open

[OGL-1376] feat(etno): add pdf media viewer#17
rastislav-chynoransky wants to merge 3 commits into
mainfrom
feat/etno-pdf-viewer

Conversation

@rastislav-chynoransky

@rastislav-chynoransky rastislav-chynoransky commented Apr 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • New Features

    • Implemented enhanced PDF viewer with zoom controls (in/out) and page navigation (previous/next page)
    • Added loading state support for PDF content
  • Style

    • Improved viewer layout with responsive scrolling and fixed positioning on larger screens
  • Chores

    • Added internationalization support for PDF viewer messaging

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a56bf660-47e2-49f2-84af-0299469e2c53

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A new PDF viewer feature is implemented using the @embedpdf library. The old basic PdfViewer component was removed and replaced with a feature-rich implementation featuring a dedicated toolbar with zoom and page navigation controls. Dependencies, localization strings, and supporting UI components were updated accordingly.

Changes

Cohort / File(s) Summary
PDF Viewer Components
apps/etno/src/components/DetailViewers/PdfViewer/PdfViewer.vue, PdfViewerToolbar.vue
New Vue components implementing PDF rendering using @embedpdf library with engine initialization, plugin registration (document manager, viewport, scroll, render, zoom), and toolbar for page navigation and zoom controls.
Dependency Additions
apps/etno/package.json
Added @embedpdf core, engines, and plugins (document-manager, render, scroll, viewport, zoom) at version ^2.14.0.
Localization
apps/etno/src/i18n/en.json, sk.json
Added detail.viewer.pdf.loading translation keys for PDF loading state messages in English and Slovak.
Component Integration Updates
apps/etno/src/views/DetailView.vue
Updated PDF viewer import path from DetailViewers/PdfViewer.vue to DetailViewers/PdfViewer/PdfViewer.vue to reference new component location.
Infrastructure
apps/etno/src/components/DetailViewers/BaseViewer.vue
Added responsive Tailwind classes (lg:h-[calc(100vh-3.5rem)], overflow-auto, sticky, top-14) for height constraints and scrolling on large screens.
UI Component Enhancement
packages/components/src/components/atoms/BaseIcon/BaseIcon.vue
Added zoomIn and zoomOut icon mappings using Phosphor's PhMagnifyingGlassPlus and PhMagnifyingGlassMinus components.
Removed Component
apps/etno/src/components/DetailViewers/PdfViewer.vue
Deleted legacy PdfViewer placeholder component.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant DetailView as DetailView Component
    participant PdfViewer as PdfViewer Component
    participant EmbedPDF as `@embedpdf` Engine
    participant Plugins as Plugins<br/>(Scroll, Zoom, Render)
    participant Toolbar as PdfViewerToolbar

    User->>DetailView: Navigate to Detail with PDF media
    DetailView->>PdfViewer: Mount with detail prop containing PDF URL
    PdfViewer->>EmbedPDF: Initialize engine and register plugins
    PdfViewer->>EmbedPDF: Initialize DocumentContent with activeDocumentId
    EmbedPDF->>Plugins: Load plugins (document-manager, scroll, viewport, zoom)
    
    Note over PdfViewer,Plugins: Loading State
    PdfViewer->>User: Display "Loading PDF..." message
    
    Note over EmbedPDF,Plugins: Engine Ready
    EmbedPDF->>PdfViewer: Engine and plugins ready
    PdfViewer->>Plugins: Query page dimensions and states
    PdfViewer->>User: Render Viewport with Scroller and RenderLayers per page
    PdfViewer->>Toolbar: Mount with documentId reference
    
    User->>Toolbar: Click zoom in/out or page navigation
    Toolbar->>Plugins: Call zoom?.zoomIn(), scroll?.scrollToPreviousPage(), etc.
    Plugins->>EmbedPDF: Update rendering state
    EmbedPDF->>PdfViewer: Update RenderLayers with new page content
    PdfViewer->>User: Display updated PDF view
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 whiskers twitch with joy
Through @embedpdf's enchanted door,
PDFs dance and viewers explore!
With zoom and scroll, a bunny's delight,
Documents shine in brilliant light! 📄🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely describes the main objective of the pull request: adding a PDF media viewer to the etno application.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/etno-pdf-viewer

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@rastislav-chynoransky rastislav-chynoransky changed the title feat(etno): add pdf media viewer [OGL-1376] feat(etno): add pdf media viewer Apr 21, 2026
@notion-workspace

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/etno/src/components/DetailViewers/PdfViewer/PdfViewer.vue`:
- Around line 20-44: Wrap the duplicated v-if and repeated prop by replacing the
separate v-if="isLoaded" on PdfViewerToolbar and Viewport with a single
<template v-if="isLoaded"> that contains both PdfViewerToolbar and Viewport so
they mount/unmount together; inside that template pass
:document-id="activeDocumentId" to both children (keep the existing :page-index
on RenderLayer and :document-id on Scroller) and remove the individual v-if and
duplicate prop on PdfViewerToolbar and Viewport to avoid repetition.
- Around line 67-84: The current pdfUrl and plugins are computed once in setup
and use a hardcoded fallback; change pdfUrl to a computed (or ref updated via
watch) that derives from props.detail?.media?.documents?.[0]?.url so it updates
when detail is populated, remove the external fallback URL entirely, and make
plugins recompute whenever that computed pdfUrl changes (e.g. create plugins
inside a computed or rebuild them in a watch) so DocumentManagerPluginPackage /
createPluginRegistration and the initialDocuments entry use the live url; also
update the template to render an explicit empty/error state when the computed
pdfUrl is falsy instead of loading an external fallback.

In `@apps/etno/src/components/DetailViewers/PdfViewer/PdfViewerToolbar.vue`:
- Around line 2-4: The toolbar's root <div> in PdfViewerToolbar.vue is missing
relative positioning so the absolutely positioned zoom controls ("Zoom Controls"
div with classes absolute left-1/2 -translate-x-1/2) can escape and anchor to an
ancestor; fix by adding the "relative" class to the root toolbar container (the
top-level div in PdfViewerToolbar.vue that currently has bg-white border-b px-4
py-2 flex items-center justify-end) so the centered zoom group is positioned
relative to the toolbar.
- Line 26: The navigation buttons in PdfViewerToolbar.vue currently check only
scrollState.currentPage which can flicker before the document loads; update the
:disabled bindings for both previous and next controls to also require
scrollState.totalPages > 0 (e.g., :disabled="scrollState.totalPages <= 0 ||
scrollState.currentPage <= 1" for Prev and :disabled="scrollState.totalPages <=
0 || scrollState.currentPage >= scrollState.totalPages" for Next) so navigation
stays disabled until totalPages is initialized; adjust the bindings referencing
scrollState.currentPage and scrollState.totalPages in the template (the
:disabled attributes) accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d6a1bbe9-3bcb-4d31-a92a-46b847e139db

📥 Commits

Reviewing files that changed from the base of the PR and between a1a07f7 and 0866ee2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • apps/etno/package.json
  • apps/etno/src/components/DetailViewers/BaseViewer.vue
  • apps/etno/src/components/DetailViewers/PdfViewer.vue
  • apps/etno/src/components/DetailViewers/PdfViewer/PdfViewer.vue
  • apps/etno/src/components/DetailViewers/PdfViewer/PdfViewerToolbar.vue
  • apps/etno/src/i18n/en.json
  • apps/etno/src/i18n/sk.json
  • apps/etno/src/views/DetailView.vue
  • packages/components/src/components/atoms/BaseIcon/BaseIcon.vue
💤 Files with no reviewable changes (1)
  • apps/etno/src/components/DetailViewers/PdfViewer.vue

Comment thread packages/components/src/components/viewers/PdfViewer/PdfViewer.vue
Comment thread apps/etno/src/components/DetailViewers/PdfViewer/PdfViewer.vue Outdated
Comment thread apps/etno/src/components/DetailViewers/PdfViewer/PdfViewerToolbar.vue Outdated
Comment thread apps/etno/src/components/DetailViewers/PdfViewer/PdfViewerToolbar.vue Outdated
@rastislav-chynoransky rastislav-chynoransky force-pushed the feat/etno-pdf-viewer branch 2 times, most recently from 56b52bc to d210100 Compare April 21, 2026 01:34
@rastislav-chynoransky rastislav-chynoransky changed the base branch from main to OGL-1223-media-viewer-as-shared-component April 26, 2026 18:25
Base automatically changed from OGL-1223-media-viewer-as-shared-component to main April 29, 2026 10:21
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.

3 participants