Files
ERitors-Scribe-Desktop/context/SeriesSyncContext.ts
natreex 64ed90d993 Remove unused components and models for improved maintainability
- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files.
- Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter.
- Updated project structure and references to reflect these removals.
2026-03-22 22:37:31 -04:00

43 lines
1.9 KiB
TypeScript

import { SeriesSyncCompare, SyncedSeries } from "@/lib/types/synced-series";
import { Context, createContext, Dispatch, SetStateAction } from "react";
/**
* Sync status types for series synchronization.
* - 'server-only': Series exists only on server, needs download
* - 'local-only': Series exists only locally, needs upload
* - 'to-sync-from-server': Series has newer data on server
* - 'to-sync-to-server': Series has newer data locally
* - 'synced': Series is synchronized between server and local
*/
export type SeriesSyncType = 'server-only' | 'local-only' | 'to-sync-from-server' | 'to-sync-to-server' | 'synced';
export interface SeriesSyncContextProps {
serverSyncedSeries: SyncedSeries[];
localSyncedSeries: SyncedSeries[];
seriesToSyncFromServer: SeriesSyncCompare[];
seriesToSyncToServer: SeriesSyncCompare[];
setServerSyncedSeries: Dispatch<SetStateAction<SyncedSeries[]>>;
setLocalSyncedSeries: Dispatch<SetStateAction<SyncedSeries[]>>;
setServerOnlySeries: Dispatch<SetStateAction<SyncedSeries[]>>;
setLocalOnlySeries: Dispatch<SetStateAction<SyncedSeries[]>>;
setSeriesToSyncFromServer: Dispatch<SetStateAction<SeriesSyncCompare[]>>;
setSeriesToSyncToServer: Dispatch<SetStateAction<SeriesSyncCompare[]>>;
serverOnlySeries: SyncedSeries[];
localOnlySeries: SyncedSeries[];
}
export const SeriesSyncContext: Context<SeriesSyncContextProps> = createContext<SeriesSyncContextProps>({
serverSyncedSeries: [],
localSyncedSeries: [],
seriesToSyncFromServer: [],
seriesToSyncToServer: [],
setServerSyncedSeries: (): void => {},
setLocalSyncedSeries: (): void => {},
setServerOnlySeries: (): void => {},
setLocalOnlySeries: (): void => {},
setSeriesToSyncFromServer: (): void => {},
setSeriesToSyncToServer: (): void => {},
serverOnlySeries: [],
localOnlySeries: []
});