forked from tangled.org/core
Monorepo for Tangled

styles for round-based reviews

Changed files
+74 -24
appview
pages
templates
repo
state
+69 -23
appview/pages/templates/repo/pulls/pull.html
··· 42 42 <span class="select-none before:content-['\00B7']"></span> 43 43 <time>{{ .Pull.Created | timeFmt }}</time> 44 44 <span class="select-none before:content-['\00B7']"></span> 45 - <time>targeting branch {{ .Pull.TargetBranch }}</time> 45 + <span>targeting branch 46 + <span class="text-xs rounded bg-gray-100 text-black font-mono px-2 mx-1/2 inline-flex items-center"> 47 + {{ .Pull.TargetBranch }} 48 + </span> 49 + </span> 46 50 </span> 47 51 </div> 48 52 ··· 56 60 {{ end }} 57 61 58 62 {{ define "repoAfter" }} 59 - <section id="submissions"> 60 - {{ block "submissions" . }} {{ end }} 63 + <section id="submissions" class="mt-4"> 64 + <div class="flex flex-col gap-4"> 65 + {{ block "submissions" . }} {{ end }} 66 + </div> 61 67 </section> 62 68 63 69 {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} ··· 107 113 {{ $lastIdx := sub (len .Pull.Submissions) 1 }} 108 114 {{ range $idx, $item := .Pull.Submissions }} 109 115 {{ with $item }} 116 + {{ $oneIndexedRound := add .RoundNumber 1 }} 110 117 <details {{ if eq $idx $lastIdx }}open{{ end }}> 111 - <summary>round #{{ .RoundNumber }}, {{ .Created | timeFmt }}, received {{ len .Comments }} comments</summary> 112 - <div> 113 - <h2>patch submitted by {{index $.DidHandleMap $.Pull.OwnerDid}}</h2> 114 - <pre><code>{{- .Patch -}}</code></pre> 118 + <summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer text-sm"> 119 + <div class="flex gap-2 items-center"> 120 + <div class="rounded bg-white drop-shadow-sm p-3"> 121 + #{{ $oneIndexedRound }} 122 + </div> 123 + <div class="rounded drop-shadow-sm bg-white p-3 text-gray-500"> 124 + <span> 125 + {{ $owner := index $.DidHandleMap $.Pull.OwnerDid }} 126 + submitted by <a href="/{{ $owner }}">{{ $owner }}</a> 127 + <span class="before:content-['·']"></span> 128 + <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ $.Pull.PullId }}/patch">view patch</a> 129 + <span class="select-none before:content-['\00B7']"></span> 130 + <time>{{ .Created | timeFmt }}</time> 131 + <span class="select-none before:content-['·']"></span> 132 + {{ $s := "s" }} 133 + {{ if eq (len .Comments) 1 }} 134 + {{ $s = "" }} 135 + {{ end }} 136 + {{ len .Comments }} comment{{$s}} 137 + </span> 138 + </div> 139 + </div> 140 + </summary> 141 + <div class="pl-12 flex flex-col gap-2 mt-2 relative"> 142 + <!--div class="bg-white rounded drop-shadow-sm p-4"> 143 + <pre class="overflow-auto"><code>{{- .Patch -}}</code></pre> 144 + </div--> 115 145 116 146 {{ range .Comments }} 117 - <div id="comment-{{.ID}}"> 118 - {{ index $.DidHandleMap .OwnerDid }} commented {{ .Created | timeFmt }}: {{ .Body }} 147 + <div id="comment-{{.ID}}" class="bg-white rounded drop-shadow-sm py-2 px-4 relative w-fit"> 148 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 149 + <div class="text-sm text-gray-500"> 150 + {{ $owner := index $.DidHandleMap .OwnerDid }} 151 + <a href="/{{$owner}}">{{$owner}}</a> 152 + <span class="before:content-['·']"></span> 153 + <time>{{ .Created | timeFmt }}</time> 154 + </div> 155 + <div class="prose"> 156 + {{ .Body }} 157 + </div> 119 158 </div> 120 159 {{ end }} 121 160 {{ block "newComment" (list $ .ID) }} {{ end }} 122 161 </div> 123 162 </details> 163 + <hr /> 124 164 {{ end }} 125 165 {{ end }} 126 166 {{ end }} ··· 131 171 132 172 {{ with $rootObj }} 133 173 {{ if .LoggedInUser }} 134 - <form 135 - hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/comment" 136 - class="mt-8" 137 - hx-swap="none"> 174 + <div class="bg-white rounded drop-shadow-sm py-2 px-4 relative w-full md:w-96"> 175 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 176 + <div class="text-sm text-gray-500"> 177 + {{ index .DidHandleMap .LoggedInUser.Did }} 178 + </div> 179 + <form 180 + hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/comment" 181 + hx-swap="none"> 138 182 <input type="hidden" name="submissionId" value="{{ $submissionId }}"> 139 183 <textarea 140 184 name="body" 141 - class="w-full p-2 rounded border border-gray-200" 142 - placeholder="Add to the discussion..." 143 - ></textarea> 144 - <button type="submit" class="btn mt-2">comment</button> 185 + class="w-full border-0 h-8 focus:outline-none focus:ring-0 px-0 py-1" 186 + placeholder="Add to the discussion..." /></textarea> 187 + <div class="flex justify-end"> 188 + <button type="submit" class="btn text-sm mt-2">comment</button> 189 + </div> 145 190 <div id="pull-comment"></div> 146 - </form> 147 - {{ else }} 148 - <div class="bg-white rounded drop-shadow-sm px-6 py-4 mt-8"> 149 - <a href="/login" class="underline">login</a> to join the discussion 191 + </form> 192 + {{ else }} 193 + <div class="bg-white rounded drop-shadow-sm px-6 py-4 mt-8"> 194 + <a href="/login" class="underline">login</a> to join the discussion 195 + </div> 150 196 </div> 151 197 {{ end }} 152 198 {{ end }} ··· 231 277 pull request can be merged safely. 232 278 </div> 233 279 234 - <div class="mt-4 flex items-center gap-2"> 280 + <div class="flex items-center gap-2"> 235 281 {{ if $isPushAllowed }} 236 282 <button 237 - class="btn flex items-center gap-2" 283 + class="btn mt-4 flex items-center gap-2" 238 284 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/merge" 239 285 hx-swap="none" 240 286 {{ if or .Pull.State.IsClosed .MergeCheck.IsConflicted }}
+4 -1
appview/pages/templates/repo/pulls/pulls.html
··· 76 76 </span> 77 77 78 78 <span class="before:content-['·']"> 79 - targeting branch <code>{{ .TargetBranch }}</code> 79 + targeting branch 80 + <span class="text-xs rounded bg-gray-100 text-black font-mono px-2 mx-1/2 inline-flex items-center"> 81 + {{ .TargetBranch }} 82 + </span> 80 83 </span> 81 84 </p> 82 85 </div>
+1
appview/state/router.go
··· 66 66 r.Route("/{pull}", func(r chi.Router) { 67 67 r.Use(ResolvePull(s)) 68 68 r.Get("/", s.RepoSinglePull) 69 + r.Get("/patch", s.RepoSinglePull) 69 70 70 71 // authorized requests below this point 71 72 r.Group(func(r chi.Router) {