mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
refactor: Move merge and PR UI to Repository dialog
Relocate merge and pull request buttons from Advanced Git Management dialog to the main Repository dialog for better accessibility and workflow. CHANGES: - Add "Branch Operations" card to GitDialog - Display Merge Branch and Pull Request buttons directly in Repository dialog - Remove duplicate buttons from GitManagementDialog branches tab - Simplify GitManagementDialog component (removed merge/PR dialog state) BENEFITS: - More intuitive workflow: common operations are in the main dialog - Cleaner separation: Repository dialog = operations, Advanced = exploration - Faster access to merge/PR features without opening advanced dialog The Merge and PR dialogs now open from the Repository dialog's "Branch Operations" section, making them easier to discover and use.
This commit is contained in:
1 parent
dad4ce0aa4
commit
a390593841
2 files changed
+29
-71
No files matched your search
@@ -49,6 +49,8 @@ import { cn } from '@/lib/utils';
|
||||
import { findCredentialsForRepo } from '@/lib/gitCredentials';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { GitManagementDialog } from '@/components/git/GitManagementDialog';
|
||||
import { MergeDialog } from '@/components/git/MergeDialog';
|
||||
import { PullRequestDialog } from '@/components/git/PullRequestDialog';
|
||||
|
||||
const GRASP_SERVERS = ["git.shakespeare.diy", "relay.ngit.dev"];
|
||||
|
||||
@@ -768,8 +770,29 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
|
||||
{/* Branch Operations */}
|
||||
{gitStatus?.isGitRepo && gitStatus.currentBranch && (
|
||||
<Card>
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="text-sm">Branch Operations</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex gap-2">
|
||||
<MergeDialog
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus.currentBranch}
|
||||
onMergeComplete={() => refetchGitStatus()}
|
||||
/>
|
||||
{gitStatus.remotes.length > 0 && originUrl && (
|
||||
<PullRequestDialog
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus.currentBranch}
|
||||
remoteUrl={originUrl}
|
||||
/>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -11,15 +10,10 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import {
|
||||
GitBranch,
|
||||
GitCompare,
|
||||
GitMerge,
|
||||
GitPullRequest,
|
||||
Settings,
|
||||
History,
|
||||
} from 'lucide-react';
|
||||
import { BranchManager } from './BranchManager';
|
||||
import { CompareView } from './CompareView';
|
||||
import { MergeDialog } from './MergeDialog';
|
||||
import { PullRequestDialog } from './PullRequestDialog';
|
||||
import { DiffViewer } from './DiffViewer';
|
||||
import { useGitStatus } from '@/hooks/useGitStatus';
|
||||
|
||||
@@ -39,8 +33,6 @@ export function GitManagementDialog({
|
||||
defaultTab = 'branches',
|
||||
}: GitManagementDialogProps) {
|
||||
const [activeTab, setActiveTab] = useState(defaultTab);
|
||||
const [isMergeDialogOpen, setIsMergeDialogOpen] = useState(false);
|
||||
const [isPRDialogOpen, setIsPRDialogOpen] = useState(false);
|
||||
|
||||
const { data: gitStatus, refetch: refetchGitStatus } = useGitStatus(projectId);
|
||||
|
||||
@@ -49,14 +41,6 @@ export function GitManagementDialog({
|
||||
refetchGitStatus();
|
||||
};
|
||||
|
||||
const handleMergeComplete = () => {
|
||||
setIsMergeDialogOpen(false);
|
||||
refetchGitStatus();
|
||||
};
|
||||
|
||||
// Get remote URL for PR creation
|
||||
const remoteUrl = gitStatus?.remotes.find(r => r.name === 'origin')?.url;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
@@ -98,40 +82,11 @@ export function GitManagementDialog({
|
||||
|
||||
{/* Branches Tab */}
|
||||
<TabsContent value="branches" className="mt-0 p-6">
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center gap-2">
|
||||
{gitStatus?.currentBranch && (
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="gap-2"
|
||||
onClick={() => setIsMergeDialogOpen(true)}
|
||||
>
|
||||
<GitMerge className="h-4 w-4" />
|
||||
Merge
|
||||
</Button>
|
||||
{remoteUrl && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="gap-2"
|
||||
onClick={() => setIsPRDialogOpen(true)}
|
||||
>
|
||||
<GitPullRequest className="h-4 w-4" />
|
||||
Pull Request
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<BranchManager
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus?.currentBranch || null}
|
||||
onBranchChange={handleBranchChange}
|
||||
/>
|
||||
</div>
|
||||
<BranchManager
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus?.currentBranch || null}
|
||||
onBranchChange={handleBranchChange}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
{/* Changes Tab */}
|
||||
@@ -149,26 +104,6 @@ export function GitManagementDialog({
|
||||
</Tabs>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
{/* Merge Dialog */}
|
||||
<MergeDialog
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus?.currentBranch || null}
|
||||
open={isMergeDialogOpen}
|
||||
onOpenChange={setIsMergeDialogOpen}
|
||||
onMergeComplete={handleMergeComplete}
|
||||
/>
|
||||
|
||||
{/* Pull Request Dialog */}
|
||||
{remoteUrl && (
|
||||
<PullRequestDialog
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus?.currentBranch || null}
|
||||
remoteUrl={remoteUrl}
|
||||
open={isPRDialogOpen}
|
||||
onOpenChange={setIsPRDialogOpen}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user