feat: unified git repo hook + fix branch dropdown in workspace creation

- New useGitRepo hook: centralizes all git operations (branches, status,
  history, commit, push, pull, fetch, checkout, create/delete branch, merge)
  for a given project+repo. Auto-refreshes after mutating ops.
- Fix WorkspaceCreateForm branch dropdown:
  - Always renders <select> (never input fallback)
  - Uses useGitRepo for branch fetching with loading/error states
  - Shows 'Loading branches...' while fetching
  - Shows 'Enter branch name manually...' if API fails
  - '+ Create new branch...' option with text input reveal
  - Auto-selects default branch on load
- ProjectsPage uses updated form props (defaultProjectId/defaultRepoId)

Quality gates: tsc --noEmit clean, eslint clean
This commit is contained in:
2026-06-01 18:45:53 +02:00
parent e956d7c30d
commit b02cd978c3
3 changed files with 350 additions and 84 deletions
+1 -6
View File
@@ -10,10 +10,7 @@ import {
type ProjectCreateInput,
type ProjectUpdateInput,
} from "../api/projects";
import {
deleteWorkspace,
syncWorkspace,
} from "../api/workspaces";
import { deleteWorkspace, syncWorkspace } from "../api/workspaces";
import {
EmptyState,
ErrorState,
@@ -111,8 +108,6 @@ export const ProjectsPage = () => {
}
};
const handleSyncWorkspace = async (
projectId: string,
repoId: string,