mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Add unified git sync state so state is shared across components
This commit is contained in:
7 files changed
+160
-43
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { createContext } from 'react';
|
||||
|
||||
export type GitOperation = 'fetch' | 'pull' | 'push';
|
||||
|
||||
export interface GitSyncState {
|
||||
dir: string;
|
||||
operation: GitOperation;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export interface GitSyncContextValue {
|
||||
syncStates: Map<string, GitSyncState>;
|
||||
startOperation: (dir: string, operation: GitOperation) => void;
|
||||
endOperation: (dir: string) => void;
|
||||
getState: (dir: string) => GitSyncState | undefined;
|
||||
}
|
||||
|
||||
export const GitSyncContext = createContext<GitSyncContextValue | null>(null);
|
||||
Reference in new issue
Block a user