import { CheckIcon, ShieldIcon } from 'lucide-react' import { sanitizeRoute } from './ProjectDropdown.utils' import { CommandItemLink } from '@/components/ui/CommandItemLink' import type { Branch } from '@/data/branches/branches-query' import { useRoutePattern } from '@/hooks/misc/useRoutePattern' import { useTrack } from '@/lib/telemetry/track' export interface BranchLinkProps { branch: Branch isSelected: boolean onClose: () => void } export function BranchLink({ branch, isSelected, onClose }: BranchLinkProps) { const track = useTrack() const routePattern = useRoutePattern() const sanitizedRoute = sanitizeRoute(routePattern) const href = routePattern.startsWith('/project/$ref/branches') ? `/project/${branch.project_ref}` : (sanitizedRoute?.replace('$ref', branch.project_ref) ?? `/project/${branch.project_ref}`) return ( { track('branch_selector_branch_clicked', { branchId: branch.id, branchName: branch.name, }) onClose() }} >

{branch.is_default && } {branch.name}

{isSelected && }
) }