-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Show friendly message for non-previewable file previews #16372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Removed unused previewable extension logic from AttachmentRow. - Simplified link rendering in AttachmentRow for better readability. - Enhanced DocumentViewer to handle non-previewable files with a user-friendly message and download option. - Added styled components for unavailable preview messages in DocumentViewer.
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:55958 This environment will automatically shut down when the PR is closed or after 5 hours. |
Greptile OverviewGreptile SummaryRefactored file preview handling to show friendly messages for non-previewable files. The previewability check was moved from Key changes:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant AttachmentRow
participant AttachmentList
participant Modal
participant DocumentViewer
User->>AttachmentRow: Click attachment link
AttachmentRow->>AttachmentRow: handleOpenDocument()
alt Preview enabled (onPreview defined)
AttachmentRow->>AttachmentRow: e.preventDefault()
AttachmentRow->>AttachmentList: onPreview(attachment)
AttachmentList->>Modal: openModal(PREVIEW_MODAL_ID)
Modal->>DocumentViewer: Render with documentUrl and documentName
DocumentViewer->>DocumentViewer: Check isPreviewable
alt File is previewable
DocumentViewer->>DocumentViewer: Render DocViewer component
DocumentViewer-->>User: Show file preview
else File is NOT previewable
DocumentViewer->>DocumentViewer: Render friendly message UI
DocumentViewer-->>User: Show "Preview Not Available" with download button
end
else Preview disabled (onPreview undefined)
AttachmentRow-->>User: Link opens in new tab (default behavior)
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
packages/twenty-front/src/modules/activities/files/components/AttachmentRow.tsx, line 143-154 (link)logic: logic bug: clicking a non-previewable file now triggers both the modal and opens a new tab
The
onClickhandler will fire regardless of whether the file is previewable, callingonPreview(attachment)which opens the modal. The link also opens a new tab becausee.preventDefault()only runs whenonPreviewexists AND the user doesn't press modifier keys.For non-previewable files, we want the link to open in a new tab WITHOUT opening the modal. The previous code checked
isPreviewablebefore deciding which behavior to use.Consider restoring the previewability check or moving it into
handleOpenDocument:But you'll also need to add back the
isPreviewablelogic to conditionally attach the onClick handler.
2 files reviewed, 1 comment
Closes #15771