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