@@ -11,7 +11,7 @@ proc renderStat(num, class: string; text=""): VNode =
11
11
span (class= " profile-stat-num" ):
12
12
text if num.len == 0 : " ?" else : insertSep (num, ',' )
13
13
14
- proc renderProfileCard * (profile: Profile ; prefs: Prefs ): VNode =
14
+ proc renderProfileCard * (profile: Profile ; prefs: Prefs , path: string ): VNode =
15
15
buildHtml (tdiv (class= " profile-card" )):
16
16
tdiv (class= " profile-card-info" ):
17
17
let url = getPicUrl (profile.getUserPic ())
@@ -21,9 +21,15 @@ proc renderProfileCard*(profile: Profile; prefs: Prefs): VNode =
21
21
a (class= " profile-card-avatar" , href= url, target= " _blank" ):
22
22
genImg (profile.getUserpic (size))
23
23
24
- tdiv (class= " profile-card-tabs-name" ):
25
- linkUser (profile, class= " profile-card-fullname" )
26
- linkUser (profile, class= " profile-card-username" )
24
+ tdiv (class= " profile-card-tabs-name-and-follow" ):
25
+ tdiv ():
26
+ linkUser (profile, class= " profile-card-fullname" )
27
+ linkUser (profile, class= " profile-card-username" )
28
+ let following = isFollowing (profile.username, prefs.following)
29
+ if not following:
30
+ buttonReferer " /follow/" & profile.username, " Follow" , path, " profile-card-follow-button"
31
+ else :
32
+ buttonReferer " /unfollow/" & profile.username, " Unfollow" , path, " profile-card-follow-button"
27
33
28
34
tdiv (class= " profile-card-extra" ):
29
35
if profile.bio.len > 0 :
@@ -104,7 +110,7 @@ proc renderProfile*(profile: Profile; timeline: var Timeline;
104
110
105
111
let sticky = if prefs.stickyProfile: " sticky" else : " unset"
106
112
tdiv (class= " profile-tab" , style= {position: sticky}):
107
- renderProfileCard (profile, prefs)
113
+ renderProfileCard (profile, prefs, path )
108
114
if photoRail.len > 0 :
109
115
renderPhotoRail (profile, photoRail)
110
116
0 commit comments