{{ define "title" }}{{ .RepoInfo.FullName }}{{ end }}

{{ define "extrameta" }}
    {{ template "repo/fragments/meta" . }}
    {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo) }}
{{ end }}

{{ define "repoContent" }}
  <main>
    {{ if gt (len .BranchesTrunc) 0 }}
      <div class="flex flex-col items-center">
        <p class="text-center pt-5 text-gray-400 dark:text-gray-500">
        This branch is empty. Other branches in this repository are populated:
        </p>
        <div class="mt-4 grid grid-cols-1 divide-y divide-gray-200 dark:divide-gray-700 rounded border border-gray-200 dark:border-gray-700 w-full md:w-1/2">
          {{ range $br := .BranchesTrunc }}
          <a href="/{{ $.RepoInfo.FullName }}/tree/{{$br.Name | urlquery }}" class="no-underline hover:no-underline">
            <div class="flex items-center justify-between p-2">
              {{ $br.Name }}
              <span class="text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" $br.Commit.Committer.When }}</span>
            </div>
          </a>
          {{ end }}
        </div>
      </div>
    {{ else if (and .LoggedInUser (eq .LoggedInUser.Did .RepoInfo.OwnerDid)) }}
      {{ $knot := .RepoInfo.Knot }}
      {{ if eq $knot "knot1.tangled.sh" }}
          {{ $knot = "tangled.org" }}
      {{ end }}
      <div class="w-full flex place-content-center">
        <div class="py-6 w-fit flex flex-col gap-4">
          <p>This is an empty repository. To get started:</p>
          {{ $bullet := "mx-2 text-xs bg-gray-200 dark:bg-gray-600 rounded-full size-5 flex items-center justify-center font-mono inline-flex align-middle" }}

          <p><span class="{{$bullet}}">1</span>First, generate a new <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key" class="underline">SSH key pair</a>.</p>
          <p><span class="{{$bullet}}">2</span>Then add the public key to your account from the <a href="/settings" class="underline">settings</a> page.</p>
          <p><span class="{{$bullet}}">3</span>Configure your remote to <code>git@{{ $knot | stripPort }}:{{ resolve .RepoInfo.OwnerDid }}/{{ .RepoInfo.Name }}</code></p>
          <p><span class="{{$bullet}}">4</span>Push!</p>
        </div>
      </div>
    {{ else }}
      <p class="text-gray-400 dark:text-gray-500 py-6 text-center">This is an empty repository.</p>
    {{ end }}
  </main>
{{ end }}
