Fix Git Management Dialog overflow with proper scrolling

The Git Management Dialog was experiencing overflow issues when additional
fields were added to the various tabs. The modal needed proper scroll
behavior to handle dynamic content.

Changes:
- Added flex layout to DialogContent with proper overflow handling
- Made DialogHeader and TabsList shrink-0 to prevent them from scrolling
- Added overflow-y-auto and flex-1 to each TabsContent for independent scrolling
- Removed fixed-height ScrollArea from BranchManager in favor of natural flow
- Content now scrolls properly within the modal without overflowing

The modal now maintains a max height of 90vh with proper scrolling for
overflow content in any tab (Branches, Changes, or Compare).
This commit is contained in:
shakespeare.diy committed 2025-10-14 15:22:29 -05:00
1 parent f43ce5cb5b
commit 9c24785b11
2 files changed
+54 -56

No files matched your search

+47 -49
View File
@@ -335,59 +335,57 @@ export function BranchManager({ projectId, currentBranch, onBranchChange }: Bran
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : (
<ScrollArea className="h-[400px]">
<div className="space-y-4">
{/* Local Branches */}
{localBranches.length > 0 && (
<div className="space-y-2">
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
Local Branches
</div>
<div className="space-y-1">
{localBranches.map((branch) => (
<BranchItem
key={branch.name}
branch={branch}
onSwitch={handleSwitchBranch}
onDelete={handleDeleteBranch}
isSwitching={switchingToBranch === branch.name}
isDeleting={deletingBranch === branch.name}
/>
))}
</div>
<div className="space-y-4">
{/* Local Branches */}
{localBranches.length > 0 && (
<div className="space-y-2">
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
Local Branches
</div>
)}
<div className="space-y-1">
{localBranches.map((branch) => (
<BranchItem
key={branch.name}
branch={branch}
onSwitch={handleSwitchBranch}
onDelete={handleDeleteBranch}
isSwitching={switchingToBranch === branch.name}
isDeleting={deletingBranch === branch.name}
/>
))}
</div>
</div>
)}
{/* Remote Branches */}
{remoteBranches.length > 0 && (
<div className="space-y-2">
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
Remote Branches
</div>
<div className="space-y-1">
{remoteBranches.map((branch) => (
<BranchItem
key={`remote-${branch.name}`}
branch={branch}
onSwitch={handleSwitchBranch}
onDelete={handleDeleteBranch}
isSwitching={switchingToBranch === branch.name}
isDeleting={deletingBranch === branch.name}
/>
))}
</div>
{/* Remote Branches */}
{remoteBranches.length > 0 && (
<div className="space-y-2">
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
Remote Branches
</div>
)}
<div className="space-y-1">
{remoteBranches.map((branch) => (
<BranchItem
key={`remote-${branch.name}`}
branch={branch}
onSwitch={handleSwitchBranch}
onDelete={handleDeleteBranch}
isSwitching={switchingToBranch === branch.name}
isDeleting={deletingBranch === branch.name}
/>
))}
</div>
</div>
)}
{/* Empty state */}
{localBranches.length === 0 && remoteBranches.length === 0 && (
<div className="text-center py-8 text-muted-foreground">
<GitBranch className="h-12 w-12 mx-auto mb-2 opacity-50" />
<p className="text-sm">No branches found</p>
</div>
)}
</div>
</ScrollArea>
{/* Empty state */}
{localBranches.length === 0 && remoteBranches.length === 0 && (
<div className="text-center py-8 text-muted-foreground">
<GitBranch className="h-12 w-12 mx-auto mb-2 opacity-50" />
<p className="text-sm">No branches found</p>
</div>
)}
</div>
)}
</div>
);
+7 -7
View File
@@ -45,16 +45,16 @@ export function GitManagementDialog({
<>
<Dialog open={open} onOpenChange={onOpenChange}>
{children && <DialogTrigger asChild>{children}</DialogTrigger>}
<DialogContent className="max-w-6xl max-h-[90vh] p-0">
<DialogHeader className="px-6 pt-6 pb-4">
<DialogContent className="max-w-6xl max-h-[90vh] p-0 flex flex-col">
<DialogHeader className="px-6 pt-6 pb-4 shrink-0">
<DialogTitle className="flex items-center gap-2">
<GitBranch className="h-5 w-5" />
Git Management
</DialogTitle>
</DialogHeader>
<Tabs value={activeTab} onValueChange={setActiveTab} className="flex-1">
<div className="border-b px-6">
<Tabs value={activeTab} onValueChange={setActiveTab} className="flex-1 flex flex-col overflow-hidden">
<div className="border-b px-6 shrink-0">
<TabsList className="h-auto p-0 bg-transparent">
<TabsTrigger
value="branches"
@@ -81,7 +81,7 @@ export function GitManagementDialog({
</div>
{/* Branches Tab */}
<TabsContent value="branches" className="mt-0 p-6">
<TabsContent value="branches" className="mt-0 p-6 overflow-y-auto flex-1">
<BranchManager
projectId={projectId}
currentBranch={gitStatus?.currentBranch || null}
@@ -90,7 +90,7 @@ export function GitManagementDialog({
</TabsContent>
{/* Changes Tab */}
<TabsContent value="changes" className="mt-0 h-[600px]">
<TabsContent value="changes" className="mt-0 overflow-y-auto flex-1">
<DiffViewer
projectId={projectId}
compareFrom="HEAD"
@@ -98,7 +98,7 @@ export function GitManagementDialog({
</TabsContent>
{/* Compare Tab */}
<TabsContent value="compare" className="mt-0 p-6">
<TabsContent value="compare" className="mt-0 p-6 overflow-y-auto flex-1">
<CompareView projectId={projectId} />
</TabsContent>
</Tabs>