import { Check, Shield } from 'lucide-react' import Link from 'next/link' import { useRouter } from 'next/router' import { CommandItem } from 'ui' import { sanitizeRoute } from './ProjectDropdown.utils' import type { Branch } from '@/data/branches/branches-query' 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 router = useRouter() const sanitizedRoute = sanitizeRoute(router.route, router.query) const href = 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 && } ) }
{branch.is_default && } {branch.name}