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