appview/pages: move fileTree to the left of diff and interdiff #322

merged
opened by oppi.li targeting master from push-qkpqsrknozxs
+28 -24
appview/pages/templates/layouts/base.html
···
{{ block "extrameta" . }}{{ end }}
</head>
<body class="bg-slate-100 dark:bg-gray-900 dark:text-white transition-colors duration-200">
-
<div class="px-1 grid grid-cols-1 md:grid-cols-12">
-
<div class="col-span-1 md:col-span-2">
-
{{ block "topbarLeft" . }} {{ end }}
-
</div>
-
<header style="z-index: 20" class="col-span-1 md:col-span-8">
-
{{ block "topbar" . }}
-
{{ template "layouts/topbar" . }}
-
{{ end }}
-
</header>
-
<div class="col-span-1 md:col-span-2">
-
{{ block "topbarRight" . }} {{ end }}
+
{{ block "topbarLayout" . }}
+
<div class="px-1 grid grid-cols-1 md:grid-cols-12">
+
<div class="col-span-1 md:col-span-2">
+
{{ block "topbarLeft" . }} {{ end }}
+
</div>
+
<header style="z-index: 20" class="col-span-1 md:col-span-8">
+
{{ block "topbar" . }}
+
{{ template "layouts/topbar" . }}
+
{{ end }}
+
</header>
+
<div class="col-span-1 md:col-span-2">
+
{{ block "topbarRight" . }} {{ end }}
+
</div>
</div>
-
</div>
+
{{ end }}
<div class="flex flex-col min-h-screen">
{{ block "contentLayout" . }}
···
{{ end }}
</div>
-
<div class="px-1 grid grid-cols-1 md:grid-cols-12">
-
<div class="col-span-1 md:col-span-2">
-
{{ block "footerLeft" . }} {{ end }}
-
</div>
-
<footer class="mt-16 col-span-1 md:col-span-8">
-
{{ block "footer" . }}
-
{{ template "layouts/footer" . }}
-
{{ end }}
-
</footer>
-
<div class="col-span-1 md:col-span-2">
-
{{ block "footerRight" . }} {{ end }}
+
{{ block "footerLayout" . }}
+
<div class="px-1 grid grid-cols-1 md:grid-cols-12">
+
<div class="col-span-1 md:col-span-2">
+
{{ block "footerLeft" . }} {{ end }}
+
</div>
+
<footer class="mt-16 col-span-1 md:col-span-8">
+
{{ block "footer" . }}
+
{{ template "layouts/footer" . }}
+
{{ end }}
+
</footer>
+
<div class="col-span-1 md:col-span-2">
+
{{ block "footerRight" . }} {{ end }}
+
</div>
</div>
-
</div>
+
{{ end }}
</body>
</html>
+1 -1
appview/pages/templates/layouts/repobase.html
···
{{ if eq $.Active $key }}
{{ $activeTabStyles }}
{{ else }}
-
group-hover:bg-gray-200 dark:group-hover:bg-gray-700
+
group-hover:bg-gray-100/25 group-hover:dark:bg-gray-700/25
{{ end }}
"
>
+1 -1
appview/pages/templates/layouts/topbar.html
···
{{ define "layouts/topbar" }}
<nav class="space-x-4 mb-4 px-6 py-2 rounded bg-white dark:bg-gray-800 dark:text-white drop-shadow-sm">
-
<div class="container flex justify-between p-0 items-center">
+
<div class="flex justify-between p-0 items-center">
<div id="left-items">
<a href="/" hx-boost="true" class="flex gap-2 font-semibold italic">
tangled<sub>alpha</sub>
+46 -4
appview/pages/templates/repo/commit.html
···
</div>
</section>
+
{{end}}
+
+
{{ define "topbarLayout" }}
+
<div class="px-1 grid grid-cols-1">
+
<header style="z-index: 20" class="col-span-1">
+
{{ block "topbar" . }}
+
{{ template "layouts/topbar" . }}
+
{{ end }}
+
</header>
+
</div>
+
{{ end }}
+
{{ define "contentLayout" }}
+
<div class="grid grid-cols-1 md:grid-cols-1 gap-2">
+
<main class="px-1 col-span-1">
+
{{ block "content" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "contentAfterLayout" . }}
+
<div class="grid grid-cols-1 md:grid-cols-12 gap-2">
+
<div class="col-span-1 md:col-span-2">
+
{{ block "contentAfterLeft" . }} {{ end }}
+
</div>
+
<main class="px-1 col-span-1 md:col-span-10">
+
{{ block "contentAfter" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "footerLayout" . }}
+
<div class="px-1 grid grid-cols-1">
+
<footer class="mt-16 col-span-1">
+
{{ block "footer" . }}
+
{{ template "layouts/footer" . }}
+
{{ end }}
+
</footer>
+
</div>
+
{{ end }}
+
+
{{ define "contentAfter" }}
+
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
{{end}}
-
{{ define "repoAfter" }}
-
<div class="-z-[9999]">
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
-
</div>
+
{{ define "contentAfterLeft" }}
+
<div class="sticky top-0">
+
{{ template "repo/fragments/diffChangedFiles" .Diff }}
+
</div>
{{end}}
+47 -2
appview/pages/templates/repo/compare/compare.html
···
{{ end }}
{{ end }}
-
{{ define "repoAfter" }}
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
+
{{ define "topbarLayout" }}
+
<div class="px-1 grid grid-cols-1">
+
<header style="z-index: 20" class="col-span-1">
+
{{ block "topbar" . }}
+
{{ template "layouts/topbar" . }}
+
{{ end }}
+
</header>
+
</div>
+
{{ end }}
+
+
{{ define "contentLayout" }}
+
<div class="grid grid-cols-1 md:grid-cols-1 gap-2">
+
<main class="px-1 col-span-1">
+
{{ block "content" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "contentAfterLayout" . }}
+
<div class="grid grid-cols-1 md:grid-cols-12 gap-2">
+
<div class="col-span-1 md:col-span-2">
+
{{ block "contentAfterLeft" . }} {{ end }}
+
</div>
+
<main class="px-1 col-span-1 md:col-span-10">
+
{{ block "contentAfter" . }}{{ end }}
+
</main>
+
</div>
{{ end }}
+
+
{{ block "footerLayout" . }}
+
<div class="px-1 grid grid-cols-1">
+
<footer class="mt-16 col-span-1">
+
{{ block "footer" . }}
+
{{ template "layouts/footer" . }}
+
{{ end }}
+
</footer>
+
</div>
+
{{ end }}
+
+
{{ define "contentAfter" }}
+
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
+
{{end}}
+
+
{{ define "contentAfterLeft" }}
+
<div class="sticky top-0">
+
{{ template "repo/fragments/diffChangedFiles" .Diff }}
+
</div>
+
{{end}}
+120 -133
appview/pages/templates/repo/fragments/diff.html
···
{{ $repo := index . 0 }}
{{ $diff := index . 1 }}
{{ $commit := $diff.Commit }}
-
{{ $stat := $diff.Stat }}
-
{{ $fileTree := fileTree $diff.ChangedFiles }}
{{ $diff := $diff.Diff }}
+
{{ $this := $commit.This }}
+
{{ $parent := $commit.Parent }}
-
{{ $this := $commit.This }}
-
{{ $parent := $commit.Parent }}
+
{{ $last := sub (len $diff) 1 }}
+
{{ range $idx, $hunk := $diff }}
+
{{ with $hunk }}
+
<section class="mt-4 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
+
<div id="file-{{ .Name.New }}">
+
<div id="diff-file">
+
<details open>
+
<summary class="list-none cursor-pointer sticky top-0">
+
<div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between">
+
<div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto">
+
<div class="flex gap-1 items-center">
+
{{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }}
+
{{ if .IsNew }}
+
<span class="bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400 {{ $markerstyle }}">ADDED</span>
+
{{ else if .IsDelete }}
+
<span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">DELETED</span>
+
{{ else if .IsCopy }}
+
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">COPIED</span>
+
{{ else if .IsRename }}
+
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">RENAMED</span>
+
{{ else }}
+
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">MODIFIED</span>
+
{{ end }}
-
<section class="mt-6 p-6 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
-
<div class="diff-stat">
-
<div class="flex gap-2 items-center">
-
<strong class="text-sm uppercase dark:text-gray-200">Changed files</strong>
-
{{ block "statPill" $stat }} {{ end }}
-
</div>
-
{{ block "fileTree" $fileTree }} {{ end }}
-
</div>
-
</section>
+
{{ template "repo/fragments/diffStatPill" .Stats }}
+
</div>
-
{{ $last := sub (len $diff) 1 }}
-
{{ range $idx, $hunk := $diff }}
-
{{ with $hunk }}
-
<section class="mt-6 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
-
<div id="file-{{ .Name.New }}">
-
<div id="diff-file">
-
<details open>
-
<summary class="list-none cursor-pointer sticky top-0">
-
<div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between">
-
<div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto">
-
<div class="flex gap-1 items-center">
-
{{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }}
-
{{ if .IsNew }}
-
<span class="bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400 {{ $markerstyle }}">ADDED</span>
-
{{ else if .IsDelete }}
-
<span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">DELETED</span>
-
{{ else if .IsCopy }}
-
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">COPIED</span>
-
{{ else if .IsRename }}
-
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">RENAMED</span>
-
{{ else }}
-
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">MODIFIED</span>
-
{{ end }}
+
<div class="flex gap-2 items-center overflow-x-auto">
+
{{ if .IsDelete }}
+
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $this }}href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}"{{end}}>
+
{{ .Name.Old }}
+
</a>
+
{{ else if (or .IsCopy .IsRename) }}
+
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $parent}}href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}"{{end}}>
+
{{ .Name.Old }}
+
</a>
+
{{ i "arrow-right" "w-4 h-4" }}
+
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $this}}href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}"{{end}}>
+
{{ .Name.New }}
+
</a>
+
{{ else }}
+
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $this}}href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}"{{end}}>
+
{{ .Name.New }}
+
</a>
+
{{ end }}
+
</div>
+
</div>
-
{{ block "statPill" .Stats }} {{ end }}
-
</div>
+
{{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" }}
+
<div id="right-side-items" class="p-2 flex items-center">
+
<a title="top of file" href="#file-{{ .Name.New }}" class="{{ $iconstyle }}">{{ i "arrow-up-to-line" "w-4 h-4" }}</a>
+
{{ if gt $idx 0 }}
+
{{ $prev := index $diff (sub $idx 1) }}
+
<a title="previous file" href="#file-{{ $prev.Name.New }}" class="{{ $iconstyle }}">{{ i "arrow-up" "w-4 h-4" }}</a>
+
{{ end }}
-
<div class="flex gap-2 items-center overflow-x-auto">
-
{{ if .IsDelete }}
-
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $this }}href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}"{{end}}>
-
{{ .Name.Old }}
-
</a>
-
{{ else if (or .IsCopy .IsRename) }}
-
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $parent}}href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}"{{end}}>
-
{{ .Name.Old }}
-
</a>
-
{{ i "arrow-right" "w-4 h-4" }}
-
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $this}}href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}"{{end}}>
-
{{ .Name.New }}
-
</a>
-
{{ else }}
-
<a class="dark:text-white whitespace-nowrap overflow-x-auto" {{if $this}}href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}"{{end}}>
-
{{ .Name.New }}
-
</a>
-
{{ end }}
-
</div>
-
</div>
+
{{ if lt $idx $last }}
+
{{ $next := index $diff (add $idx 1) }}
+
<a title="next file" href="#file-{{ $next.Name.New }}" class="{{ $iconstyle }}">{{ i "arrow-down" "w-4 h-4" }}</a>
+
{{ end }}
+
</div>
-
{{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" }}
-
<div id="right-side-items" class="p-2 flex items-center">
-
<a title="top of file" href="#file-{{ .Name.New }}" class="{{ $iconstyle }}">{{ i "arrow-up-to-line" "w-4 h-4" }}</a>
-
{{ if gt $idx 0 }}
-
{{ $prev := index $diff (sub $idx 1) }}
-
<a title="previous file" href="#file-{{ $prev.Name.New }}" class="{{ $iconstyle }}">{{ i "arrow-up" "w-4 h-4" }}</a>
-
{{ end }}
+
</div>
+
</summary>
-
{{ if lt $idx $last }}
-
{{ $next := index $diff (add $idx 1) }}
-
<a title="next file" href="#file-{{ $next.Name.New }}" class="{{ $iconstyle }}">{{ i "arrow-down" "w-4 h-4" }}</a>
-
{{ end }}
+
<div class="transition-all duration-700 ease-in-out">
+
{{ if .IsDelete }}
+
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
+
This file has been deleted.
+
</p>
+
{{ else if .IsCopy }}
+
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
+
This file has been copied.
+
</p>
+
{{ else if .IsBinary }}
+
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
+
This is a binary file and will not be displayed.
+
</p>
+
{{ else }}
+
{{ $name := .Name.New }}
+
<pre class="overflow-x-auto"><div class="overflow-x-auto"><div class="min-w-full inline-block">{{- range .TextFragments -}}<div class="bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</div>
+
{{- $oldStart := .OldPosition -}}
+
{{- $newStart := .NewPosition -}}
+
{{- $lineNrStyle := "min-w-[3.5rem] flex-shrink-0 select-none text-right bg-white dark:bg-gray-800 scroll-mt-10 target:border target:border-amber-500 target:rounded " -}}
+
{{- $linkStyle := "text-gray-400 dark:text-gray-500 hover:underline" -}}
+
{{- $lineNrSepStyle1 := "" -}}
+
{{- $lineNrSepStyle2 := "pr-2" -}}
+
{{- range .Lines -}}
+
{{- if eq .Op.String "+" -}}
+
<div class="bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400 flex min-w-full items-center">
+
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}"><span aria-hidden="true" class="invisible">{{$newStart}}</span></div>
+
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}" id="{{$name}}-N{{$newStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{$newStart}}">{{ $newStart }}</a></div>
+
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
+
<div class="px-2">{{ .Line }}</div>
+
</div>
+
{{- $newStart = add64 $newStart 1 -}}
+
{{- end -}}
+
{{- if eq .Op.String "-" -}}
+
<div class="bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 flex min-w-full items-center">
+
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}" id="{{$name}}-O{{$oldStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{$oldStart}}">{{ $oldStart }}</a></div>
+
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}"><span aria-hidden="true" class="invisible">{{$oldStart}}</span></div>
+
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
+
<div class="px-2">{{ .Line }}</div>
+
</div>
+
{{- $oldStart = add64 $oldStart 1 -}}
+
{{- end -}}
+
{{- if eq .Op.String " " -}}
+
<div class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 flex min-w-full items-center">
+
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}" id="{{$name}}-O{{$oldStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{$oldStart}}">{{ $oldStart }}</a></div>
+
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}" id="{{$name}}-N{{$newStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{$newStart}}">{{ $newStart }}</a></div>
+
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
+
<div class="px-2">{{ .Line }}</div>
+
</div>
+
{{- $newStart = add64 $newStart 1 -}}
+
{{- $oldStart = add64 $oldStart 1 -}}
+
{{- end -}}
+
{{- end -}}
+
{{- end -}}</div></div></pre>
+
{{- end -}}
</div>
-
</div>
-
</summary>
+
</details>
-
<div class="transition-all duration-700 ease-in-out">
-
{{ if .IsDelete }}
-
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
-
This file has been deleted.
-
</p>
-
{{ else if .IsCopy }}
-
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
-
This file has been copied.
-
</p>
-
{{ else if .IsBinary }}
-
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
-
This is a binary file and will not be displayed.
-
</p>
-
{{ else }}
-
{{ $name := .Name.New }}
-
<pre class="overflow-x-auto"><div class="overflow-x-auto"><div class="min-w-full inline-block">{{- range .TextFragments -}}<div class="bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</div>
-
{{- $oldStart := .OldPosition -}}
-
{{- $newStart := .NewPosition -}}
-
{{- $lineNrStyle := "min-w-[3.5rem] flex-shrink-0 select-none text-right bg-white dark:bg-gray-800 scroll-mt-10 target:border target:border-amber-500 target:rounded " -}}
-
{{- $linkStyle := "text-gray-400 dark:text-gray-500 hover:underline" -}}
-
{{- $lineNrSepStyle1 := "" -}}
-
{{- $lineNrSepStyle2 := "pr-2" -}}
-
{{- range .Lines -}}
-
{{- if eq .Op.String "+" -}}
-
<div class="bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400 flex min-w-full items-center">
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}"><span aria-hidden="true" class="invisible">{{$newStart}}</span></div>
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}" id="{{$name}}-N{{$newStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{$newStart}}">{{ $newStart }}</a></div>
-
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
-
<div class="px-2">{{ .Line }}</div>
-
</div>
-
{{- $newStart = add64 $newStart 1 -}}
-
{{- end -}}
-
{{- if eq .Op.String "-" -}}
-
<div class="bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 flex min-w-full items-center">
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}" id="{{$name}}-O{{$oldStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{$oldStart}}">{{ $oldStart }}</a></div>
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}"><span aria-hidden="true" class="invisible">{{$oldStart}}</span></div>
-
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
-
<div class="px-2">{{ .Line }}</div>
-
</div>
-
{{- $oldStart = add64 $oldStart 1 -}}
-
{{- end -}}
-
{{- if eq .Op.String " " -}}
-
<div class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 flex min-w-full items-center">
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}" id="{{$name}}-O{{$oldStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{$oldStart}}">{{ $oldStart }}</a></div>
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}" id="{{$name}}-N{{$newStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{$newStart}}">{{ $newStart }}</a></div>
-
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
-
<div class="px-2">{{ .Line }}</div>
-
</div>
-
{{- $newStart = add64 $newStart 1 -}}
-
{{- $oldStart = add64 $oldStart 1 -}}
-
{{- end -}}
-
{{- end -}}
-
{{- end -}}</div></div></pre>
-
{{- end -}}
</div>
-
-
</details>
-
-
</div>
-
</div>
-
</section>
-
{{ end }}
-
{{ end }}
+
</div>
+
</section>
+
{{ end }}
+
{{ end }}
{{ end }}
{{ define "statPill" }}
+15
appview/pages/templates/repo/fragments/diffChangedFiles.html
···
+
{{ define "repo/fragments/diffChangedFiles" }}
+
{{ $stat := .Stat }}
+
{{ $fileTree := fileTree .ChangedFiles }}
+
<div class="col-span-1 md:col-span-2 mt-4">
+
<section class="sticky top-0 overflow-x-auto px-6 py-4 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
+
<div class="diff-stat">
+
<div class="flex gap-2 items-center">
+
<strong class="text-sm uppercase dark:text-gray-200">Changed files</strong>
+
{{ template "repo/fragments/diffStatPill" $stat }}
+
</div>
+
{{ template "repo/fragments/fileTree" $fileTree }}
+
</div>
+
</section>
+
</div>
+
{{ end }}
+4 -4
appview/pages/templates/repo/fragments/filetree.html appview/pages/templates/repo/fragments/fileTree.html
···
-
{{ define "fileTree" }}
+
{{ define "repo/fragments/fileTree" }}
{{ if and .Name .IsDirectory }}
<details open>
<summary class="cursor-pointer list-none pt-1">
···
<span class="filename text-black dark:text-white">{{ .Name }}</span>
</span>
</summary>
-
<div class="ml-1 pl-4 border-l border-gray-200 dark:border-gray-700">
+
<div class="ml-1 pl-2 border-l border-gray-200 dark:border-gray-700">
{{ range $child := .Children }}
-
{{ block "fileTree" $child }} {{ end }}
+
{{ template "repo/fragments/fileTree" $child }}
{{ end }}
</div>
</details>
···
</div>
{{ else }}
{{ range $child := .Children }}
-
{{ block "fileTree" $child }} {{ end }}
+
{{ template "repo/fragments/fileTree" $child }}
{{ end }}
{{ end }}
{{ end }}
+69 -111
appview/pages/templates/repo/fragments/interdiff.html
···
{{ $x := index . 1 }}
{{ $fileTree := fileTree $x.AffectedFiles }}
{{ $diff := $x.Files }}
+
{{ $last := sub (len $diff) 1 }}
+
{{ $isSplit := $opts.Split }}
-
<section class="mt-6 p-6 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
-
<div class="diff-stat">
-
<div class="flex gap-2 items-center">
-
<strong class="text-sm uppercase dark:text-gray-200">files</strong>
-
</div>
-
{{ block "fileTree" $fileTree }} {{ end }}
-
</div>
-
</section>
-
-
{{ $last := sub (len $diff) 1 }}
{{ range $idx, $hunk := $diff }}
-
{{ with $hunk }}
-
<section class="mt-6 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
-
<div id="file-{{ .Name }}">
-
<div id="diff-file">
-
<details {{ if not (.Status.IsOnlyInOne) }}open{{end}}>
-
<summary class="list-none cursor-pointer sticky top-0">
-
<div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between">
-
<div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto">
-
<div class="flex gap-1 items-center" style="direction: ltr;">
-
{{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }}
-
{{ if .Status.IsOk }}
-
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">CHANGED</span>
-
{{ else if .Status.IsUnchanged }}
-
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">UNCHANGED</span>
-
{{ else if .Status.IsOnlyInOne }}
-
<span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">REVERTED</span>
-
{{ else if .Status.IsOnlyInTwo }}
-
<span class="bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400 {{ $markerstyle }}">NEW</span>
-
{{ else if .Status.IsRebased }}
-
<span class="bg-amber-100 text-amber-700 dark:bg-amber-800/50 dark:text-amber-400 {{ $markerstyle }}">REBASED</span>
-
{{ else }}
-
<span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">ERROR</span>
-
{{ end }}
-
</div>
+
{{ with $hunk }}
+
<section class="mt-4 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
+
<div id="file-{{ .Name }}">
+
<div id="diff-file">
+
<details {{ if not (.Status.IsOnlyInOne) }}open{{end}}>
+
<summary class="list-none cursor-pointer sticky top-0">
+
<div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between">
+
<div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto">
+
<div class="flex gap-1 items-center" style="direction: ltr;">
+
{{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }}
+
{{ if .Status.IsOk }}
+
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">CHANGED</span>
+
{{ else if .Status.IsUnchanged }}
+
<span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">UNCHANGED</span>
+
{{ else if .Status.IsOnlyInOne }}
+
<span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">REVERTED</span>
+
{{ else if .Status.IsOnlyInTwo }}
+
<span class="bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400 {{ $markerstyle }}">NEW</span>
+
{{ else if .Status.IsRebased }}
+
<span class="bg-amber-100 text-amber-700 dark:bg-amber-800/50 dark:text-amber-400 {{ $markerstyle }}">REBASED</span>
+
{{ else }}
+
<span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">ERROR</span>
+
{{ end }}
+
</div>
-
<div class="flex gap-2 items-center overflow-x-auto" style="direction: rtl;">
-
<a class="dark:text-white whitespace-nowrap overflow-x-auto" href="">
-
{{ .Name }}
-
</a>
+
<div class="flex gap-2 items-center overflow-x-auto" style="direction: rtl;">
+
<a class="dark:text-white whitespace-nowrap overflow-x-auto" href="">
+
{{ .Name }}
+
</a>
+
</div>
</div>
-
</div>
-
{{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" }}
-
<div id="right-side-items" class="p-2 flex items-center">
-
<a title="top of file" href="#file-{{ .Name }}" class="{{ $iconstyle }}">{{ i "arrow-up-to-line" "w-4 h-4" }}</a>
-
{{ if gt $idx 0 }}
-
{{ $prev := index $diff (sub $idx 1) }}
-
<a title="previous file" href="#file-{{ $prev.Name }}" class="{{ $iconstyle }}">{{ i "arrow-up" "w-4 h-4" }}</a>
-
{{ end }}
+
{{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" }}
+
<div id="right-side-items" class="p-2 flex items-center">
+
<a title="top of file" href="#file-{{ .Name }}" class="{{ $iconstyle }}">{{ i "arrow-up-to-line" "w-4 h-4" }}</a>
+
{{ if gt $idx 0 }}
+
{{ $prev := index $diff (sub $idx 1) }}
+
<a title="previous file" href="#file-{{ $prev.Name }}" class="{{ $iconstyle }}">{{ i "arrow-up" "w-4 h-4" }}</a>
+
{{ end }}
+
+
{{ if lt $idx $last }}
+
{{ $next := index $diff (add $idx 1) }}
+
<a title="next file" href="#file-{{ $next.Name }}" class="{{ $iconstyle }}">{{ i "arrow-down" "w-4 h-4" }}</a>
+
{{ end }}
+
</div>
-
{{ if lt $idx $last }}
-
{{ $next := index $diff (add $idx 1) }}
-
<a title="next file" href="#file-{{ $next.Name }}" class="{{ $iconstyle }}">{{ i "arrow-down" "w-4 h-4" }}</a>
-
{{ end }}
</div>
+
</summary>
+
<div class="transition-all duration-700 ease-in-out">
+
{{ if .Status.IsUnchanged }}
+
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
+
This file has not been changed.
+
</p>
+
{{ else if .Status.IsRebased }}
+
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
+
This patch was likely rebased, as context lines do not match.
+
</p>
+
{{ else if .Status.IsError }}
+
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
+
Failed to calculate interdiff for this file.
+
</p>
+
{{ else }}
+
{{ if $isSplit }}
+
{{- template "repo/fragments/splitDiff" .Split -}}
+
{{ else }}
+
{{- template "repo/fragments/unifiedDiff" . -}}
+
{{ end }}
+
{{- end -}}
</div>
-
</summary>
-
<div class="transition-all duration-700 ease-in-out">
-
{{ if .Status.IsUnchanged }}
-
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
-
This file has not been changed.
-
</p>
-
{{ else if .Status.IsRebased }}
-
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
-
This patch was likely rebased, as context lines do not match.
-
</p>
-
{{ else if .Status.IsError }}
-
<p class="text-center text-gray-400 dark:text-gray-500 p-4">
-
Failed to calculate interdiff for this file.
-
</p>
-
{{ else }}
-
{{ $name := .Name }}
-
<pre class="overflow-x-auto"><div class="overflow-x-auto"><div class="min-w-full inline-block">{{- range .TextFragments -}}<div class="bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 select-none text-center">&middot;&middot;&middot;</div>
-
{{- $oldStart := .OldPosition -}}
-
{{- $newStart := .NewPosition -}}
-
{{- $lineNrStyle := "min-w-[3.5rem] flex-shrink-0 select-none text-right bg-white dark:bg-gray-800 scroll-mt-10 target:border target:border-amber-500 target:rounded " -}}
-
{{- $linkStyle := "text-gray-400 dark:text-gray-500 hover:underline" -}}
-
{{- $lineNrSepStyle1 := "" -}}
-
{{- $lineNrSepStyle2 := "pr-2" -}}
-
{{- range .Lines -}}
-
{{- if eq .Op.String "+" -}}
-
<div class="bg-green-100 dark:bg-green-800/30 text-green-700 dark:text-green-400 flex min-w-full items-center">
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}"><span aria-hidden="true" class="invisible">{{$newStart}}</span></div>
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}" id="{{$name}}-N{{$newStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{$newStart}}">{{ $newStart }}</a></div>
-
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
-
<div class="px-2">{{ .Line }}</div>
-
</div>
-
{{- $newStart = add64 $newStart 1 -}}
-
{{- end -}}
-
{{- if eq .Op.String "-" -}}
-
<div class="bg-red-100 dark:bg-red-800/30 text-red-700 dark:text-red-400 flex min-w-full items-center">
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}" id="{{$name}}-O{{$oldStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{$oldStart}}">{{ $oldStart }}</a></div>
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}"><span aria-hidden="true" class="invisible">{{$oldStart}}</span></div>
-
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
-
<div class="px-2">{{ .Line }}</div>
-
</div>
-
{{- $oldStart = add64 $oldStart 1 -}}
-
{{- end -}}
-
{{- if eq .Op.String " " -}}
-
<div class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 flex min-w-full items-center">
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle1}}" id="{{$name}}-O{{$oldStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-O{{$oldStart}}">{{ $oldStart }}</a></div>
-
<div class="{{$lineNrStyle}} {{$lineNrSepStyle2}}" id="{{$name}}-N{{$newStart}}"><a class="{{$linkStyle}}" href="#{{$name}}-N{{$newStart}}">{{ $newStart }}</a></div>
-
<div class="w-5 flex-shrink-0 select-none text-center">{{ .Op.String }}</div>
-
<div class="px-2">{{ .Line }}</div>
-
</div>
-
{{- $newStart = add64 $newStart 1 -}}
-
{{- $oldStart = add64 $oldStart 1 -}}
-
{{- end -}}
-
{{- end -}}
-
{{- end -}}</div></div></pre>
-
{{- end -}}
-
</div>
-
-
</details>
+
</details>
+
</div>
</div>
-
</div>
-
</section>
-
{{ end }}
+
</section>
+
{{ end }}
{{ end }}
{{ end }}
+11
appview/pages/templates/repo/fragments/interdiffFiles.html
···
+
{{ define "repo/fragments/interdiffFiles" }}
+
{{ $fileTree := fileTree .AffectedFiles }}
+
<section class="mt-4 p-6 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm">
+
<div class="diff-stat">
+
<div class="flex gap-2 items-center">
+
<strong class="text-sm uppercase dark:text-gray-200">files</strong>
+
</div>
+
{{ template "repo/fragments/fileTree" $fileTree }}
+
</div>
+
</section>
+
{{ end }}
-1
appview/pages/templates/repo/pulls/fragments/pullStack.html
···
{{ define "repo/pulls/fragments/pullStack" }}
-
<details class="bg-white dark:bg-gray-800 group" open>
<summary class="p-2 text-sm font-bold list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400">
<span class="flex items-center gap-2">
+48 -3
appview/pages/templates/repo/pulls/interdiff.html
···
</header>
</section>
-
<section>
-
{{ template "repo/fragments/interdiff" (list .RepoInfo.FullName .Interdiff) }}
-
</section>
{{ end }}
+
{{ define "topbarLayout" }}
+
<div class="px-1 grid grid-cols-1">
+
<header style="z-index: 20" class="col-span-1">
+
{{ block "topbar" . }}
+
{{ template "layouts/topbar" . }}
+
{{ end }}
+
</header>
+
</div>
+
{{ end }}
+
+
{{ define "contentLayout" }}
+
<div class="grid grid-cols-1 md:grid-cols-1 gap-2">
+
<main class="px-1 col-span-1">
+
{{ block "content" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "contentAfterLayout" . }}
+
<div class="grid grid-cols-1 md:grid-cols-12 gap-2">
+
<div class="col-span-1 md:col-span-2">
+
{{ block "contentAfterLeft" . }} {{ end }}
+
</div>
+
<main class="px-1 col-span-1 md:col-span-10">
+
{{ block "contentAfter" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "footerLayout" . }}
+
<div class="px-1 grid grid-cols-1">
+
<footer class="mt-16 col-span-1">
+
{{ block "footer" . }}
+
{{ template "layouts/footer" . }}
+
{{ end }}
+
</footer>
+
</div>
+
{{ end }}
+
+
{{ define "contentAfter" }}
+
{{ template "repo/fragments/interdiff" (list .RepoInfo.FullName .Interdiff .DiffOpts) }}
+
{{end}}
+
+
{{ define "contentAfterLeft" }}
+
<div class="sticky top-0">
+
{{ template "repo/fragments/interdiffFiles" .Interdiff }}
+
</div>
+
{{end}}
+49 -1
appview/pages/templates/repo/pulls/patch.html
···
<div class="border-t border-gray-200 dark:border-gray-700 my-2"></div>
{{ template "repo/pulls/fragments/pullHeader" . }}
</section>
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
</section>
{{ end }}
+
+
{{ define "topbarLayout" }}
+
<div class="px-1 grid grid-cols-1">
+
<header style="z-index: 20" class="col-span-1">
+
{{ block "topbar" . }}
+
{{ template "layouts/topbar" . }}
+
{{ end }}
+
</header>
+
</div>
+
{{ end }}
+
+
{{ define "contentLayout" }}
+
<div class="grid grid-cols-1 md:grid-cols-1 gap-2">
+
<main class="px-1 col-span-1">
+
{{ block "content" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "contentAfterLayout" . }}
+
<div class="grid grid-cols-1 md:grid-cols-12 gap-2">
+
<div class="col-span-1 md:col-span-2">
+
{{ block "contentAfterLeft" . }} {{ end }}
+
</div>
+
<main class="px-1 col-span-1 md:col-span-10">
+
{{ block "contentAfter" . }}{{ end }}
+
</main>
+
</div>
+
{{ end }}
+
+
{{ block "footerLayout" . }}
+
<div class="px-1 grid grid-cols-1">
+
<footer class="mt-16 col-span-1">
+
{{ block "footer" . }}
+
{{ template "layouts/footer" . }}
+
{{ end }}
+
</footer>
+
</div>
+
{{ end }}
+
+
{{ define "contentAfter" }}
+
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
+
{{end}}
+
+
{{ define "contentAfterLeft" }}
+
<div class="sticky top-0">
+
{{ template "repo/fragments/diffChangedFiles" .Diff }}
+
</div>
+
{{end}}