Files
ERitors-Scribe-Desktop/context/BooksSyncContext.ts
natreex 64c7cb6243 Update database schema and synchronization logic
- Add `useEffect` in `ScribeLeftBar` for handling book state changes.
- Extend `BooksSyncContext` with new properties and stricter typings.
- Refine `Repositories` to include `lastUpdate` handling for synchronization processes.
- Add comprehensive `fetchComplete*` repository methods for retrieving entity-specific sync data.
- Enhance offline logic for chapters, characters, locations, and world synchronization.
- Improve error handling across IPC handlers and repositories.
2025-12-15 20:55:24 -05:00

26 lines
981 B
TypeScript

import {BookSyncCompare, SyncedBook} from "@/lib/models/SyncedBook";
import {Context, createContext, Dispatch, SetStateAction} from "react";
export type SyncType = 'server-only' | 'local-only' | 'to-sync-from-server' | 'to-sync-to-server' | 'synced'
export interface BooksSyncContextProps {
serverSyncedBooks:SyncedBook[];
localSyncedBooks:SyncedBook[];
booksToSyncFromServer:BookSyncCompare[];
booksToSyncToServer:BookSyncCompare[];
setServerOnlyBooks:Dispatch<SetStateAction<SyncedBook[]>>;
setLocalOnlyBooks:Dispatch<SetStateAction<SyncedBook[]>>;
serverOnlyBooks:SyncedBook[];
localOnlyBooks:SyncedBook[];
}
export const BooksSyncContext:Context<BooksSyncContextProps> = createContext<BooksSyncContextProps>({
serverSyncedBooks:[],
localSyncedBooks:[],
booksToSyncFromServer:[],
booksToSyncToServer:[],
setServerOnlyBooks:():void => {},
setLocalOnlyBooks:():void => {},
serverOnlyBooks:[],
localOnlyBooks:[]
})