{{ define "title" }}
    wip
{{ end }}

{{ define "mainLayout" }}
{{ template "fragments/resizable" }}
{{ $version := .Pull.LatestVersion }}
<style>
.debug {
  border-width: 1px;
  border-color: red;
}
.debug-section {
  border-width: 1px;
  border-color: red;
  padding: 1rem;
}
</style>
<div class="flex">
  <div class="flex-1 min-w-0">
    <div class="grid grid-cols-1 lg:grid-cols-[1fr_22.5rem]">
      <div class="debug-section min-w-0 lg:row-start-1 lg:col-start-1">
        <h2 class="">{{ .Pull.Title }}</h2>
        <div>{{ .Pull.Body | markdown }}</div>
      </div>
      <div class="debug-section lg:row-start-1 lg:row-end-3 lg:col-start-2">
        labels
      </div>
      <div class="debug-section lg:row-start-2 lg:col-start-1">
        commits
      </div>
    </div>
    <div class="">
      <div class="debug sticky h-12 top-0 z-10 flex items-center">
        <div class="md:block hidden">
          <label for="diff-tree-toggle" title="Toggle filetree panel" class="btn-flat cursor-pointer">
            <span class="peer-checked:hidden">{{ i "panel-left-open" "size-4" }}</span>
            <span class="hidden peer-checked:inline">{{ i "panel-left-close" "size-4" }}</span>
          </label>
        </div>
        diff header
      </div>
      <div class="flex">
        <input type="checkbox" id="diff-tree-toggle" class="peer hidden" checked>
        <div id="diff-files" class="hidden peer-checked:block w-96">
          <div class="debug-section sticky top-12 max-h-[calc(100vh-3rem)]">
            diff tree
          </div>
        </div>

        {{ template "resize-grip" (list "resize-diff-files" "diff-files" "before") }}

        <div class="p-2 flex-1 min-w-0">
          <div class="space-y-4">
          </div>
          <div
            hx-get="/{{ .Pull.RepoDid }}/pulls/test?base={{ $version.Base }}&head={{ $version.Head }}"
            hx-swap="outerHTML"
            hx-trigger="load"
          >
            loading...
          </div>
        </div>
      </div>
    </div>
  </div>

  {{ template "resize-grip" (list "resize-discussion" "discussion" "after") }}

  <div id="discussion" class="debug w-96">
    <div class="debug-section sticky top-0 min-h-screen">
      {{ range .Comments }}
        {{ template "fragments/comment/pullComment"
          (dict "LoggedInUser" $.LoggedInUser
                "Reactions"    (index (asReactionMapMap $.Reactions) .FeedCommentAtUri)
                "UserReacted"  (index (asReactionStatusMapMap $.UserReacted) .FeedCommentAtUri)
                "Comment"      .) }}
      {{ end }}
      discussion
    </div>
  </div>
</div>
{{ end }}

{{ define "repoContentLayout" }}
  <div class="px-1 flex-grow flex flex-col gap-4">
    <p>repo content</p>
  </div>
{{ end }}

{{ define "block" }}
<div class="bg-white dark:bg-gray-800 drop-shadow-sm rounded border border-gray-200 dark:border-gray-700 overflow-clip">
  <details class="group w-full" open>
    <summary class="list-none cursor-pointer sticky top-12 group-open:border-b border-gray-200 dark:border-gray-700">
      <div class="flex justify-between bg-white dark:bg-gray-800">
        <div class="p-2 flex gap-2 items-center overflow-x-auto">
          <span class="group-open:hidden inline">{{ i "chevron-right" "w-4 h-4" }}</span>
          <span class="hidden group-open:inline">{{ i "chevron-down" "w-4 h-4" }}</span>
          {{ template "repo/fragments/diffStatPill" (dict "Insertions" 27 "Deletions" 27) }}
          <span>api/tangled/cbor_gen.go</span>
        </div>
        <div>
        </div>
      </div>
    </summary>
    unified
    <table class="diff">
      <colgroup>
        <col width="40" />
        <col width="40" />
        <col />
      </colgroup>
      <tbody>
        <tr class="splitter"><td colspan="3">&middot;&middot;&middot;</td></tr>
        <tr class="deleted">
          <td class="num">665</td>
          <td class="num"></td>
          <td class="content" data-diff-marker="-">func (t *CiDefs_Pipeline) MarshalCBOR(w io.Writer) error {</td>
        </tr>
        <tr class="added">
          <td class="num"></td>
          <td class="num">665</td>
          <td class="content" data-diff-marker="+">func (t *CiPipeline) MarshalCBOR(w io.Writer) error {</td>
        </tr>
      </tbody>
    </table>
    split
    <table class="diff">
      <colgroup>
        <col width="40" />
        <col />
        <col width="40" />
        <col />
      </colgroup>
      <tbody>
        <tr class="splitter"><td colspan="4">&middot;&middot;&middot;</td></tr>
        <tr class="">
          <td class="deleted num">1</td>
          <td class="deleted content" data-diff-marker="-">thingsome</td>
          <td class="added num">1</td>
          <td class="added content" data-diff-marker="+">something</td>
        </tr>
      </tbody>
    </table>
  </details>
</div>
{{ end }}
