]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19989 Remove extra separator in branch/PR menu
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>
Mon, 24 Jul 2023 10:18:42 +0000 (12:18 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 24 Jul 2023 20:03:21 +0000 (20:03 +0000)
server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItemList.tsx

index c91f6b744b7a77d7ed4bf89a1318f2b1ddfde7fc..6d76c7ae1a7320357314e8685ca8fd765cf4d751 100644 (file)
@@ -56,6 +56,8 @@ export function MenuItemList(props: MenuItemListProps) {
     />
   );
 
+  const branches = [branchLikeTree.mainBranchTree, ...branchLikeTree.branchTree];
+
   return (
     <ul className="item-list sw-overflow-y-auto sw-overflow-x-hidden">
       {!hasResults && (
@@ -65,22 +67,20 @@ export function MenuItemList(props: MenuItemListProps) {
       )}
 
       {/* BRANCHES & PR */}
-      {[branchLikeTree.mainBranchTree, ...branchLikeTree.branchTree]
-        .filter(isDefined)
-        .map((tree) => (
-          <React.Fragment key={getBranchLikeKey(tree.branch)}>
-            {renderItem(tree.branch)}
-            {tree.pullRequests.length > 0 && (
-              <>
-                <ItemDivider />
-                <ItemHeader>{translate('branch_like_navigation.pull_requests')}</ItemHeader>
-                <ItemDivider />
-                {tree.pullRequests.map((pr) => renderItem(pr, true))}
-                {tree.pullRequests.length > 0 && <ItemDivider />}
-              </>
-            )}
-          </React.Fragment>
-        ))}
+      {branches.filter(isDefined).map((tree, treeIndex) => (
+        <React.Fragment key={getBranchLikeKey(tree.branch)}>
+          {renderItem(tree.branch)}
+          {tree.pullRequests.length > 0 && (
+            <>
+              <ItemDivider />
+              <ItemHeader>{translate('branch_like_navigation.pull_requests')}</ItemHeader>
+              <ItemDivider />
+              {tree.pullRequests.map((pr) => renderItem(pr, true))}
+              {tree.pullRequests.length > 0 && treeIndex !== branches.length - 1 && <ItemDivider />}
+            </>
+          )}
+        </React.Fragment>
+      ))}
 
       {/* PARENTLESS PR (for display during search) */}
       {branchLikeTree.parentlessPullRequests.length > 0 && (