π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add feed item navigation to comments and likes sidebars
Anand Baburajanfe5c1d35b10a
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsxindex 416fc1222a..fba0433aaa 100644--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx@@ -11,7 +11,10 @@ import {isSaveComplete,type SaveGroup,} from "ente-gallery/components/utils/save-groups";-import { FeedSidebar } from "ente-gallery/components/viewer/FeedSidebar";+import {+ FeedSidebar,+ type FeedItemClickInfo,+} from "ente-gallery/components/viewer/FeedSidebar";import { sortFiles } from "ente-gallery/utils/file";import type { Collection } from "ente-media/collection";import type { EnteFile } from "ente-media/file";@@ -58,6 +61,10 @@ type GalleryBarAndListHeaderProps = Omit<setFileListHeader: (header: FileListHeaderOrFooter) => void;saveGroups: SaveGroup[];files: EnteFile[];+ /**+ * Called when a feed item is clicked to navigate to the file.+ */+ onFeedItemClick?: (info: FeedItemClickInfo) => void;} & Pick<CollectionHeaderProps,| "onRemotePull"@@ -123,6 +130,7 @@ export const GalleryBarAndListHeader: React.FC<onSelectPerson,setFileListHeader,files,+ onFeedItemClick,}) => {const { show: showAllAlbums, props: allAlbumsVisibilityProps } =useModalVisibility();@@ -295,6 +303,14 @@ export const GalleryBarAndListHeader: React.FC<files={files}currentUserID={user.id}emailByUserID={emailByUserID}+ onItemClick={+ onFeedItemClick+ ? (info) => {+ collectionFeedVisibilityProps.onClose();+ onFeedItemClick(info);+ }+ : undefined+ }/></>)}diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsxindex 467029019b..43631ee744 100644--- a/web/apps/photos/src/components/FileListWithViewer.tsx+++ b/web/apps/photos/src/components/FileListWithViewer.tsx@@ -8,6 +8,7 @@ import { formattedDate } from "ente-base/i18n-date";import type { AddSaveGroup } from "ente-gallery/components/utils/save-groups";import {FileViewer,+ type FileViewerInitialSidebar,type FileViewerProps,} from "ente-gallery/components/viewer/FileViewer";import { downloadAndSaveFiles } from "ente-gallery/services/save";@@ -20,7 +21,7 @@ import type { CollectionSummary } from "ente-new/photos/services/collection-summimport { PseudoCollectionID } from "ente-new/photos/services/collection-summary";import { updateMapEnabled } from "ente-new/photos/services/settings";import { t } from "i18next";-import { useCallback, useMemo, useState } from "react";+import { useCallback, useEffect, useMemo, useState } from "react";import AutoSizer from "react-virtualized-auto-sizer";import { uploadManager } from "services/upload-manager";import {@@ -57,6 +58,23 @@ export type FileListWithViewerProps = {onRemotePull: () => Promise<void>;activeCollectionSummary?: CollectionSummary;activeCollection?: Collection;+ /**+ * If set, the file viewer will open to this file index on mount/update.+ * Set to undefined after the navigation is complete.+ */+ pendingFileIndex?: number;+ /**+ * The sidebar to open when navigating to a file from feed.+ */+ pendingFileSidebar?: FileViewerInitialSidebar;+ /**+ * The comment ID to highlight when navigating from feed.+ */+ pendingHighlightCommentID?: string;+ /**+ * Called after the pending navigation is consumed.+ */+ onPendingNavigationConsumed?: () => void;/*** A function that can be used to create a UI notification to track the* progress of user-initiated download, and to cancel it if needed.@@ -154,9 +172,19 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({onAddFileToCollection,onScroll,onVisibleDateChange,+ pendingFileIndex,+ pendingFileSidebar,+ pendingHighlightCommentID,+ onPendingNavigationConsumed,}) => {const [openFileViewer, setOpenFileViewer] = useState(false);const [currentIndex, setCurrentIndex] = useState(0);+ const [initialSidebar, setInitialSidebar] = useState<+ FileViewerInitialSidebar | undefined+ >(undefined);+ const [highlightCommentID, setHighlightCommentID] = useState<+ string | undefined+ >(undefined);const { show: showMapDialog, props: mapDialogVisibilityProps } =useModalVisibility();const { onGenericError } = useBaseContext();@@ -169,6 +197,32 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({: (colorSchemeMode ?? theme.palette.mode);const isDarkMode = resolvedMode === "dark";+ // Handle pending navigation from feed item clicks+ useEffect(() => {+ if (pendingFileIndex !== undefined) {+ setCurrentIndex(pendingFileIndex);+ setInitialSidebar(pendingFileSidebar);+ setHighlightCommentID(pendingHighlightCommentID);+ setOpenFileViewer(true);+ onSetOpenFileViewer?.(true);+ onPendingNavigationConsumed?.();+ }+ }, [+ pendingFileIndex,+ pendingFileSidebar,+ pendingHighlightCommentID,+ onSetOpenFileViewer,+ onPendingNavigationConsumed,+ ]);++ // Clear initial sidebar state when file viewer closes+ const handleCloseFileViewerInternal = useCallback(() => {+ setInitialSidebar(undefined);+ setHighlightCommentID(undefined);+ onSetOpenFileViewer?.(false);+ setOpenFileViewer(false);+ }, [onSetOpenFileViewer]);+const annotatedFiles = useMemo((): FileListAnnotatedFile[] =>files.map((file) => ({@@ -187,11 +241,6 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({[onSetOpenFileViewer],);- const handleCloseFileViewer = useCallback(() => {- onSetOpenFileViewer?.(false);- setOpenFileViewer(false);- }, [onSetOpenFileViewer]);-const handleTriggerRemotePull = useCallback(() => void onRemotePull(),[onRemotePull],@@ -297,8 +346,10 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({</AutoSizer><FileVieweropen={openFileViewer}- onClose={handleCloseFileViewer}+ onClose={handleCloseFileViewerInternal}initialIndex={currentIndex}+ initialSidebar={initialSidebar}+ highlightCommentID={highlightCommentID}disableDownload={!enableDownload}isInTrashSection={activeCollectionID == PseudoCollectionID.trashdiff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 8d2ed8f90b..c704348ccc 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -57,6 +57,8 @@ import { savedAuthToken } from "ente-base/token";import { FullScreenDropZone } from "ente-gallery/components/FullScreenDropZone";import { type UploadTypeSelectorIntent } from "ente-gallery/components/Upload";import { useSaveGroups } from "ente-gallery/components/utils/save-groups";+import { type FeedItemClickInfo } from "ente-gallery/components/viewer/FeedSidebar";+import { type FileViewerInitialSidebar } from "ente-gallery/components/viewer/FileViewer";import { type Collection } from "ente-media/collection";import { type EnteFile } from "ente-media/file";import { type ItemVisibility } from "ente-media/file-metadata";@@ -191,6 +193,13 @@ const Page: React.FC = () => {albumId?: number;}>({ open: false });+ // Pending navigation from feed item click+ const [pendingFileNavigation, setPendingFileNavigation] = useState<{+ fileIndex: number;+ sidebar?: FileViewerInitialSidebar;+ commentID?: string;+ }>();+/*** Tracks a pending file addition operation.*@@ -633,6 +642,40 @@ const Page: React.FC = () => {setTimeout(hideLoadingBar, 0);}, [showLoadingBar, hideLoadingBar]);+ /**+ * Handle click on a feed item to navigate to the file viewer.+ */+ const handleFeedItemClick = useCallback(+ (info: FeedItemClickInfo) => {+ // Find the file index in filteredFiles by fileID+ const fileIndex = filteredFiles.findIndex(+ (f) => f.id === info.fileID,+ );+ if (fileIndex === -1) {+ // File not found in current view - might need to switch to the collection+ log.warn(+ `Feed navigation: file ${info.fileID} not found in current view`,+ );+ return;+ }++ // Determine which sidebar to open+ const sidebar: FileViewerInitialSidebar =+ info.type === "liked_photo" ? "likes" : "comments";++ setPendingFileNavigation({+ fileIndex,+ sidebar,+ commentID: info.commentID,+ });+ },+ [filteredFiles],+ );++ const handlePendingNavigationConsumed = useCallback(() => {+ setPendingFileNavigation(undefined);+ }, []);+/*** Pull latest collections, collection files and trash items from remote.*@@ -1327,6 +1370,7 @@ const Page: React.FC = () => {onRemotePull={remotePull}onSelectPerson={handleSelectPerson}files={filteredFiles}+ onFeedItemClick={handleFeedItemClick}/><Upload@@ -1426,6 +1470,12 @@ const Page: React.FC = () => {onSelectCollection={handleSelectCollection}onSelectPerson={handleSelectPerson}onAddFileToCollection={handleAddSingleFileToCollection}+ pendingFileIndex={pendingFileNavigation?.fileIndex}+ pendingFileSidebar={pendingFileNavigation?.sidebar}+ pendingHighlightCommentID={pendingFileNavigation?.commentID}+ onPendingNavigationConsumed={+ handlePendingNavigationConsumed+ }/>)}<Export {...exportVisibilityProps} {...{ collectionNameByID }} />diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsxindex 40275e37ac..10929553e1 100644--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx@@ -381,6 +381,10 @@ export interface CommentsSidebarProps extends ModalVisibilityProps {collectionID: number,reactionID: string,) => void;+ /**+ * If set, the sidebar will scroll to and highlight this comment.+ */+ highlightCommentID?: string;}/**@@ -407,6 +411,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({onCommentDeleted,onCommentReactionAdded,onCommentReactionDeleted,+ highlightCommentID,}) => {const [commentText, setCommentText] = useState("");const [replyingTo, setReplyingTo] = useState<Comment | null>(null);@@ -450,6 +455,9 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({Map<number, UnifiedReaction[]>>(new Map());+ // Track whether we've scrolled to the highlight comment for this open+ const hasScrolledToHighlightRef = useRef(false);+// Focus input when replying to a commentuseEffect(() => {if (replyingTo && inputRef.current) {@@ -457,6 +465,101 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({}}, [replyingTo]);+ // Reset highlight tracking when sidebar closes+ useEffect(() => {+ if (!open) {+ hasScrolledToHighlightRef.current = false;+ }+ }, [open]);++ // Scroll to and highlight the target comment when opening from feed+ useEffect(() => {+ if (+ !open ||+ !highlightCommentID ||+ hasScrolledToHighlightRef.current ||+ !commentsContainerRef.current ||+ loading ||+ comments.length === 0+ ) {+ return;+ }++ let highlightTimeout: ReturnType<typeof setTimeout> | undefined;+ let fadeTimeout: ReturnType<typeof setTimeout> | undefined;+ let cleanupTimeout: ReturnType<typeof setTimeout> | undefined;+ let blinkInterval: ReturnType<typeof setInterval> | undefined;++ // Wait for DOM to update after comments state change+ const initialTimeout = setTimeout(() => {+ const commentWrapper = commentsContainerRef.current?.querySelector(+ `[data-comment-id="${highlightCommentID}"]`,+ );+ if (commentWrapper) {+ hasScrolledToHighlightRef.current = true;++ // Scroll to the comment+ commentWrapper.scrollIntoView({+ behavior: "smooth",+ block: "center",+ });++ // Find the bubble element inside the wrapper+ const bubbleElement = commentWrapper.querySelector<HTMLElement>(+ "[data-comment-bubble]",+ );++ if (bubbleElement) {+ // Wait for scroll to mostly complete, then apply blink highlight+ highlightTimeout = setTimeout(() => {+ const computedStyle = getComputedStyle(bubbleElement);+ const originalBg = computedStyle.backgroundColor;++ // Parse the RGB values to create 80% opacity version+ const rgbMatch = originalBg.match(+ /rgba?\((\d+),\s*(\d+),\s*(\d+)/,+ );+ if (!rgbMatch) return;++ const [, r, g, b] = rgbMatch;+ const dimmedBg = `rgba(${r}, ${g}, ${b}, 0.6)`;++ bubbleElement.style.transition =+ "background-color 0.2s ease-in-out";++ let isDimmed = false;+ blinkInterval = setInterval(() => {+ isDimmed = !isDimmed;+ bubbleElement.style.backgroundColor = isDimmed+ ? dimmedBg+ : originalBg;+ }, 300);++ // Stop blinking after 1.5 seconds+ fadeTimeout = setTimeout(() => {+ if (blinkInterval) clearInterval(blinkInterval);+ bubbleElement.style.backgroundColor = originalBg;++ // Clean up transition style+ cleanupTimeout = setTimeout(() => {+ bubbleElement.style.transition = "";+ bubbleElement.style.backgroundColor = "";+ }, 200);+ }, 1500);+ }, 400);+ }+ }+ }, 100);++ return () => {+ clearTimeout(initialTimeout);+ if (highlightTimeout) clearTimeout(highlightTimeout);+ if (fadeTimeout) clearTimeout(fadeTimeout);+ if (cleanupTimeout) clearTimeout(cleanupTimeout);+ if (blinkInterval) clearInterval(blinkInterval);+ };+ }, [open, highlightCommentID, loading, comments]);+// Reset selected collection when the file changes (gallery view only)useEffect(() => {setSelectedCollectionID(undefined);@@ -895,8 +998,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({// Update reactionsByCollectionsetReactionsByCollection((prev) => {const next = new Map(prev);- const reactions =- next.get(selectedCollectionInfo.id) ?? [];+ const reactions = next.get(selectedCollectionInfo.id) ?? [];next.set(selectedCollectionInfo.id,reactions.filter((r) => r.id !== existingReactionID),@@ -934,8 +1036,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({// Update reactionsByCollectionsetReactionsByCollection((prev) => {const next = new Map(prev);- const reactions =- next.get(selectedCollectionInfo.id) ?? [];+ const reactions = next.get(selectedCollectionInfo.id) ?? [];next.set(selectedCollectionInfo.id, [...reactions,newReaction,@@ -1208,6 +1309,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({</OwnTimestamp>)}<CommentBubbleWrapper+ data-comment-id={comment.id}isOwn={commentIsOwn}isFirstOwn={!showOwnTimestamp &&diff --git a/web/packages/gallery/components/viewer/FeedSidebar.tsx b/web/packages/gallery/components/viewer/FeedSidebar.tsxindex d05385af9d..ce33a433e9 100644--- a/web/packages/gallery/components/viewer/FeedSidebar.tsx+++ b/web/packages/gallery/components/viewer/FeedSidebar.tsx@@ -154,6 +154,24 @@ const LikedReplyIcon: React.FC<{ heartStroke?: string }> = ({// Types// =============================================================================+/**+ * Information about a feed item click for navigation purposes.+ */+export interface FeedItemClickInfo {+ /** The type of feed item. */+ type: FeedItem["type"];+ /** The file ID to navigate to. */+ fileID: number;+ /**+ * The comment ID to highlight (for comment-related items).+ * For `replied_comment`, this is the reply's comment ID.+ * For `liked_comment` and `liked_reply`, this is the target comment ID.+ */+ commentID?: string;+ /** The collection ID where this activity occurred. */+ collectionID: number;+}+export interface FeedSidebarProps extends ModalVisibilityProps {/*** The collection (album) to show feed for.@@ -171,6 +189,10 @@ export interface FeedSidebarProps extends ModalVisibilityProps {* A map from user IDs to their email addresses for display.*/emailByUserID: Map<number, string>;+ /**+ * Called when a feed item is clicked for navigation.+ */+ onItemClick?: (info: FeedItemClickInfo) => void;}/** A user who performed an action in the feed. */@@ -202,6 +224,8 @@ interface LikedPhotoFeedItem extends BaseFeedItem {interface CommentedPhotoFeedItem extends BaseFeedItem {type: "commented_photo";fileID: number;+ /** The ID of the new comment for navigation. */+ actualCommentID: string;thumbnailURL?: string;user: FeedUser;}@@ -209,7 +233,10 @@ interface CommentedPhotoFeedItem extends BaseFeedItem {/** Someone replied to your comment. */interface RepliedCommentFeedItem extends BaseFeedItem {type: "replied_comment";+ /** The parent comment ID. */commentID: string;+ /** The ID of the reply for navigation. */+ replyID: string;fileID?: number;thumbnailURL?: string;user: FeedUser;@@ -261,7 +288,6 @@ const getUserDisplayName = (return userName;};-/*** Check if a comment is a reply (has a parent).*/@@ -316,6 +342,7 @@ const processFeedItems = (id: `replied_comment_${c.id}`,type: "replied_comment",commentID: c.parentCommentID!,+ replyID: c.id,fileID: c.fileID,thumbnailURL: getThumbnailURL(c.fileID),timestamp: c.createdAt,@@ -333,6 +360,7 @@ const processFeedItems = (id: `commented_photo_${c.id}`,type: "commented_photo",fileID: c.fileID!,+ actualCommentID: c.id,thumbnailURL: getThumbnailURL(c.fileID),timestamp: c.createdAt,user: {@@ -516,12 +544,13 @@ const getFeedIcon = (interface FeedItemRowProps {item: FeedItem;+ onClick?: () => void;}/*** A single row in the feed showing an action.*/-const FeedItemRow: React.FC<FeedItemRowProps> = ({ item }) => {+const FeedItemRow: React.FC<FeedItemRowProps> = ({ item, onClick }) => {const { mode, systemMode } = useColorScheme();const users =item.type === "commented_photo" || item.type === "replied_comment"@@ -534,7 +563,7 @@ const FeedItemRow: React.FC<FeedItemRowProps> = ({ item }) => {const heartStroke = resolvedMode === "dark" ? "#1b1b1b" : "white";return (- <FeedItemContainer>+ <FeedItemContainer onClick={onClick}><IconContainer>{getFeedIcon(item.type, heartStroke)}</IconContainer><FeedItemContent><AvatarStack>@@ -575,6 +604,33 @@ const FeedItemRow: React.FC<FeedItemRowProps> = ({ item }) => {/*** A sidebar panel for displaying the feed for an album.*/+/**+ * Extracts navigation info from a feed item for click handling.+ */+const getFeedItemClickInfo = (+ item: FeedItem,+ collectionID: number,+): FeedItemClickInfo => {+ const base = { type: item.type, collectionID };++ switch (item.type) {+ case "liked_photo":+ return { ...base, fileID: item.fileID };+ case "commented_photo":+ return {+ ...base,+ fileID: item.fileID,+ commentID: item.actualCommentID,+ };+ case "replied_comment":+ return { ...base, fileID: item.fileID!, commentID: item.replyID };+ case "liked_comment":+ return { ...base, fileID: item.fileID!, commentID: item.commentID };+ case "liked_reply":+ return { ...base, fileID: item.fileID!, commentID: item.replyID };+ }+};+export const FeedSidebar: React.FC<FeedSidebarProps> = ({open,onClose,@@ -582,6 +638,7 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({files = [],currentUserID,emailByUserID,+ onItemClick,}) => {const [thumbnailCache, setThumbnailCache] = useState<ThumbnailCache>(new Map(),@@ -634,8 +691,10 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({setIsLoading(true);try {- const { comments: fetchedComments, reactions: fetchedReactions } =- await getAlbumFeed(collection.id, collection.key);+ const {+ comments: fetchedComments,+ reactions: fetchedReactions,+ } = await getAlbumFeed(collection.id, collection.key);setComments(fetchedComments);setReactions(fetchedReactions);} catch (e) {@@ -660,7 +719,14 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({emailByUserID,currentUserID,),- [comments, reactions, files, thumbnailCache, emailByUserID, currentUserID],+ [+ comments,+ reactions,+ files,+ thumbnailCache,+ emailByUserID,+ currentUserID,+ ],);return (@@ -690,7 +756,22 @@ export const FeedSidebar: React.FC<FeedSidebarProps> = ({<EmptyStateText>No activity yet</EmptyStateText>) : (feedItems.map((item) => (- <FeedItemRow key={item.id} item={item} />+ <FeedItemRow+ key={item.id}+ item={item}+ onClick={+ onItemClick+ ? () => {+ onItemClick(+ getFeedItemClickInfo(+ item,+ collection.id,+ ),+ );+ }+ : undefined+ }+ />)))}</ContentContainer>@@ -845,9 +926,7 @@ const StyledAvatar = styled(Avatar)(({ theme }) => ({border: "2px solid #FAFAFA",marginLeft: -8,"&:first-of-type": { marginLeft: 0 },- ...theme.applyStyles("dark", {- border: "2px solid #1b1b1b",- }),+ ...theme.applyStyles("dark", { border: "2px solid #1b1b1b" }),}));const UserNameText = styled(Typography)(({ theme }) => ({diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsxindex 1298c90748..b7d1d0122a 100644--- a/web/packages/gallery/components/viewer/FileViewer.tsx+++ b/web/packages/gallery/components/viewer/FileViewer.tsx@@ -137,6 +137,9 @@ export interface FileViewerAnnotatedFile {itemData: ItemData;}+/** The type of sidebar to open initially in the file viewer. */+export type FileViewerInitialSidebar = "likes" | "comments";+export type FileViewerProps = ModalVisibilityProps & {/*** The currently logged in user, if any.@@ -170,6 +173,15 @@ export type FileViewerProps = ModalVisibilityProps & {* provided within the file viewer itself.*/initialIndex: number;+ /**+ * If set, the specified sidebar will be opened when the file viewer opens.+ */+ initialSidebar?: FileViewerInitialSidebar;+ /**+ * If set, the comments sidebar will scroll to and highlight this comment.+ * Only used when initialSidebar is "comments".+ */+ highlightCommentID?: string;/*** If true then the viewer does not show controls for downloading the file.*/@@ -321,6 +333,8 @@ export const FileViewer: React.FC<FileViewerProps> = ({user,files,initialIndex,+ initialSidebar,+ highlightCommentID,disableDownload,showFullscreenButton,isInIncomingSharedCollection,@@ -443,6 +457,25 @@ export const FileViewer: React.FC<FileViewerProps> = ({fileNormalCollectionIDsRef.current = fileNormalCollectionIDs;}, [fileNormalCollectionIDs]);+ // Track whether we've already opened the initial sidebar for this open+ const hasOpenedInitialSidebarRef = useRef(false);++ // Open the initial sidebar when the file viewer opens with initialSidebar set+ useEffect(() => {+ if (open && initialSidebar && !hasOpenedInitialSidebarRef.current) {+ hasOpenedInitialSidebarRef.current = true;+ if (initialSidebar === "comments") {+ setOpenComments(true);+ } else if (initialSidebar === "likes") {+ setOpenLikes(true);+ }+ }+ // Reset the flag when the viewer closes+ if (!open) {+ hasOpenedInitialSidebarRef.current = false;+ }+ }, [open, initialSidebar]);+// Helper to get current user's file reactions from allReactionsconst getUserFileReactions = useCallback((fileId: number): { collectionId: number; reactionId: string }[] => {@@ -1856,6 +1889,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({onCommentDeleted={handleCommentDeleted}onCommentReactionAdded={handleCommentReactionAdded}onCommentReactionDeleted={handleCommentReactionDeleted}+ highlightCommentID={highlightCommentID}/><LikesSidebaropen={openLikes}