import { noop } from 'lodash'
import { Button } from 'ui'
import type { Branch } from 'data/branches/branches-query'
import { ChevronRight } from 'lucide-react'
import { BranchLoader, BranchManagementSection, BranchRow, BranchRowLoader } from './BranchPanels'
import { PreviewBranchesEmptyState } from './EmptyStates'
const MAX_BRANCHES_OVERVIEW = 10
interface OverviewProps {
isLoading: boolean
isSuccess: boolean
repo: string
mainBranch: Branch
previewBranches: Branch[]
onViewAllBranches: () => void
onSelectCreateBranch: () => void
onSelectDeleteBranch: (branch: Branch) => void
generateCreatePullRequestURL: (branchName?: string) => string
showProductionBranch?: boolean
}
export const Overview = ({
isLoading,
isSuccess,
repo,
mainBranch,
previewBranches,
onViewAllBranches,
onSelectCreateBranch,
onSelectDeleteBranch,
generateCreatePullRequestURL,
showProductionBranch = true,
}: OverviewProps) => {
return (
<>
{showProductionBranch && (
{isLoading && }
{isSuccess && mainBranch !== undefined && (
)}
)}
} onClick={() => onViewAllBranches()}>
View all branches
)
}
>
{isLoading && }
{isSuccess && previewBranches.length === 0 && (
)}
{isSuccess &&
previewBranches.slice(0, MAX_BRANCHES_OVERVIEW).map((branch) => {
return (
onSelectDeleteBranch(branch)}
/>
)
})}
>
)
}