mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
26 lines
580 B
TypeScript
26 lines
580 B
TypeScript
import { useGitSyncState } from './useGitSyncState';
|
|
import { useFSPaths } from './useFSPaths';
|
|
|
|
/**
|
|
* Hook to get the current git sync status for a project
|
|
*/
|
|
export function useGitSyncStatus(projectId: string | undefined) {
|
|
const { getState } = useGitSyncState();
|
|
const { projectsPath } = useFSPaths();
|
|
|
|
if (!projectId) {
|
|
return {
|
|
isActive: false,
|
|
operation: null,
|
|
};
|
|
}
|
|
|
|
const dir = `${projectsPath}/${projectId}`;
|
|
const state = getState(dir);
|
|
|
|
return {
|
|
isActive: state?.isActive || false,
|
|
operation: state?.operation || null,
|
|
};
|
|
}
|