import { MAX_BRANCH_NAME_LENGTH } from "../../constants.ts"; import type { RepositoryRow } from "../../db/index.ts"; import { formatDateTime } from "../../lib/formatDate.ts"; import type { SessionUser } from "../../middleware/session.ts"; import type { BranchInfo } from "../../services/git.ts"; import { Layout } from "../layout.tsx"; import { Pagination } from "../Pagination.tsx"; import { RepoHeader } from "./RepoHeader.tsx"; import { RepoNav } from "./RepoNav.tsx"; interface BranchListProps { user: SessionUser | null; repo: RepositoryRow; branches: BranchInfo[]; page: number; totalPages: number; success?: string; error?: string; } export function BranchList({ user, repo, branches, page, totalPages, success, error, }: BranchListProps) { return (
{!!success && (

{success}

)} {!!error && (

{error}

)}

Branches

{user?.isAdmin && (
New branch
)}
{branches.length === 0 ? (

No branches yet.

) : (
    {branches.map((b) => (
  • {b.name} {b.name === repo.default_branch && ( default )}
    {!!b.authorName && ( {b.authorName} )} {!!b.shortHash && ( {b.shortHash} )} {!!b.subject && ( {b.subject} )} {!!b.date && ( )} {user?.isAdmin && (
    Rename
    {b.name !== repo.default_branch && (
    Delete
    Delete branch{" "} {b.name} ?
    )}
    )}
  • ))}
)}
); }