Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2

appview: repo/index: optimize for mobile

+51 -46
+51 -46
appview/pages/templates/repo/index.html
··· 29 29 30 30 {{ define "repoContent" }} 31 31 <main> 32 - {{ block "branchSelector" . }}{{ end }} 32 + <div class="flex items-center justify-between pb-5"> 33 + {{ block "branchSelector" . }}{{ end }} 34 + <div class="flex md:hidden items-center gap-4"> 35 + <a href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref | urlquery }}" class="inline-flex items-center text-sm gap-1"> 36 + {{ i "git-commit-horizontal" "w-4" "h-4" }} {{ .TotalCommits }} 37 + </a> 38 + <a href="/{{ .RepoInfo.FullName }}/branches" class="inline-flex items-center text-sm gap-1"> 39 + {{ i "git-branch" "w-4" "h-4" }} {{ len .Branches }} 40 + </a> 41 + <a href="/{{ .RepoInfo.FullName }}/tags" class="inline-flex items-center text-sm gap-1"> 42 + {{ i "tags" "w-4" "h-4" }} {{ len .Tags }} 43 + </a> 44 + </div> 45 + </div> 33 46 <div class="grid grid-cols-1 md:grid-cols-2 gap-2"> 34 47 {{ block "fileTree" . }}{{ end }} 35 48 {{ block "rightInfo" . }}{{ end }} ··· 51 38 {{ end }} 52 39 53 40 {{ define "branchSelector" }} 54 - <div class="flex justify-between pb-5"> 55 - <select 56 - onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)" 57 - class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700" 58 - > 59 - <optgroup label="branches ({{len .Branches}})" class="bold text-sm"> 60 - {{ range .Branches }} 61 - <option 62 - value="{{ .Reference.Name }}" 63 - class="py-1" 64 - {{ if eq .Reference.Name $.Ref }} 65 - selected 66 - {{ end }} 67 - > 68 - {{ .Reference.Name }} 69 - </option> 70 - {{ end }} 71 - </optgroup> 72 - <optgroup label="tags ({{len .Tags}})" class="bold text-sm"> 73 - {{ range .Tags }} 74 - <option 75 - value="{{ .Reference.Name }}" 76 - class="py-1" 77 - {{ if eq .Reference.Name $.Ref }} 78 - selected 79 - {{ end }} 80 - > 81 - {{ .Reference.Name }} 82 - </option> 83 - {{ else }} 84 - <option class="py-1" disabled>no tags found</option> 85 - {{ end }} 86 - </optgroup> 87 - </select> 88 - </div> 41 + <select 42 + onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)" 43 + class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700" 44 + > 45 + <optgroup label="branches ({{len .Branches}})" class="bold text-sm"> 46 + {{ range .Branches }} 47 + <option 48 + value="{{ .Reference.Name }}" 49 + class="py-1" 50 + {{ if eq .Reference.Name $.Ref }} 51 + selected 52 + {{ end }} 53 + > 54 + {{ .Reference.Name }} 55 + </option> 56 + {{ end }} 57 + </optgroup> 58 + <optgroup label="tags ({{len .Tags}})" class="bold text-sm"> 59 + {{ range .Tags }} 60 + <option 61 + value="{{ .Reference.Name }}" 62 + class="py-1" 63 + {{ if eq .Reference.Name $.Ref }} 64 + selected 65 + {{ end }} 66 + > 67 + {{ .Reference.Name }} 68 + </option> 69 + {{ else }} 70 + <option class="py-1" disabled>no tags found</option> 71 + {{ end }} 72 + </optgroup> 73 + </select> 89 74 {{ end }} 90 75 91 76 {{ define "fileTree" }} ··· 140 129 {{ end }} 141 130 142 131 {{ define "rightInfo" }} 143 - <div id="right-info" class="col-span-1"> 132 + <div id="right-info" class="hidden md:block col-span-1"> 144 133 {{ block "commitLog" . }} {{ end }} 145 134 {{ block "branchList" . }} {{ end }} 146 135 {{ block "tagList" . }} {{ end }} ··· 154 143 <div class="flex gap-2 items-center"> 155 144 {{ i "git-commit-horizontal" "w-4 h-4" }} commits 156 145 </div> 157 - {{ if lt (len .CommitsTrunc) .TotalCommits }} 158 - <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 "> 159 - view {{ .TotalCommits }} commits {{ i "chevron-right" "w-4 h-4" }} 160 - </span> 161 - {{ end }} 146 + <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 "> 147 + view {{ .TotalCommits }} commits {{ i "chevron-right" "w-4 h-4" }} 148 + </span> 162 149 </a> 163 150 </div> 164 151 <div class="flex flex-col gap-6"> ··· 252 243 <!-- git-branch icon is seemingly bigger than others at 4x4 --> 253 244 {{ i "git-branch" "w-3 h-3" }} branches 254 245 </div> 255 - {{ if lt (len .BranchesTrunc) (len .Branches) }} 256 246 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 "> 257 247 view {{ len .Branches }} branches {{ i "chevron-right" "w-4 h-4" }} 258 248 </span> 259 - {{ end }} 260 249 </a> 261 250 <div class="flex flex-col gap-1"> 262 251 {{ range .BranchesTrunc }} ··· 286 279 <div class="flex gap-2 items-center"> 287 280 {{ i "tags" "w-4 h-4" }} tags 288 281 </div> 289 - {{ if lt (len .TagsTrunc) (len .Tags) }} 290 282 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 "> 291 283 view {{ len .Tags }} tags {{ i "chevron-right" "w-4 h-4" }} 292 284 </span> 293 - {{ end }} 294 285 </a> 295 286 </div> 296 287 <div class="flex flex-col gap-1">