From f269d96d51fb84e139b54fb18dbccf6a3be0335f Mon Sep 17 00:00:00 2001 From: chihlasm Date: Sat, 21 Feb 2026 04:21:55 -0500 Subject: [PATCH] fix: auto-advance branch detail and pin navigation bar - Auto-advance to next undetailed branch after generation completes, using a useEffect that watches the count of detailed branches - Cap tree preview at max-h-48 with internal scroll so the nav bar is never pushed off screen - Make nav bar sticky bottom-0 with bg-card so it stays visible regardless of content height Co-Authored-By: Claude Sonnet 4.6 --- .../ai-builder/BranchDetailView.tsx | 205 ++++++++++-------- 1 file changed, 110 insertions(+), 95 deletions(-) diff --git a/frontend/src/components/ai-builder/BranchDetailView.tsx b/frontend/src/components/ai-builder/BranchDetailView.tsx index 25baba07..0727f070 100644 --- a/frontend/src/components/ai-builder/BranchDetailView.tsx +++ b/frontend/src/components/ai-builder/BranchDetailView.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react' +import { useState, useEffect, useRef } from 'react' import { Check, RefreshCw, SkipForward, ChevronRight, ChevronLeft } from 'lucide-react' import { useAIFlowBuilderStore } from '@/store/aiFlowBuilderStore' import { GeneratingAnimation } from './GeneratingAnimation' @@ -21,6 +21,18 @@ export function BranchDetailView() { const allBranchesHaveDetail = selectedBranches.every((b) => b.steps) const branchesWithDetail = selectedBranches.filter((b) => b.steps).length + // Auto-advance to next branch without detail after generation completes + const prevDetailCount = useRef(branchesWithDetail) + useEffect(() => { + if (branchesWithDetail > prevDetailCount.current) { + prevDetailCount.current = branchesWithDetail + const nextIndex = selectedBranches.findIndex((b) => !b.steps) + if (nextIndex !== -1) { + setViewingIndex(nextIndex) + } + } + }, [branchesWithDetail, selectedBranches]) + const handleGenerate = async (branchName: string) => { setError(null) await generateBranchDetail(branchName) @@ -35,103 +47,106 @@ export function BranchDetailView() { } return ( -
- {/* Branch tabs */} -
- {selectedBranches.map((branch, i) => ( - + ))} +
+ + {/* Current branch detail */} + {currentBranch && ( +
+
+
+

{currentBranch.name}

+

{currentBranch.description}

+
+
+ + {currentBranch.steps ? ( +
+ {/* Mini tree preview */} +
+ +
+ +
+ +
+
+ ) : ( +
+

+ Generate AI detail for this branch +

+
+ + +
+
)} - > - {branch.name} - {branch.steps && ( - - )} - - ))} +
+ )} + + {/* Error */} + {error && ( +
+ {error} +
+ )}
- {/* Current branch detail */} - {currentBranch && ( -
-
-
-

{currentBranch.name}

-

{currentBranch.description}

-
-
- - {currentBranch.steps ? ( -
- {/* Mini tree preview */} -
- -
- -
- -
-
- ) : ( -
-

- Generate AI detail for this branch -

-
- - -
-
- )} -
- )} - - {/* Error */} - {error && ( -
- {error} -
- )} - - {/* Navigation */} -
+ {/* Navigation — sticky so it's always visible */} +