This repository has no description
1{{ define "user/fragments/picLink" }}
2 {{ $did := index . 0 }}
3 {{ $classes := index . 1 }}
4 {{ $handle := resolve $did }}
5 {{ $vr := false }}
6 {{ if ge (len .) 3 }}
7 {{ $vr = index . 2 }}
8 {{ end }}
9 <div class="relative inline-block"
10 onmouseenter="(function(el){
11 clearTimeout(el._pht);
12 el._pht = setTimeout(function(){
13 var r=el.getBoundingClientRect(),p=el.querySelector('[data-profile-popover]');
14 if(p){p.style.top=r.bottom+'px';p.style.left=r.left+'px';p.classList.remove('hidden');}
15 }, 500);
16 })(this)"
17 onmouseleave="(function(el){
18 clearTimeout(el._pht);
19 var p=el.querySelector('[data-profile-popover]');
20 if(!p)return;
21 var modal=document.getElementById('vouch-modal-'+p.dataset.vouchModalId);
22 if(modal&&modal.matches(':popover-open'))return;
23 p.classList.add('hidden');
24 })(this)">
25 <a href="/{{ $handle }}" title="{{ $handle }}"
26 hx-get="/profile/popover?did={{ $did }}"
27 hx-trigger="mouseenter once"
28 hx-target="next [data-profile-popover-content]"
29 hx-swap="innerHTML">
30 <img
31 src="{{ tinyAvatar $did }}"
32 alt=""
33 class="rounded-full border border-gray-300 dark:border-gray-700 {{ $classes }}"
34 />
35 </a>
36 {{ if $vr }}
37 {{ if ne $did $vr.ViewerDid }}
38 <button
39 type="button"
40 popovertarget="vouch-modal-{{ normalizeForHtmlId $vr.SubjectDid.String }}"
41 popovertargetaction="toggle"
42 class="absolute -bottom-0.5 -right-0.5 w-1/2 h-1/2 cursor-pointer"
43 title="{{ template "user/fragments/vouchTooltip" $vr }}">
44 {{ if $vr.IsDirectVouch }}
45 {{ template "fragments/icons/shield-direct-vouch" "w-full h-full" }}
46 {{ else if $vr.IsDirectDenounce }}
47 {{ template "fragments/icons/shield-direct-denounce" "w-full h-full" }}
48 {{ else if $vr.IsMixed }}
49 {{ template "fragments/icons/shield-mixed" "w-full h-full" }}
50 {{ else if $vr.IsIndirectVouch }}
51 {{ template "fragments/icons/shield-indirect-vouch" "w-full h-full text-white dark:text-gray-900" }}
52 {{ else if $vr.IsIndirectDenounce }}
53 {{ template "fragments/icons/shield-indirect-denounce" "w-full h-full text-white dark:text-gray-900" }}
54 {{ end }}
55 </button>
56 {{ end }}
57 {{ end }}
58 <div data-profile-popover
59 data-vouch-modal-id="{{ normalizeForHtmlId $did }}"
60 class="hidden z-[9999] pt-1 w-80"
61 style="position:fixed;">
62 <div data-profile-popover-content
63 class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded shadow-sm p-3">
64 <div class="flex items-center justify-center py-4">
65 {{ i "loader-circle" "w-5 h-5 animate-spin text-gray-400" }}
66 </div>
67 </div>
68 </div>
69 </div>
70 {{ if $vr }}
71 {{ if ne $did $vr.ViewerDid }}
72 {{ template "user/fragments/vouchPopover" (dict "VouchRelationship" $vr) }}
73 {{ end }}
74 {{ end }}
75{{ end }}