Files
supabase/apps/studio/components/layouts/Navigation/NavigationBar/ProjectBranchSelectorTrigger.tsx
Joshen Lim f7ea722b35 Consolidate grid header actions in table editor into a single row (#45504)
## Consolidate Table Editor grid header actions into a single row


https://github.com/user-attachments/assets/1020c385-8fa9-4ef1-b5e7-03983111508b

## Changes involved
- Index advisor, Realtime, and API docs are now behind a dropdown menu
button (Treated as secondary actions)
- Grid header actions shifted into the same row as filter bar (more
space for data grid)
- Header actions will hide while filter bar is in focus (remove
distractions, more space for filter bar)

## Changes to filter bar
- Filter bar will refocus when deleting a filter
- Clicking on the search icon will focus on the free form input of the
filter bar

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a “More” dropdown in grid actions to access Realtime, API docs,
and Index Advisor.
* New dialogs for enabling Index Advisor and toggling Realtime are now
consistently managed.

* **Improvements**
* Improved filter focus handling with auto-refocus when conditions
change and responsive header behavior.
* Adjusted popover alignment, separator visuals,
header/footer/pagination layout and sizing.
* Filter bar now supports programmatic focus; Connect button supports
icon-only mode.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
2026-05-06 10:53:49 +08:00

64 lines
2.0 KiB
TypeScript

import { ChevronsUpDown, GitBranch } from 'lucide-react'
import { forwardRef } from 'react'
import { cn, SidebarMenuButton } from 'ui'
export interface ProjectBranchSelectorTriggerProps {
displayProjectName: string
selectedOrgInitial: string
isBranch: boolean
isProductionBranch: boolean
branchDisplayName: string
onGoToOrganization: () => void
onClick?: () => void
}
export const ProjectBranchSelectorTrigger = forwardRef<
HTMLButtonElement,
ProjectBranchSelectorTriggerProps
>(
(
{
displayProjectName,
selectedOrgInitial,
isBranch,
branchDisplayName,
onClick,
}: ProjectBranchSelectorTriggerProps,
ref
) => {
return (
<SidebarMenuButton
size="lg"
className="group py-1 gap-1.5 w-full flex h-auto text-left data-open:bg-sidebar-accent data-open:text-sidebar-accent-foreground touch-manipulation gap-x-3"
onClick={onClick}
ref={ref}
>
<div className="relative flex h-8 aspect-square shrink-0 items-center bg-background-muted group-hover:border-stronger justify-center rounded-sm border border-strong text-xs">
{selectedOrgInitial}
</div>
<div className="text-left grow min-w-0">
<div className="w-full truncate text-foreground leading-tight max-w-[250px]">
{displayProjectName}
</div>
<div
className={cn(
'flex items-center gap-0.5',
isBranch ? 'text-foreground-lighter' : 'text-warning'
)}
>
<GitBranch className="shrink-0 size-3" strokeWidth={1.5} />
<span className="truncate min-w-0 leading-tight text-xs">{branchDisplayName}</span>
</div>
</div>
<ChevronsUpDown
strokeWidth={1.5}
className="ml-auto text-foreground-lighter w-4! h-4! md:hidden md:group-hover:flex"
/>
</SidebarMenuButton>
)
}
)
ProjectBranchSelectorTrigger.displayName = 'ProjectBranchSelectorTrigger'