mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix PR card layout to prevent button overflow
Restructured the PR card layout to prevent the Merge button from going off-screen: - Changed from inline flex layout to stacked layout with separate actions row - Moved action buttons to their own row below PR info - Added proper spacing with pl-7 to align with content - Changed button variants for better visibility (outline instead of ghost) - Added "View" text to external link button for clarity - Better wrapping for title and badges with flex-wrap - Buttons now have consistent sizing and spacing The actions row only shows when there are actions to display (review/merge or external link), keeping the layout clean for merged PRs with no actions.
This commit is contained in:
1 parent
0318a8c836
commit
6b2b5e6e92
1 file changed
+73
-70
@@ -990,81 +990,84 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
|
||||
{pullRequests.map((pr) => (
|
||||
<div
|
||||
key={pr.id}
|
||||
className="flex items-start gap-3 p-3 rounded-md border bg-muted/20 hover:bg-muted/40 transition-colors"
|
||||
className="p-3 rounded-md border bg-muted/20 hover:bg-muted/40 transition-colors space-y-2"
|
||||
>
|
||||
<GitPullRequest className={cn(
|
||||
"h-4 w-4 mt-0.5 shrink-0",
|
||||
pr.state === 'merged' ? 'text-purple-600' : 'text-green-600'
|
||||
)} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<h4 className="text-sm font-medium truncate">
|
||||
{pr.title}
|
||||
</h4>
|
||||
{pr.state === 'merged' && (
|
||||
<Badge variant="secondary" className="text-xs">
|
||||
Merged
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground mt-1">
|
||||
#{pr.number} by {pr.isOwner ? 'you' : pr.author} • {pr.sourceBranch} → {pr.targetBranch}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
{!pr.isOwner && pr.state === 'open' && (
|
||||
<>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-8"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await git.checkout({
|
||||
dir: projectPath,
|
||||
ref: pr.sourceBranch,
|
||||
});
|
||||
await refetchGitStatus();
|
||||
toast({
|
||||
title: 'Branch checked out',
|
||||
description: `Switched to ${pr.sourceBranch}`,
|
||||
});
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Checkout failed',
|
||||
description: err instanceof Error ? err.message : 'Unknown error',
|
||||
variant: 'destructive',
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<GitBranch className="h-3 w-3 mr-1" />
|
||||
Review
|
||||
</Button>
|
||||
<MergeDialog
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus.currentBranch}
|
||||
sourceBranch={pr.sourceBranch}
|
||||
targetBranch={pr.targetBranch}
|
||||
onMergeComplete={refetchGitStatus}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!originUrl.startsWith('nostr://') && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-8 shrink-0"
|
||||
onClick={() => window.open(pr.url, '_blank')}
|
||||
>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
</Button>
|
||||
<div className="flex items-start gap-3">
|
||||
<GitPullRequest className={cn(
|
||||
"h-4 w-4 mt-0.5 shrink-0",
|
||||
pr.state === 'merged' ? 'text-purple-600' : 'text-green-600'
|
||||
)} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<h4 className="text-sm font-medium truncate">
|
||||
{pr.title}
|
||||
</h4>
|
||||
{pr.state === 'merged' && (
|
||||
<Badge variant="secondary" className="text-xs shrink-0">
|
||||
Merged
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground mt-1">
|
||||
#{pr.number} by {pr.isOwner ? 'you' : pr.author} • {pr.sourceBranch} → {pr.targetBranch}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Actions row */}
|
||||
{(!pr.isOwner && pr.state === 'open') || !originUrl.startsWith('nostr://') ? (
|
||||
<div className="flex items-center gap-2 pl-7">
|
||||
{!pr.isOwner && pr.state === 'open' && (
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 text-xs"
|
||||
onClick={async () => {
|
||||
try {
|
||||
await git.checkout({
|
||||
dir: projectPath,
|
||||
ref: pr.sourceBranch,
|
||||
});
|
||||
await refetchGitStatus();
|
||||
toast({
|
||||
title: 'Branch checked out',
|
||||
description: `Switched to ${pr.sourceBranch}`,
|
||||
});
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Checkout failed',
|
||||
description: err instanceof Error ? err.message : 'Unknown error',
|
||||
variant: 'destructive',
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<GitBranch className="h-3 w-3 mr-1" />
|
||||
Review
|
||||
</Button>
|
||||
<MergeDialog
|
||||
projectId={projectId}
|
||||
currentBranch={gitStatus.currentBranch}
|
||||
sourceBranch={pr.sourceBranch}
|
||||
targetBranch={pr.targetBranch}
|
||||
onMergeComplete={refetchGitStatus}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!originUrl.startsWith('nostr://') && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-8 text-xs ml-auto"
|
||||
onClick={() => window.open(pr.url, '_blank')}
|
||||
>
|
||||
<ExternalLink className="h-3 w-3 mr-1" />
|
||||
View
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user