Monorepo for Tangled tangled.org

appview/pages: don't access `MultiAccountUser.Active` from template

We are using `MultiAccountUser.Did()` to get current DID instead.

Signed-off-by: Seongmin Lee <git@boltless.me>

boltless.me 00205b2a 8370707a

verified
+7 -8
+7 -8
appview/pages/templates/layouts/fragments/topbar.html
··· 43 43 {{ end }} 44 44 45 45 {{ define "profileDropdown" }} 46 + {{ $handle := resolve .Did }} 46 47 <details class="relative inline-block text-left nav-dropdown"> 47 48 <summary class="cursor-pointer list-none flex items-center gap-1"> 48 - {{ $user := .Active.Did }} 49 49 <img 50 - src="{{ tinyAvatar $user }}" 50 + src="{{ tinyAvatar .Did }}" 51 51 alt="" 52 52 class="rounded-full h-6 w-6 border border-gray-300 dark:border-gray-700" 53 53 /> 54 - <span class="hidden md:inline">{{ $user | resolve | truncateAt30 }}</span> 54 + <span class="hidden md:inline">{{ $handle | truncateAt30 }}</span> 55 55 </summary> 56 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 57 {{ $linkStyle := "flex items-center gap-3 px-4 py-2 hover:no-underline hover:bg-gray-50 hover:dark:bg-gray-700/50" }} 59 58 60 - {{ $others := .Accounts | otherAccounts $active }} 59 + {{ $others := .Accounts | otherAccounts .Did }} 61 60 {{ if $others }} 62 61 <div class="text-sm text-gray-500 dark:text-gray-400 px-3 py-1 pt-2">switch account</div> 63 62 {{ range $others }} ··· 85 84 </a> 86 85 87 86 <div class="border-t border-gray-200 dark:border-gray-700"> 88 - <a href="/{{ $active }}" class="{{$linkStyle}}"> 87 + <a href="/{{ $handle }}" class="{{$linkStyle}}"> 89 88 {{ i "user" "size-4" }} 90 89 profile 91 90 </a> 92 - <a href="/{{ $active }}?tab=repos" class="{{$linkStyle}}"> 91 + <a href="/{{ $handle }}?tab=repos" class="{{$linkStyle}}"> 93 92 {{ i "book-marked" "size-4" }} 94 93 repositories 95 94 </a> 96 - <a href="/{{ $active }}?tab=strings" class="{{$linkStyle}}"> 95 + <a href="/{{ $handle }}?tab=strings" class="{{$linkStyle}}"> 97 96 {{ i "line-squiggle" "size-4" }} 98 97 strings 99 98 </a>