diff --git a/projects/frontend/src/components/FileUpload/FileUpload.tsx b/projects/frontend/src/components/FileUpload/FileUpload.tsx index b395cd7..0874b02 100644 --- a/projects/frontend/src/components/FileUpload/FileUpload.tsx +++ b/projects/frontend/src/components/FileUpload/FileUpload.tsx @@ -756,6 +756,25 @@ const FileUpload: React.FC = () => { )} + + {successCount > 0 && (
{
)} - - diff --git a/projects/frontend/src/components/FileViewer/LinkedFilesSection.jsx b/projects/frontend/src/components/FileViewer/LinkedFilesSection.jsx index bb0d073..b897d95 100644 --- a/projects/frontend/src/components/FileViewer/LinkedFilesSection.jsx +++ b/projects/frontend/src/components/FileViewer/LinkedFilesSection.jsx @@ -259,85 +259,109 @@ const LinkedFilesSection = ({ filePath, source }) => {
- {linkedFiles.map((linking) => { - const linkedPath = getLinkedFilePath(linking, filePath); - const normalizedLinkedPath = linkedPath.replace(/\\/g, '/'); - const direction = getRelationshipDirection(linking, filePath); - const fileName = linkedPath.split(/[\/\\]/).pop() || linkedPath; - - // Get file status info - try both normalized and original path - let fileInfo = fileStatusMap.get(normalizedLinkedPath) || fileStatusMap.get(linkedPath); - const isCollected = fileInfo?.status === 'collected' && fileInfo?.object_id; + {(() => { + // Group linked files by path to merge entries with different directions + const groupedFiles = new Map(); - return ( -
-
-
- - {isCollected && ( - - )} -
-
-
-

- {fileName} -

- {linking.link_type && ( - - {linking.link_type} - - )} - - {direction} - - {fileInfo && !isCollected && ( - - {fileInfo.status.replace(/_/g, ' ')} - + linkedFiles.forEach((linking) => { + const linkedPath = getLinkedFilePath(linking, filePath); + const normalizedLinkedPath = linkedPath.replace(/\\/g, '/'); + const direction = getRelationshipDirection(linking, filePath); + + if (groupedFiles.has(normalizedLinkedPath)) { + const existing = groupedFiles.get(normalizedLinkedPath); + existing.directions.add(direction); + existing.linkTypes.add(linking.link_type); + } else { + groupedFiles.set(normalizedLinkedPath, { + linkedPath, + normalizedLinkedPath, + directions: new Set([direction]), + linkTypes: new Set([linking.link_type].filter(Boolean)), + linkingId: linking.linking_id + }); + } + }); + + return Array.from(groupedFiles.values()).map((group) => { + const fileName = group.linkedPath.split(/[\/\\]/).pop() || group.linkedPath; + + // Get file status info - try both normalized and original path + let fileInfo = fileStatusMap.get(group.normalizedLinkedPath) || fileStatusMap.get(group.linkedPath); + const isCollected = fileInfo?.status === 'collected' && fileInfo?.object_id; + + return ( +
+
+
+ + {isCollected && ( + )}
-

handleFileClick(linkedPath, fileInfo) : undefined} - title={isCollected ? "Click to navigate to file" : undefined} - > - {linkedPath} -

+
+
+

+ {fileName} +

+ {Array.from(group.linkTypes).map((linkType) => ( + + {linkType} + + ))} + {Array.from(group.directions).map((direction) => ( + + {direction} + + ))} + {fileInfo && !isCollected && ( + + {fileInfo.status.replace(/_/g, ' ')} + + )} +
+

handleFileClick(group.linkedPath, fileInfo) : undefined} + title={isCollected ? "Click to navigate to file" : undefined} + > + {group.linkedPath} +

+
-
- ); - })} + ); + }); + })()}