feat(filesystem): enhance local file handling in editor and IPC integration

This commit is contained in:
Anish Sarkar 2026-04-23 17:23:38 +05:30
parent 4899588cd7
commit 864f6f798a
12 changed files with 350 additions and 47 deletions

View file

@ -3,14 +3,18 @@ import { rightPanelCollapsedAtom, rightPanelTabAtom } from "@/atoms/layout/right
interface EditorPanelState {
isOpen: boolean;
kind: "document" | "local_file";
documentId: number | null;
localFilePath: string | null;
searchSpaceId: number | null;
title: string | null;
}
const initialState: EditorPanelState = {
isOpen: false,
kind: "document",
documentId: null,
localFilePath: null,
searchSpaceId: null,
title: null,
};
@ -26,20 +30,38 @@ export const openEditorPanelAtom = atom(
(
get,
set,
{
documentId,
searchSpaceId,
title,
}: { documentId: number; searchSpaceId: number; title?: string }
payload:
| { documentId: number; searchSpaceId: number; title?: string; kind?: "document" }
| {
kind: "local_file";
localFilePath: string;
title?: string;
searchSpaceId?: number;
}
) => {
if (!get(editorPanelAtom).isOpen) {
set(preEditorCollapsedAtom, get(rightPanelCollapsedAtom));
}
if (payload.kind === "local_file") {
set(editorPanelAtom, {
isOpen: true,
kind: "local_file",
documentId: null,
localFilePath: payload.localFilePath,
searchSpaceId: payload.searchSpaceId ?? null,
title: payload.title ?? null,
});
set(rightPanelTabAtom, "editor");
set(rightPanelCollapsedAtom, false);
return;
}
set(editorPanelAtom, {
isOpen: true,
documentId,
searchSpaceId,
title: title ?? null,
kind: "document",
documentId: payload.documentId,
localFilePath: null,
searchSpaceId: payload.searchSpaceId,
title: payload.title ?? null,
});
set(rightPanelTabAtom, "editor");
set(rightPanelCollapsedAtom, false);