Skip to content

✨(front) file preview v2#658

Open
NathanVss wants to merge 19 commits intomainfrom
feat/preview-v2
Open

✨(front) file preview v2#658
NathanVss wants to merge 19 commits intomainfrom
feat/preview-v2

Conversation

@NathanVss
Copy link
Copy Markdown
Contributor

@NathanVss NathanVss commented Apr 10, 2026

Main UI changes

Before After
Capture d’écran 2026-04-14 à 14 58 27 Capture d’écran 2026-04-14 à 15 00 20
Capture d’écran 2026-04-14 à 14 58 45 Capture d’écran 2026-04-14 à 15 00 15
Capture d’écran 2026-04-14 à 14 58 21 Capture d’écran 2026-04-14 à 15 00 09
Capture d’écran 2026-04-14 à 14 58 16 Capture d’écran 2026-04-14 à 14 59 50

Behavior

  • Added the prev/next shortcut with keyboard arrows. Handle the focus well so that media timelines are still accessible.
  • Display the filename in the tab name

Refactor

  • Improved the structures of the components and folders so it is more comprehensive with domain scoped folders.
  • Improve className that did not respect BEM

Tests

Added more tests for existing media that were not tested yet. ( smoke testing )

Rename PreviewControls to PlayerPreviewControls and swap
material icons for ui-kit SVG icons. Move arrow-key seeking
from global keydown to the DurationBar input so it only
activates when the slider is focused, and add a focus-visible
outline for accessibility. Simplify VolumeBar styling by
removing unused btn-mute overrides.
These labels are used by the new preview actions dropdown
menu across English, French and Dutch.
Reorganize all viewer components under a viewers/ directory
and rewrite FilesPreview as the single orchestrator at the
preview root. Add ZoomControls shared component for image
and PDF viewers. The new layout centralizes the preview
chrome (header, controls bar, navigation) in FilesPreview
while each viewer only handles its own rendering.
Cover the download/print actions dropdown, keyboard
navigation between files, and the close button in the
new preview chrome.
The preview refactor renamed CSS classes from
pdf-preview__controls / pdf-preview__zoom-controls
to file-preview__controls / file-preview__controls__zoom.
Update the e2e tests to match.
The preview for files that cannot be rendered inline now shows the
filename as the title and folds the "unsupported format" notice into
the description paragraph as a bold disclaimer, so the panel reads as
"<filename> — Unsupported format. Download it to view." The download
CTA is promoted to a secondary neutral button to stand out on the
empty-state panel.

The i18n key file_preview.unsupported.title is renamed to disclaimer
in en/fr/nl and the copy shortened accordingly. search.spec.ts
assertions are updated to match the filename via getByRole("heading")
now that the preview wraps the title in a heading element.
The predicate in the preview close branch was (className) =>
className !== className, which compared the lambda parameter to
itself and therefore never matched, leaving stale class names on the
preview when the PDF thumbnail sidebar was closed. Rename the inner
parameter so the filter compares against the outer className as
intended.
The preview-related specs are now numerous enough to warrant their
own subfolder. Move pdf, heic and preview-actions specs into
__tests__/app-drive/file-preview/ so future preview tests land next
to them rather than at the drive-level root. Import and asset paths
are adjusted to the new depth, the heic row lookup is simplified to
getByRole("cell", ...), and the preview-actions spec gains a small
File Preview Header describe block to exercise the header controls.
Cover the audio viewer with a dedicated spec that uploads a small
mp3 fixture, opens the preview and checks the playback controls.
Ensures the audio branch of the preview rewrite stays covered as we
iterate on the other viewers.
Cover the image viewer with a dedicated spec that uploads a small
png fixture, opens the preview and asserts the image renders and
reacts to the viewer controls. Mirrors the audio/video specs so
each viewer has its own file.
Cover the video viewer with a dedicated spec that uploads a small
mp4 fixture, opens the preview and exercises the player controls.
Keeps the new viewer types consistently covered alongside the audio
and image specs.
Cover the fallback viewer that kicks in for file types the app
cannot render inline. A minimal .bin fixture exercises the redesign
so the filename, the "Unsupported format." disclaimer and the
secondary download button are all checked end to end.
Add entry about the file preview v2 iteration.
@PanchoutNathan
Copy link
Copy Markdown
Contributor

PanchoutNathan commented Apr 16, 2026

A few bugs noted (before the code review)

No animation needed

Enregistrement.de.l.ecran.2026-04-16.a.10.05.01.mov

The controls are not well placed for the video player (He should be at the bottom like the others)

Capture d’écran 2026-04-16 à 10 21 51

This feature is not implemented.

Capture d’écran 2026-04-16 à 10 20 52

Comment thread src/frontend/apps/drive/src/features/ui/preview/FilesPreview.tsx Outdated
Comment on lines +122 to +125
const handlePrint = () => {
if (!currentFile) return;
window.open(currentFile.url_preview, "_blank");
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand why "handle Print" opens a new tab; it's hard for the user to understand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

what do you suggest instead?

Comment on lines +227 to +235
useEffect(() => {
if (openedFileId) {
const index = data.findIndex((file) => file.id === openedFileId);
const newIndex = index > -1 ? index : -1;
setCurrentIndex(newIndex);
} else {
setCurrentIndex(-1);
}
}, [openedFileId]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And if data change ?

Comment thread src/frontend/apps/drive/src/features/ui/preview/FilesPreview.tsx
Comment on lines +309 to +311
<div className="file-preview__title">
<FileIcon file={currentFile} type="mini" size="small" />
<h1 className="file-preview__title">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

twice the same class: file-preview__title. weird right?

interface PdfControlsProps {
numPages: number;
pageInputValue: string;
isSidebarOpen: boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

never used

Comment on lines +34 to +36
const moreButton = filePreview.locator(
".file-preview__header__content__right button:has(.material-icons)",
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unused

@NathanVss
Copy link
Copy Markdown
Contributor Author

A few bugs noted (before the code review)

No animation needed

Enregistrement.de.l.ecran.2026-04-16.a.10.05.01.mov

The controls are not well placed for the video player (He should be at the bottom like the others)

Capture d’écran 2026-04-16 à 10 21 51 ## This feature is not implemented. Capture d’écran 2026-04-16 à 10 20 52

I cannot reproduce the image splash effect, is there a specific step to repro ? :o

The component lives in DurationBar.tsx but was exported as ProgressBar,
which was confusing. Rename the export and update the two call sites
in AudioPlayer and VideoPlayer.
The effect that toggles the pdf-sidebar class scheduled a setTimeout
without returning a cleanup, so the timer could fire after the file
preview unmounted. Capture the timeout id and clear it on cleanup.
Add the en/fr/nl entries needed by the upcoming WOPI "open in editor"
placeholder and the image viewer loading label.
The loading spinner label was hardcoded in French. Use the translated
file_preview.image.loading key so other locales render correctly.
WOPI editors (OnlyOffice / Collabora) work better as a full-page
experience than embedded inside the preview modal. Double-clicking a
WOPI file in the grid or activating one from the search modal now
opens /wopi/:id in a new tab. The preview modal still shows an
"Open in editor" placeholder when a user navigates onto a WOPI file
via keyboard, so the preview flow stays consistent.

The former WopiEditor component is renamed WopiEditorFrame and
hosted on the new page. The inline rename-sync path is removed
because the editor no longer lives inside the items list.
Follow the WOPI-in-new-tab change: the double-click scenario now
asserts that a new page opens with the office iframe and that the
preview modal stays closed, a new test covers the "Open in editor"
placeholder reached by keyboard navigating onto a WOPI file, and the
copy/paste scenario drives the detached wopiPage. Refresh canvas
snapshots accordingly and drop the obsolete per-spec snapshot copies.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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