this repo has no description
1{{ define "repo/fragments/diff" }}
2 {{ $repo := index . 0 }}
3 {{ $diff := index . 1 }}
4 {{ $opts := index . 2 }}
5
6 {{ $commit := $diff.Commit }}
7 {{ $diff := $diff.Diff }}
8 {{ $isSplit := $opts.Split }}
9 {{ $this := $commit.This }}
10 {{ $parent := $commit.Parent }}
11 {{ $last := sub (len $diff) 1 }}
12
13 <div class="flex flex-col gap-4">
14 {{ range $idx, $hunk := $diff }}
15 {{ with $hunk }}
16 <details open id="file-{{ .Name.New }}" class="group border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm" tabindex="{{ add $idx 1 }}">
17 <summary class="list-none cursor-pointer sticky top-0">
18 <div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between">
19 <div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto">
20 <span class="group-open:hidden inline">{{ i "chevron-right" "w-4 h-4" }}</span>
21 <span class="hidden group-open:inline">{{ i "chevron-down" "w-4 h-4" }}</span>
22 {{ template "repo/fragments/diffStatPill" .Stats }}
23
24 <div class="flex gap-2 items-center overflow-x-auto">
25 {{ if .IsDelete }}
26 {{ .Name.Old }}
27 {{ else if (or .IsCopy .IsRename) }}
28 {{ .Name.Old }} {{ i "arrow-right" "w-4 h-4" }} {{ .Name.New }}
29 {{ else }}
30 {{ .Name.New }}
31 {{ end }}
32 </div>
33 </div>
34 </div>
35 </summary>
36
37 <div class="transition-all duration-700 ease-in-out">
38 {{ if .IsBinary }}
39 <p class="text-center text-gray-400 dark:text-gray-500 p-4">
40 This is a binary file and will not be displayed.
41 </p>
42 {{ else }}
43 {{ if $isSplit }}
44 {{- template "repo/fragments/splitDiff" .Split -}}
45 {{ else }}
46 {{- template "repo/fragments/unifiedDiff" . -}}
47 {{ end }}
48 {{- end -}}
49 </div>
50 </details>
51 {{ end }}
52 {{ end }}
53 </div>
54{{ end }}