{{ define "repo/pulls/fragments/pullHeader" }}
<header class="pb-2">
    <h1 class="text-2xl dark:text-white">
        {{ .Pull.Title | description }}
        <span class="text-gray-500 dark:text-gray-400">#{{ .Pull.PullId }}</span>
    </h1>
</header>

<section>
    <div class="flex items-center gap-2">
        {{ template "repo/pulls/fragments/pullState" .Pull.State }}
        <span class="text-gray-500 dark:text-gray-400 text-sm flex flex-wrap items-center gap-1">
            opened by
            {{ template "user/fragments/picLink" (list .Pull.OwnerDid "size-6" (index .VouchRelationships (did .Pull.OwnerDid))) }}
            <a href="/{{ resolve .Pull.OwnerDid }}">{{ resolve .Pull.OwnerDid }}</a>
            <span class="select-none before:content-['\00B7']"></span>
            {{ template "repo/fragments/time" .Pull.Created }}

            <span class="select-none before:content-['\00B7']"></span>
            <span>
              targeting
              <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
                <a href="/{{ .RepoInfo.FullName }}/tree/{{ .Pull.TargetBranch }}" class="no-underline hover:underline">{{ .Pull.TargetBranch }}</a>
              </span>
            </span>
            {{ if not .Pull.IsPatchBased }}
              from
              <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
                {{ if not .Pull.IsForkBased }}
                {{ $repoPath := .RepoInfo.FullName }}
                  <a href="/{{ $repoPath }}/tree/{{ pathEscape .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
                {{ else if .Pull.PullSource.Repo }}
                {{ $repoPath := print (resolve .Pull.PullSource.Repo.Did) "/" .Pull.PullSource.Repo.Name }}
                  <a href="/{{ $repoPath }}" class="no-underline hover:underline">{{ $repoPath }}</a>:
                  <a href="/{{ $repoPath }}/tree/{{ pathEscape .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
                {{ else }}
                  <span class="italic">[deleted fork]</span>:
                  {{ .Pull.PullSource.Branch }}
                {{ end }}
              </span>
            {{ end }}
        </span>
    </div>

    {{ if .Pull.Body }}
        <article id="body" class="mt-8 prose dark:prose-invert">
            {{ .Pull.Body | markdown }}
        </article>
    {{ end }}

    <div class="mt-2">
      {{ template "repo/fragments/reactions"
        (dict "Reactions"   .Reactions
              "UserReacted" .UserReacted
              "ThreadAt"    .Pull.AtUri) }}
    </div>
</section>


{{ end }}
