Remove CharacterComponent and CharacterDetail components
- Deleted `CharacterComponent` and `CharacterDetail` files from the project. - Refactored related logic to improve code maintainability and reduce redundancy.
This commit is contained in:
42
context/SeriesSyncContext.ts
Normal file
42
context/SeriesSyncContext.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { SeriesSyncCompare, SyncedSeries } from "@/lib/models/SyncedSeries";
|
||||
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: []
|
||||
});
|
||||
Reference in New Issue
Block a user