this repo has no description
1{{ define "user/fragments/profileCard" }}
2 {{ $userIdent := didOrHandle .UserDid .UserHandle }}
3 <div class="grid grid-cols-3 md:grid-cols-1 gap-1 items-center">
4 <div id="avatar" class="col-span-1 flex justify-center items-center">
5 <div class="w-3/4 aspect-square relative">
6 <img class="absolute inset-0 w-full h-full object-cover rounded-full p-2" src="{{ fullAvatar .UserDid }}" />
7 </div>
8 </div>
9 <div class="col-span-2">
10 <div class="flex items-center flex-row flex-nowrap gap-2">
11 <p title="{{ $userIdent }}"
12 class="text-lg font-bold dark:text-white overflow-hidden text-ellipsis whitespace-nowrap">
13 {{ $userIdent }}
14 </p>
15 <a href="/{{ $userIdent }}/feed.atom">{{ i "rss" "size-4" }}</a>
16 </div>
17
18 <div class="md:hidden">
19 {{ block "followerFollowing" (list . $userIdent) }} {{ end }}
20 </div>
21 </div>
22 <div class="col-span-3 md:col-span-full">
23 <div id="profile-bio" class="text-sm">
24 {{ $profile := .Profile }}
25 {{ with .Profile }}
26
27 {{ if .Description }}
28 <p class="text-base pb-4 md:pb-2">{{ .Description }}</p>
29 {{ end }}
30
31 <div class="hidden md:block">
32 {{ block "followerFollowing" (list $ $userIdent) }} {{ end }}
33 </div>
34
35 <div class="flex flex-col gap-2 mb-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full">
36 {{ if .Location }}
37 <div class="flex items-center gap-2">
38 <span class="flex-shrink-0">{{ i "map-pin" "size-4" }}</span>
39 <span>{{ .Location }}</span>
40 </div>
41 {{ end }}
42 {{ if .IncludeBluesky }}
43 <div class="flex items-center gap-2">
44 <span class="flex-shrink-0">{{ template "user/fragments/bluesky" "w-4 h-4 text-black dark:text-white" }}</span>
45 <a id="bluesky-link" href="https://bsky.app/profile/{{ $.UserDid }}">{{ $userIdent }}</a>
46 </div>
47 {{ end }}
48 {{ range $link := .Links }}
49 {{ if $link }}
50 <div class="flex items-center gap-2">
51 <span class="flex-shrink-0">{{ i "link" "size-4" }}</span>
52 <a href="{{ $link }}">{{ $link }}</a>
53 </div>
54 {{ end }}
55 {{ end }}
56 {{ if not $profile.IsStatsEmpty }}
57 <div class="flex items-center justify-evenly gap-2 py-2">
58 {{ range $stat := .Stats }}
59 {{ if $stat.Kind }}
60 <div class="flex flex-col items-center gap-2">
61 <span class="text-xl font-bold">{{ $stat.Value }}</span>
62 <span>{{ $stat.Kind.String }}</span>
63 </div>
64 {{ end }}
65 {{ end }}
66 </div>
67 {{ end }}
68 </div>
69 {{ end }}
70 {{ if ne .FollowStatus.String "IsSelf" }}
71 {{ template "user/fragments/follow" . }}
72 {{ else }}
73 <button id="editBtn"
74 class="btn mt-2 w-full flex items-center gap-2 group"
75 hx-target="#profile-bio"
76 hx-get="/profile/edit-bio"
77 hx-swap="innerHTML">
78 {{ i "pencil" "w-4 h-4" }}
79 edit
80 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }}
81 </button>
82 {{ end }}
83 </div>
84 <div id="update-profile" class="text-red-400 dark:text-red-500"></div>
85 </div>
86 </div>
87{{ end }}
88
89{{ define "followerFollowing" }}
90 {{ $root := index . 0 }}
91 {{ $userIdent := index . 1 }}
92 {{ with $root }}
93 <div class="flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full text-sm">
94 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span>
95 <span id="followers"><a href="/{{ $userIdent }}?tab=followers">{{ .Stats.FollowersCount }} followers</a></span>
96 <span class="select-none after:content-['·']"></span>
97 <span id="following"><a href="/{{ $userIdent }}?tab=following">{{ .Stats.FollowingCount }} following</a></span>
98 </div>
99 {{ end }}
100{{ end }}
101