mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
* Add lucide-react to docs (to make the autocomplete work). * Migrate the docs app icons. * Migrate the ui-patterns. * Remove the old icons from ui package. * Migrate the www app from react-feather icons. * Migrate all of studio icons. * Migrate the only component in design-system. * Fix an old import in ui package. Revert an import in docs app. * Fix some pages in www. * Remove unneeded files used in generation of icons. * Fix a prettier error. * Fix more issues in www. * Fix an issue in Log Date picker. * Replace all string sizes with number sizes because the icons grew in some cases. * Fix more imports in security page. * Fix an extra import. * Remove the size prop from all icons if they're in a button and they match the button size. * Minor fixes for docs and www. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
import { noop } from 'lodash'
|
|
import { Button } from 'ui'
|
|
|
|
import type { Branch } from 'data/branches/branches-query'
|
|
import { BranchLoader, BranchManagementSection, BranchRow, BranchRowLoader } from './BranchPanels'
|
|
import { PreviewBranchesEmptyState } from './EmptyStates'
|
|
import { ChevronRight } from 'lucide-react'
|
|
|
|
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
|
|
}
|
|
|
|
const Overview = ({
|
|
isLoading,
|
|
isSuccess,
|
|
repo,
|
|
mainBranch,
|
|
previewBranches,
|
|
onViewAllBranches,
|
|
onSelectCreateBranch,
|
|
onSelectDeleteBranch,
|
|
generateCreatePullRequestURL,
|
|
}: OverviewProps) => {
|
|
return (
|
|
<>
|
|
<BranchManagementSection header="Production branch">
|
|
{isLoading && <BranchRowLoader />}
|
|
{isSuccess && mainBranch !== undefined && (
|
|
<BranchRow isMain branch={mainBranch} repo={repo} onSelectDeleteBranch={noop} />
|
|
)}
|
|
</BranchManagementSection>
|
|
|
|
<BranchManagementSection
|
|
header="Preview branches"
|
|
footer={
|
|
isSuccess && (
|
|
<div className="flex items-center justify-center">
|
|
<Button type="text" iconRight={<ChevronRight />} onClick={() => onViewAllBranches()}>
|
|
View all branches
|
|
</Button>
|
|
</div>
|
|
)
|
|
}
|
|
>
|
|
{isLoading && <BranchLoader />}
|
|
{isSuccess && previewBranches.length === 0 && (
|
|
<PreviewBranchesEmptyState onSelectCreateBranch={onSelectCreateBranch} />
|
|
)}
|
|
{isSuccess &&
|
|
previewBranches.slice(0, MAX_BRANCHES_OVERVIEW).map((branch) => {
|
|
return (
|
|
<BranchRow
|
|
key={branch.id}
|
|
repo={repo}
|
|
branch={branch}
|
|
generateCreatePullRequestURL={generateCreatePullRequestURL}
|
|
onSelectDeleteBranch={() => onSelectDeleteBranch(branch)}
|
|
/>
|
|
)
|
|
})}
|
|
</BranchManagementSection>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Overview
|