- Introduce new error messages for syncing and book deletion in `en.json`. - Update `DeleteBook` to support local-only deletion and synced book management. - Refine offline/online behavior with `deleteLocalToo` checkbox and update related state handling. - Extend repository and IPC methods to handle optional IDs for updates. - Add `SyncQueueContext` for queueing offline changes and improving synchronization workflows. - Enhance refined text generation logic in `DraftCompanion` and `GhostWriter` components. - Replace PUT with PATCH for world updates to align with API expectations. - Streamline `AlertBox` by integrating dynamic translation keys for deletion prompts.
23 lines
700 B
TypeScript
23 lines
700 B
TypeScript
import {Context, createContext, Dispatch, SetStateAction} from "react";
|
|
|
|
export interface LocalSyncOperation {
|
|
id: string;
|
|
channel: string;
|
|
data: Record<string, unknown>;
|
|
timestamp: number;
|
|
}
|
|
|
|
export interface LocalSyncQueueContextProps {
|
|
queue: LocalSyncOperation[];
|
|
setQueue: Dispatch<SetStateAction<LocalSyncOperation[]>>;
|
|
addToQueue: (channel: string, data: Record<string, unknown>) => void;
|
|
isProcessing: boolean;
|
|
}
|
|
|
|
export const LocalSyncQueueContext: Context<LocalSyncQueueContextProps> = createContext<LocalSyncQueueContextProps>({
|
|
queue: [],
|
|
setQueue: (): void => {},
|
|
addToQueue: (): void => {},
|
|
isProcessing: false,
|
|
});
|