mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-02 19:55:18 +02:00
refactor: simplify dashboard layout by removing unused navigation props and implementing a new DocumentsSidebar for better document management
This commit is contained in:
parent
0cffa206ad
commit
936bd70682
11 changed files with 388 additions and 84 deletions
|
|
@ -27,8 +27,6 @@ export function DashboardClientLayout({
|
|||
}: {
|
||||
children: React.ReactNode;
|
||||
searchSpaceId: string;
|
||||
navSecondary?: any[];
|
||||
navMain?: any[];
|
||||
}) {
|
||||
const t = useTranslations("dashboard");
|
||||
const router = useRouter();
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ export default function EditorPage() {
|
|||
|
||||
setHasUnsavedChanges(false);
|
||||
toast.success("Note created successfully! Reindexing in background...");
|
||||
router.push(`/dashboard/${searchSpaceId}/documents`);
|
||||
router.push(`/dashboard/${searchSpaceId}/new-chat`);
|
||||
} else {
|
||||
// Existing document — save
|
||||
const response = await authenticatedFetch(
|
||||
|
|
@ -277,7 +277,7 @@ export default function EditorPage() {
|
|||
|
||||
setHasUnsavedChanges(false);
|
||||
toast.success("Document saved! Reindexing in background...");
|
||||
router.push(`/dashboard/${searchSpaceId}/documents`);
|
||||
router.push(`/dashboard/${searchSpaceId}/new-chat`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error saving document:", error);
|
||||
|
|
@ -298,7 +298,7 @@ export default function EditorPage() {
|
|||
if (hasUnsavedChanges) {
|
||||
setShowUnsavedDialog(true);
|
||||
} else {
|
||||
router.push(`/dashboard/${searchSpaceId}/documents`);
|
||||
router.push(`/dashboard/${searchSpaceId}/new-chat`);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ export default function EditorPage() {
|
|||
router.push(pendingNavigation);
|
||||
setPendingNavigation(null);
|
||||
} else {
|
||||
router.push(`/dashboard/${searchSpaceId}/documents`);
|
||||
router.push(`/dashboard/${searchSpaceId}/new-chat`);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,43 +10,10 @@ export default function DashboardLayout({
|
|||
params: Promise<{ search_space_id: string }>;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
// Use React.use to unwrap the params Promise
|
||||
const { search_space_id } = use(params);
|
||||
|
||||
const customNavSecondary = [
|
||||
{
|
||||
title: `All Search Spaces`,
|
||||
url: `#`,
|
||||
icon: "Info",
|
||||
},
|
||||
{
|
||||
title: `All Search Spaces`,
|
||||
url: "/dashboard",
|
||||
icon: "Undo2",
|
||||
},
|
||||
];
|
||||
|
||||
const customNavMain = [
|
||||
{
|
||||
title: "Chat",
|
||||
url: `/dashboard/${search_space_id}/new-chat`,
|
||||
icon: "MessageCircle",
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: "Documents",
|
||||
url: `/dashboard/${search_space_id}/documents`,
|
||||
icon: "SquareLibrary",
|
||||
items: [],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<DashboardClientLayout
|
||||
searchSpaceId={search_space_id}
|
||||
navSecondary={customNavSecondary}
|
||||
navMain={customNavMain}
|
||||
>
|
||||
<DashboardClientLayout searchSpaceId={search_space_id}>
|
||||
{children}
|
||||
</DashboardClientLayout>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue