feat: add MergeDialog component and integrate with GitToolbar

- Create MergeDialog component for branch merging
- Add merge button to GitToolbar
- Show source branch selector and target branch display
- Handle merge success and error states
- Add modal CSS styles

Completes Task 6.2 of git-control change.
This commit is contained in:
Fusion
2026-05-19 15:05:55 +02:00
parent 875594d66d
commit a9f4657d03
3 changed files with 239 additions and 0 deletions
+23
View File
@@ -9,6 +9,7 @@ import {
pushRepository,
type GitStatus,
} from "../api/git_repositories";
import { MergeDialog } from "./merge-dialog";
interface GitToolbarProps {
projectId: string;
@@ -33,6 +34,7 @@ export const GitToolbar = ({
const [showNewBranch, setShowNewBranch] = useState(false);
const [newBranchName, setNewBranchName] = useState("");
const [newBranchBase, setNewBranchBase] = useState("");
const [showMergeDialog, setShowMergeDialog] = useState(false);
const loadStatus = useCallback(async () => {
try {
@@ -179,6 +181,14 @@ export const GitToolbar = ({
Push
{status?.ahead ? <span className="badge">{status.ahead}</span> : null}
</button>
<button
className="toolbar-button"
onClick={() => setShowMergeDialog(true)}
disabled={loading}
type="button"
>
🔀 Merge
</button>
</div>
</div>
@@ -227,6 +237,19 @@ export const GitToolbar = ({
{status.untracked.length > 0 && <span className="status-badge untracked"> {status.untracked.length} untracked</span>}
</div>
)}
<MergeDialog
projectId={projectId}
repoId={repoId}
branches={branches}
currentBranch={currentBranch}
isOpen={showMergeDialog}
onClose={() => setShowMergeDialog(false)}
onMerge={() => {
void loadStatus();
onRefresh();
}}
/>
</div>
);
};