mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
22 lines
651 B
TypeScript
22 lines
651 B
TypeScript
import { createContext } from 'react';
|
|
|
|
export type GitOperation = 'fetch' | 'pull' | 'push';
|
|
|
|
export interface GitSyncState {
|
|
dir: string;
|
|
operation: GitOperation;
|
|
isActive: boolean;
|
|
error?: Error;
|
|
}
|
|
|
|
export interface GitSyncContextValue {
|
|
syncStates: Map<string, GitSyncState>;
|
|
startOperation: (dir: string, operation: GitOperation) => void;
|
|
endOperation: (dir: string, error?: Error) => void;
|
|
setError: (dir: string, error: Error | null) => void;
|
|
getState: (dir: string) => GitSyncState | undefined;
|
|
getError: (dir: string) => Error | undefined;
|
|
}
|
|
|
|
export const GitSyncContext = createContext<GitSyncContextValue | null>(null);
|