import { BASE_URL, SSH_PORT } from "../../config.ts"; import type { RepositoryRow } from "../../db/index.ts"; import type { SessionUser } from "../../middleware/session.ts"; import type { TreeEntry } from "../../services/git.ts"; import { Layout } from "../layout.tsx"; import { BranchSelector } from "./BranchSelector.tsx"; import { FileTreeTable } from "./FileTreeTable.tsx"; import { RepoHeader } from "./RepoHeader.tsx"; import { RepoNav } from "./RepoNav.tsx"; interface RepoHomeProps { user: SessionUser | null; repo: RepositoryRow; entries: TreeEntry[]; readmeHtml: string | null; hasContent: boolean; branches: string[]; } export function RepoHome({ user, repo, entries, readmeHtml, hasContent, branches, }: RepoHomeProps) { return (
{repo.description && (

{repo.description}

)} {!hasContent ? (

This repository is empty.

Push your first commit to get started:

                            {`git clone ${sshUrl(repo.name)}
cd ${repo.name}
echo "# ${repo.name}" > README.md
git add .
git commit -m "Initial commit"
git push origin main`}
                        
) : ( <>
Clone
HTTP
SSH
{readmeHtml && (
README
{readmeHtml}
)} )}
); } function httpUrl(name: string) { return `${BASE_URL}/${name}.git`; } function sshUrl(name: string) { const host = new URL(BASE_URL).hostname; return `ssh://git@${host}:${SSH_PORT}/${name}.git`; }