mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
refactor: delete the old editor page with atom-based state management for document editing
This commit is contained in:
parent
f617ae8742
commit
f9606679e0
3 changed files with 8 additions and 535 deletions
|
|
@ -1,27 +0,0 @@
|
|||
import { atom } from "jotai";
|
||||
|
||||
interface EditorUIState {
|
||||
hasUnsavedChanges: boolean;
|
||||
pendingNavigation: string | null; // URL to navigate to after user confirms
|
||||
}
|
||||
|
||||
export const editorUIAtom = atom<EditorUIState>({
|
||||
hasUnsavedChanges: false,
|
||||
pendingNavigation: null,
|
||||
});
|
||||
|
||||
// Derived atom for just the unsaved changes state
|
||||
export const hasUnsavedEditorChangesAtom = atom(
|
||||
(get) => get(editorUIAtom).hasUnsavedChanges,
|
||||
(get, set, value: boolean) => {
|
||||
set(editorUIAtom, { ...get(editorUIAtom), hasUnsavedChanges: value });
|
||||
}
|
||||
);
|
||||
|
||||
// Derived atom for pending navigation
|
||||
export const pendingEditorNavigationAtom = atom(
|
||||
(get) => get(editorUIAtom).pendingNavigation,
|
||||
(get, set, value: string | null) => {
|
||||
set(editorUIAtom, { ...get(editorUIAtom), pendingNavigation: value });
|
||||
}
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue