A vibe coded tangled fork which supports pijul.
at c1c15026535c46e1f9d2d2abb86fbc0750efc9f6 125 lines 5.1 kB view raw
1{{ define "layouts/fragments/topbar" }} 2 <nav class="mx-auto space-x-4 px-6 py-2 dark:text-white drop-shadow-sm bg-white dark:bg-gray-800"> 3 <div class="flex justify-between p-0 items-center"> 4 <div id="left-items"> 5 <a href="/" hx-boost="true" class="text-2xl no-underline hover:no-underline flex items-center gap-2"> 6 {{ template "fragments/logotypeSmall" }} 7 </a> 8 </div> 9 10 <div id="right-items" class="flex items-center gap-4"> 11 {{ with .LoggedInUser }} 12 {{ block "newButton" . }} {{ end }} 13 {{ template "notifications/fragments/bell" }} 14 {{ block "profileDropdown" . }} {{ end }} 15 {{ else }} 16 <a href="/login">login</a> 17 <span class="text-gray-500 dark:text-gray-400">or</span> 18 <a href="/signup" class="btn-create py-0 hover:no-underline hover:text-white flex items-center gap-2"> 19 join now {{ i "arrow-right" "size-4" }} 20 </a> 21 {{ end }} 22 </div> 23 </div> 24 </nav> 25{{ end }} 26 27{{ define "newButton" }} 28<details class="relative inline-block text-left nav-dropdown"> 29 <summary class="btn-create py-0 cursor-pointer list-none flex items-center gap-2"> 30 {{ i "plus" "w-4 h-4" }} <span class="hidden md:inline">new</span> 31 </summary> 32 <div class="absolute flex flex-col right-0 mt-3 p-4 rounded w-48 bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700"> 33 <a href="/repo/new" class="flex items-center gap-2"> 34 {{ i "book-plus" "w-4 h-4" }} 35 new repository 36 </a> 37 <a href="/strings/new" class="flex items-center gap-2"> 38 {{ i "line-squiggle" "w-4 h-4" }} 39 new string 40 </a> 41 </div> 42</details> 43{{ end }} 44 45{{ define "profileDropdown" }} 46<details class="relative inline-block text-left nav-dropdown"> 47 <summary class="cursor-pointer list-none flex items-center gap-1"> 48 {{ $user := .Active.Did }} 49 <img 50 src="{{ tinyAvatar $user }}" 51 alt="" 52 class="rounded-full h-6 w-6 border border-gray-300 dark:border-gray-700" 53 /> 54 <span class="hidden md:inline">{{ $user | resolve | truncateAt30 }}</span> 55 </summary> 56 <div class="absolute right-0 mt-4 rounded bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700 shadow-lg z-50 text-sm" style="width: 14rem;"> 57 {{ $active := .Active.Did }} 58 {{ $linkStyle := "flex items-center gap-3 px-4 py-2 hover:no-underline hover:bg-gray-50 hover:dark:bg-gray-700/50" }} 59 60 {{ $others := .Accounts | otherAccounts $active }} 61 {{ if $others }} 62 <div class="text-sm text-gray-500 dark:text-gray-400 px-3 py-1 pt-2">switch account</div> 63 {{ range $others }} 64 <button 65 type="button" 66 hx-post="/account/switch" 67 hx-vals='{"did": "{{ .Did }}"}' 68 hx-swap="none" 69 class="{{$linkStyle}} w-full text-left pl-3" 70 > 71 <img src="{{ tinyAvatar .Did }}" alt="" class="rounded-full size-6 flex-shrink-0 border border-gray-300 dark:border-gray-700" /> 72 <span class="truncate flex-1">{{ .Did | resolve }}</span> 73 </button> 74 {{ end }} 75 {{ end }} 76 77 <a href="/login?mode=add_account" class="{{$linkStyle}} pl-3"> 78 <div class="size-6 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center"> 79 {{ i "plus" "size-3" }} 80 </div> 81 82 <div class="text-left flex-1 min-w-0 block truncate"> 83 add account 84 </div> 85 </a> 86 87 <div class="border-t border-gray-200 dark:border-gray-700"> 88 <a href="/{{ $active }}" class="{{$linkStyle}}"> 89 {{ i "user" "size-4" }} 90 profile 91 </a> 92 <a href="/{{ $active }}?tab=repos" class="{{$linkStyle}}"> 93 {{ i "book-marked" "size-4" }} 94 repositories 95 </a> 96 <a href="/{{ $active }}?tab=strings" class="{{$linkStyle}}"> 97 {{ i "line-squiggle" "size-4" }} 98 strings 99 </a> 100 <a href="/settings" class="{{$linkStyle}}"> 101 {{ i "cog" "size-4" }} 102 settings 103 </a> 104 <a href="#" 105 hx-post="/logout" 106 hx-swap="none" 107 class="{{$linkStyle}} text-red-400 hover:text-red-400 hover:bg-red-100 dark:hover:bg-red-700/20 pb-2"> 108 {{ i "log-out" "size-4" }} 109 logout 110 </a> 111 </div> 112 </div> 113</details> 114 115<script> 116document.addEventListener('click', function(event) { 117 const dropdowns = document.querySelectorAll('.nav-dropdown'); 118 dropdowns.forEach(function(dropdown) { 119 if (!dropdown.contains(event.target)) { 120 dropdown.removeAttribute('open'); 121 } 122 }); 123}); 124</script> 125{{ end }}