From 763a2f0067f2ffe554febfc312369ebf2246da0a Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Thu, 26 Oct 2023 17:12:13 +0800 Subject: [PATCH] Fix branching dropdown scrollarea (#18489) * Fix branching dropdown scrollarea * Add truncate and title prop to branch options in branch dropdown --- .../layouts/AppLayout/BranchDropdown.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/studio/components/layouts/AppLayout/BranchDropdown.tsx b/studio/components/layouts/AppLayout/BranchDropdown.tsx index 3e81c01e3ff..d144dc484ec 100644 --- a/studio/components/layouts/AppLayout/BranchDropdown.tsx +++ b/studio/components/layouts/AppLayout/BranchDropdown.tsx @@ -55,7 +55,9 @@ const BranchLink = ({ }} > - {branch.name} +

+ {branch.name} +

{isSelected && }
@@ -71,7 +73,6 @@ const BranchDropdown = ({ isNewNav = false }: BranchDropdownProps) => { const router = useRouter() const { ref } = useParams() const projectDetails = useSelectedProject() - const branchNameRef = useRef(null) const isBranch = projectDetails?.parent_project_ref !== undefined const projectRef = @@ -79,7 +80,6 @@ const BranchDropdown = ({ isNewNav = false }: BranchDropdownProps) => { const { data: branches, isLoading, isError, isSuccess } = useBranchesQuery({ projectRef }) const [open, setOpen] = useState(false) - const popoverOffset = (branchNameRef.current?.offsetWidth ?? 0) + 12 const selectedBranch = branches?.find((branch) => branch.project_ref === ref) return ( @@ -94,7 +94,7 @@ const BranchDropdown = ({ isNewNav = false }: BranchDropdownProps) => { )} {isSuccess && branches.length > 0 && ( -
+
- + No branches found - 7 ? 'h-[210px]' : ''}> + {branches?.map((branch) => (