Monorepo for Tangled tangled.org

fix nav styles

Changed files
+41 -86
appview
pages
templates
layouts
+13 -1
appview/pages/pages.go
··· 38 38 return did 39 39 } 40 40 }, 41 + "assoc": func(values ...string) ([][]string, error) { 42 + if len(values)%2 != 0 { 43 + return nil, fmt.Errorf("invalid assoc call, must have an even number of arguments") 44 + } 45 + pairs := make([][]string, 0) 46 + for i := 0; i < len(values); i += 2 { 47 + pairs = append(pairs, []string{values[i], values[i+1]}) 48 + } 49 + return pairs, nil 50 + }, 41 51 } 42 52 } 43 53 ··· 186 196 } 187 197 188 198 func (p *Pages) RepoIndexPage(w io.Writer, params RepoIndexParams) error { 189 - params.Active = "index" 199 + params.Active = "overview" 190 200 return p.executeRepo("repo/index", w, params) 191 201 } 192 202 ··· 254 264 LoggedInUser *auth.User 255 265 RepoInfo RepoInfo 256 266 Collaborators [][]string 267 + Active string 257 268 IsCollaboratorInviteAllowed bool 258 269 } 259 270 260 271 func (p *Pages) RepoSettings(w io.Writer, params RepoSettingsParams) error { 272 + params.Active = "settings" 261 273 return p.executeRepo("repo/settings", w, params) 262 274 } 263 275
+27 -84
appview/pages/templates/layouts/repobase.html
··· 11 11 {{ end }} 12 12 </section> 13 13 <section id="repo-links" class="min-h-screen flex flex-col"> 14 - <nav class="w-full max-w-3xl mx-auto"> 15 - <div class="relative"> 16 - <div class="flex relative"> 17 - <a 18 - href="/{{ .RepoInfo.FullName }}" 19 - class="relative -mr-px group no-underline" 20 - hx-boost="true" 21 - > 22 - <div 23 - class="px-4 py-2 bg-white text-black min-w-[80px] text-center text-sm relative z-60 group-hover:bg-gray-50 24 - {{ if eq .Active "index" }} 25 - border-b-white border-b-0 border-gray-300 26 - border-l border-r border-t 27 - {{ else }} 28 - border-gray-300 border translate-y-[2px] 29 - {{ end }}" 30 - > 31 - overview 32 - </div> 33 - </a> 34 - 35 - <a 36 - href="/{{ .RepoInfo.FullName }}/issues" 37 - class="relative -mr-px group no-underline" 38 - hx-boost="true" 39 - > 40 - <div 41 - class="px-4 py-2 bg-white text-black min-w-[80px] text-center text-sm relative z-50 group-hover:bg-gray-50 42 - {{ if eq .Active "issues" }} 43 - border-gray-500 border border-b-0 bg-white 44 - {{ else }} 45 - border-gray-300 border translate-y-[2px] 46 - {{ end }} 47 - " 48 - > 49 - issues 50 - </div> 51 - </a> 52 - 53 - <a 54 - href="#" 55 - class="relative -mr-px group no-underline" 56 - hx-boost="true" 57 - > 58 - <div 59 - class="px-4 py-2 bg-white text-black min-w-[80px] text-center text-sm relative z-40 group-hover:bg-gray-50 60 - {{ if eq .Active "pulls" }} 61 - border-gray-500 border border-b-0 bg-white 62 - {{ else }} 63 - border-gray-300 border translate-y-[2px] 64 - {{ end }} 65 - " 66 - > 67 - pull requests 68 - </div> 69 - </a> 70 - 71 - {{ if .RepoInfo.SettingsAllowed }} 72 - <a 73 - href="/{{ .RepoInfo.FullName }}/settings" 74 - class="relative -mr-px group no-underline" 75 - hx-boost="true" 76 - > 77 - <div 78 - class="px-6 py-2 bg-white text-black min-w-[80px] text-center text-sm relative z-40 group-hover:bg-gray-50 79 - {{ if .Active }} 80 - border-gray-500 border border-b-0 bg-white 81 - {{ else }} 82 - border-gray-300 border translate-y-[2px] 83 - {{ end }} 84 - " 85 - > 86 - settings 87 - </div> 88 - </a> 89 - {{ end }} 90 - </div> 91 - </div> 92 - </nav> 93 - <section 94 - class="bg-white p-6 min-h-[200px] border border-gray-300 relative z-20 w-full max-w-3xl mx-auto" 95 - > 96 - {{ block "repoContent" . }}{{ end }} 97 - </section> 14 + <nav class="w-full mx-auto"> 15 + <div class="flex z-60 border-black border-b"> 16 + {{ $activeTabStyles := "border-black border-l border-r border-t border-b-0 -mb-px bg-white" }} 17 + {{ $tabs := assoc "overview" "/" "issues" "/issues" "pulls" "/pulls" "settings" "/settings" }} 18 + {{ range $item := $tabs }} 19 + {{ $key := index $item 0 }} 20 + {{ $value := index $item 1 }} 21 + <a 22 + href="/{{ $.RepoInfo.FullName }}{{ $value }}" 23 + class="relative -mr-px group no-underline" 24 + hx-boost="true" 25 + > 26 + <div 27 + class="px-4 py-2 mr-1 text-black min-w-[80px] text-center text-sm relative group-hover:bg-gray-50 28 + {{ if eq $.Active $key }}{{ $activeTabStyles }}{{ end }}" 29 + > 30 + {{ $key }} 31 + </div> 32 + </a> 33 + {{ end}} 34 + </div> 35 + </nav> 36 + <section 37 + class="bg-white p-6 min-h-[200px] border-l border-r border-b border-black relative z-20 w-full mx-auto" 38 + > 39 + {{ block "repoContent" . }}{{ end }} 40 + </section> 98 41 </section> 99 42 {{ end }} 100 43
+1 -1
flake.nix
··· 97 97 pkgs.writeShellScriptBin "run" 98 98 '' 99 99 ${pkgs.air}/bin/air -c /dev/null \ 100 - -build.cmd "cp -f ${htmx-src} appview/pages/static/htmx.min.js && ${pkgs.tailwindcss}/bin/tailwindcss -i input.css -o ./appview/pages/static/tw.css && ${pkgs.go}/bin/go build -o ./out/${name}.out ./cmd/${name}/main.go" \ 100 + -build.cmd "cp -rf ${htmx-src} appview/pages/static/htmx.min.js && ${pkgs.tailwindcss}/bin/tailwindcss -i input.css -o ./appview/pages/static/tw.css && ${pkgs.go}/bin/go build -o ./out/${name}.out ./cmd/${name}/main.go" \ 101 101 -build.bin "./out/${name}.out" \ 102 102 -build.include_ext "go,html,css" 103 103 '';