From 5ebb9d7aeac22be9410d104a06ea27bb77f526db Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Fri, 2 Jan 2026 04:07:13 +0530 Subject: [PATCH] feat: integrate document upload dialog and enhance dashboard layout - Added DocumentUploadDialogProvider to manage document upload dialog state across components. - Updated DashboardClientLayout to include the DocumentUploadDialogProvider for improved user experience. - Refactored DocumentsTableShell to utilize the new dialog for file uploads instead of navigating to a separate upload page. - Removed the deprecated upload page and streamlined document upload handling within the dialog. - Enhanced DocumentUploadTab with improved file type handling and user feedback during uploads. - Updated GridPattern styling for better visual consistency. --- .../[search_space_id]/client-layout.tsx | 53 +-- .../components/DocumentsTableShell.tsx | 7 +- .../documents/upload/page.tsx | 36 -- .../components/assistant-ui/attachment.tsx | 16 +- .../assistant-ui/document-upload-popup.tsx | 101 +++++ .../components/sources/DocumentUploadTab.tsx | 370 ++++++++---------- .../components/sources/GridPattern.tsx | 6 +- 7 files changed, 316 insertions(+), 273 deletions(-) delete mode 100644 surfsense_web/app/dashboard/[search_space_id]/documents/upload/page.tsx create mode 100644 surfsense_web/components/assistant-ui/document-upload-popup.tsx diff --git a/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx b/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx index 647c93282..1335c8bcb 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/client-layout.tsx @@ -20,6 +20,7 @@ import { AppSidebarProvider } from "@/components/sidebar/AppSidebarProvider"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"; +import { DocumentUploadDialogProvider } from "@/components/assistant-ui/document-upload-popup"; export function DashboardClientLayout({ children, @@ -240,32 +241,34 @@ export function DashboardClientLayout({ } return ( - - {/* Use AppSidebarProvider which fetches user, search space, and recent chats */} - - -
-
-
-
- -
- - + + + {/* Use AppSidebarProvider which fetches user, search space, and recent chats */} + + +
+
+
+
+ +
+ + +
+
+
+
-
- -
-
-
-
{children}
-
-
-
+ +
{children}
+ + + + ); } diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx index 4800491f8..e933621cd 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx @@ -2,9 +2,10 @@ import { ChevronDown, ChevronUp, FileX, Plus } from "lucide-react"; import { motion } from "motion/react"; -import { useParams, useRouter } from "next/navigation"; +import { useParams } from "next/navigation"; import { useTranslations } from "next-intl"; import React from "react"; +import { useDocumentUploadDialog } from "@/components/assistant-ui/document-upload-popup"; import { DocumentViewer } from "@/components/document-viewer"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; @@ -69,9 +70,9 @@ export function DocumentsTableShell({ onSortChange: (key: SortKey) => void; }) { const t = useTranslations("documents"); - const router = useRouter(); const params = useParams(); const searchSpaceId = params.search_space_id; + const { openDialog } = useDocumentUploadDialog(); const sorted = React.useMemo( () => sortDocuments(documents, sortKey, sortDesc), @@ -144,7 +145,7 @@ export function DocumentsTableShell({

- -
+ +
{files.map((file, index) => (
@@ -329,7 +295,7 @@ export function DocumentUploadTab({ searchSpaceId }: DocumentUploadTabProps) {