From 8ddf04a9048d89075cf818f1e60d6fa1b87f19d6 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Thu, 17 Jul 2025 03:08:01 +0530 Subject: [PATCH] (feat:chunks) use common header, navigate --- frontend/src/components/DocumentChunks.tsx | 48 +++++++-------- frontend/src/components/FileTreeComponent.tsx | 59 +++++++++++-------- 2 files changed, 59 insertions(+), 48 deletions(-) diff --git a/frontend/src/components/DocumentChunks.tsx b/frontend/src/components/DocumentChunks.tsx index f619afb0..90718473 100644 --- a/frontend/src/components/DocumentChunks.tsx +++ b/frontend/src/components/DocumentChunks.tsx @@ -151,39 +151,39 @@ const DocumentChunks: React.FC = ({ return (
-
- {showHeader && ( + {showHeader && ( +
- )} -
- source - - {documentName} - +
+ source + + {documentName} + - {pathParts.length > 0 && ( - <> - / - {pathParts.map((part, index) => ( - - - {part} - - {index < pathParts.length - 1 && ( - / - )} - - ))} - - )} + {pathParts.length > 0 && ( + <> + / + {pathParts.map((part, index) => ( + + + {part} + + {index < pathParts.length - 1 && ( + / + )} + + ))} + + )} +
-
+ )}
diff --git a/frontend/src/components/FileTreeComponent.tsx b/frontend/src/components/FileTreeComponent.tsx index d4252064..170c4cb9 100644 --- a/frontend/src/components/FileTreeComponent.tsx +++ b/frontend/src/components/FileTreeComponent.tsx @@ -114,7 +114,9 @@ const FileTreeComponent: React.FC = ({ }; const handleBackNavigation = () => { - if (currentPath.length === 0) { + if (selectedFile) { + setSelectedFile(null); + } else if (currentPath.length === 0) { if (onBackToDocuments) { onBackToDocuments(); } @@ -187,7 +189,7 @@ const FileTreeComponent: React.FC = ({ > left-arrow - +
source {sourceName} @@ -206,6 +208,14 @@ const FileTreeComponent: React.FC = ({ ))} )} + {selectedFile && ( + <> + / + + {selectedFile.name} + + + )}
); @@ -243,26 +253,26 @@ const FileTreeComponent: React.FC = ({ const parentRow = currentPath.length > 0 ? [ - - -
- Parent folder - .. -
- - - - - - - , - ] + + +
+ Parent folder + .. +
+ + - + - + + , + ] : []; // Render directories first, then files @@ -377,16 +387,17 @@ const FileTreeComponent: React.FC = ({ return ( <> +
{renderPathNavigation()}
{selectedFile ? ( setSelectedFile(null)} path={selectedFile.id} + showHeader={false} /> ) : (
-
{renderPathNavigation()}