appview/pages: make user references clickable #939

open
opened by moshyfawn.dev targeting master from moshyfawn.dev/core: feat/clickable-user-refs

Wrap participant avatars with profile links. Make DID-type labels fully clickable chips linking to user profiles, matching the commit hash chip pattern

Signed-off-by: moshyfawn email@moshyfawn.dev

Changed files
+37 -22
appview
pages
templates
fragments
labels
fragments
+7 -5
appview/pages/templates/fragments/tinyAvatarList.html
··· 5 5 <div class="inline-flex items-center -space-x-3"> 6 6 {{ $c := "z-50 z-40 z-30 z-20 z-10" }} 7 7 {{ range $i, $p := $ps }} 8 - <img 9 - src="{{ tinyAvatar . }}" 10 - alt="" 11 - class="rounded-full size-8 mr-1 border-2 border-gray-100 dark:border-gray-900 z-{{sub 5 $i}}0 {{ $classes }}" 12 - /> 8 + <a href="/{{ resolve . }}" title="{{ resolve . }}"> 9 + <img 10 + src="{{ tinyAvatar . }}" 11 + alt="" 12 + class="rounded-full size-8 mr-1 border-2 border-gray-100 dark:border-gray-900 z-{{sub 5 $i}}0 {{ $classes }}" 13 + /> 14 + </a> 13 15 {{ end }} 14 16 15 17 {{ if gt (len $all) 5 }}
+30 -17
appview/pages/templates/labels/fragments/label.html
··· 2 2 {{ $d := .def }} 3 3 {{ $v := .val }} 4 4 {{ $withPrefix := .withPrefix }} 5 - <span class="w-fit flex items-center gap-2 font-normal normal-case rounded py-1 px-2 border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-sm"> 6 - {{ template "repo/fragments/colorBall" (dict "color" $d.GetColor) }} 7 5 8 - {{ $lhs := printf "%s" $d.Name }} 9 - {{ $rhs := "" }} 6 + {{ $lhs := printf "%s" $d.Name }} 7 + {{ $rhs := "" }} 8 + {{ $isDid := false }} 9 + {{ $resolvedVal := "" }} 10 10 11 - {{ if not $d.ValueType.IsNull }} 12 - {{ if $d.ValueType.IsDidFormat }} 13 - {{ $v = resolve $v }} 14 - {{ end }} 15 - 16 - {{ if not $withPrefix }} 17 - {{ $lhs = "" }} 18 - {{ else }} 19 - {{ $lhs = printf "%s/" $d.Name }} 20 - {{ end }} 11 + {{ if not $d.ValueType.IsNull }} 12 + {{ $isDid = $d.ValueType.IsDidFormat }} 13 + {{ if $isDid }} 14 + {{ $resolvedVal = resolve $v }} 15 + {{ $v = $resolvedVal }} 16 + {{ end }} 21 17 22 - {{ $rhs = printf "%s" $v }} 18 + {{ if not $withPrefix }} 19 + {{ $lhs = "" }} 20 + {{ else }} 21 + {{ $lhs = printf "%s/" $d.Name }} 23 22 {{ end }} 24 23 25 - {{ printf "%s%s" $lhs $rhs }} 26 - </span> 24 + {{ $rhs = printf "%s" $v }} 25 + {{ end }} 26 + 27 + {{ $chipClasses := "w-fit flex items-center gap-2 font-normal normal-case rounded py-1 px-2 border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-sm" }} 28 + 29 + {{ if $isDid }} 30 + <a href="/{{ $resolvedVal }}" class="{{ $chipClasses }} no-underline hover:underline"> 31 + {{ template "repo/fragments/colorBall" (dict "color" $d.GetColor) }} 32 + {{ printf "%s%s" $lhs $rhs }} 33 + </a> 34 + {{ else }} 35 + <span class="{{ $chipClasses }}"> 36 + {{ template "repo/fragments/colorBall" (dict "color" $d.GetColor) }} 37 + {{ printf "%s%s" $lhs $rhs }} 38 + </span> 39 + {{ end }} 27 40 {{ end }} 28 41 29 42