Monorepo for Tangled tangled.org

appview: implement follower and following pages for users #484

merged opened by ptr.pet targeting master from [deleted fork]: followers-following-list
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:dfl62fgb7wtjj3fcbb72naae/sh.tangled.repo.pull/3lwawsuk3de22
+9 -11
Interdiff #8 #9
appview/db/profile.go

This file has not been changed.

appview/db/timeline.go

This file has not been changed.

appview/pages/funcmap.go

This file has not been changed.

appview/pages/pages.go

This file has not been changed.

+2 -2
appview/pages/templates/timeline.html
··· 152 {{ with $stat }} 153 <div class="text-sm flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full"> 154 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span> 155 - <span id="followers"><a href="/{{ $userHandle }}/followers">{{ .Followers }} followers</a></span> 156 <span class="select-none after:content-['·']"></span> 157 - <span id="following"><a href="/{{ $userHandle }}/following">{{ .Following }} following</a></span> 158 </div> 159 {{ end }} 160 </div>
··· 152 {{ with $stat }} 153 <div class="text-sm flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full"> 154 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span> 155 + <span id="followers"><a href="/{{ $subjectHandle }}?tab=followers">{{ .Followers }} followers</a></span> 156 <span class="select-none after:content-['·']"></span> 157 + <span id="following"><a href="/{{ $subjectHandle }}?tab=following">{{ .Following }} following</a></span> 158 </div> 159 {{ end }} 160 </div>
+1 -1
appview/pages/templates/user/followers.html
··· 3 {{ define "extrameta" }} 4 <meta property="og:title" content="{{ or .Card.UserHandle .Card.UserDid }}'s followers" /> 5 <meta property="og:type" content="object" /> 6 - <meta property="og:url" content="https://tangled.sh/{{ or .Card.UserHandle .Card.UserDid }}/followers" /> 7 <meta property="og:description" content="{{ or .Card.Profile.Description .Card.UserHandle .Card.UserDid }}" /> 8 {{ end }} 9
··· 3 {{ define "extrameta" }} 4 <meta property="og:title" content="{{ or .Card.UserHandle .Card.UserDid }}'s followers" /> 5 <meta property="og:type" content="object" /> 6 + <meta property="og:url" content="https://tangled.sh/{{ or .Card.UserHandle .Card.UserDid }}?tab=followers" /> 7 <meta property="og:description" content="{{ or .Card.Profile.Description .Card.UserHandle .Card.UserDid }}" /> 8 {{ end }} 9
+1 -1
appview/pages/templates/user/following.html
··· 3 {{ define "extrameta" }} 4 <meta property="og:title" content="{{ or .Card.UserHandle .Card.UserDid }}'s following" /> 5 <meta property="og:type" content="object" /> 6 - <meta property="og:url" content="https://tangled.sh/{{ or .Card.UserHandle .Card.UserDid }}/following" /> 7 <meta property="og:description" content="{{ or .Card.Profile.Description .Card.UserHandle .Card.UserDid }}" /> 8 {{ end }} 9
··· 3 {{ define "extrameta" }} 4 <meta property="og:title" content="{{ or .Card.UserHandle .Card.UserDid }}'s following" /> 5 <meta property="og:type" content="object" /> 6 + <meta property="og:url" content="https://tangled.sh/{{ or .Card.UserHandle .Card.UserDid }}?tab=following" /> 7 <meta property="og:description" content="{{ or .Card.Profile.Description .Card.UserHandle .Card.UserDid }}" /> 8 {{ end }} 9
appview/pages/templates/user/fragments/follow.html

This file has not been changed.

+2 -2
appview/pages/templates/user/fragments/followCard.html
··· 13 <p class="text-sm pb-2 md:pb-2">{{.Profile.Description}}</p> 14 <div class="text-sm flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full"> 15 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span> 16 - <span id="followers"><a href="/{{ $userIdent }}/followers">{{ .FollowersCount }} followers</a></span> 17 <span class="select-none after:content-['·']"></span> 18 - <span id="following"><a href="/{{ $userIdent }}/following">{{ .FollowingCount }} following</a></span> 19 </div> 20 </div> 21
··· 13 <p class="text-sm pb-2 md:pb-2">{{.Profile.Description}}</p> 14 <div class="text-sm flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full"> 15 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span> 16 + <span id="followers"><a href="/{{ $userIdent }}?tab=followers">{{ .FollowersCount }} followers</a></span> 17 <span class="select-none after:content-['·']"></span> 18 + <span id="following"><a href="/{{ $userIdent }}?tab=following">{{ .FollowingCount }} following</a></span> 19 </div> 20 </div> 21
+2 -2
appview/pages/templates/user/fragments/profileCard.html
··· 94 {{ with $root }} 95 <div class="flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full text-sm"> 96 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span> 97 - <span id="followers"><a href="/{{ $userIdent }}/followers">{{ .FollowersCount }} followers</a></span> 98 <span class="select-none after:content-['·']"></span> 99 - <span id="following"><a href="/{{ $userIdent }}/following">{{ .FollowingCount }} following</a></span> 100 </div> 101 {{ end }} 102 {{ end }}
··· 94 {{ with $root }} 95 <div class="flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full text-sm"> 96 <span class="flex-shrink-0">{{ i "users" "size-4" }}</span> 97 + <span id="followers"><a href="/{{ $userIdent }}?tab=followers">{{ .FollowersCount }} followers</a></span> 98 <span class="select-none after:content-['·']"></span> 99 + <span id="following"><a href="/{{ $userIdent }}?tab=following">{{ .FollowingCount }} following</a></span> 100 </div> 101 {{ end }} 102 {{ end }}
appview/state/profile.go

This file has not been changed.

-2
appview/state/router.go
··· 70 71 r.With(mw.ResolveIdent()).Route("/{user}", func(r chi.Router) { 72 r.Get("/", s.Profile) 73 - r.Get("/followers", s.followersPage) 74 - r.Get("/following", s.followingPage) 75 r.Get("/feed.atom", s.AtomFeedPage) 76 77 r.With(mw.ResolveRepo()).Route("/{repo}", func(r chi.Router) {
··· 70 71 r.With(mw.ResolveIdent()).Route("/{user}", func(r chi.Router) { 72 r.Get("/", s.Profile) 73 r.Get("/feed.atom", s.AtomFeedPage) 74 75 r.With(mw.ResolveRepo()).Route("/{repo}", func(r chi.Router) {
appview/strings/strings.go

This file has not been changed.

+1 -1
appview/pages/templates/user/repos.html
··· 3 {{ define "extrameta" }} 4 <meta property="og:title" content="{{ or .Card.UserHandle .Card.UserDid }}'s repos" /> 5 <meta property="og:type" content="object" /> 6 - <meta property="og:url" content="https://tangled.sh/{{ or .Card.UserHandle .Card.UserDid }}/repos" /> 7 <meta property="og:description" content="{{ or .Card.Profile.Description .Card.UserHandle .Card.UserDid }}" /> 8 {{ end }} 9
··· 3 {{ define "extrameta" }} 4 <meta property="og:title" content="{{ or .Card.UserHandle .Card.UserDid }}'s repos" /> 5 <meta property="og:type" content="object" /> 6 + <meta property="og:url" content="https://tangled.sh/{{ or .Card.UserHandle .Card.UserDid }}?tab=repos" /> 7 <meta property="og:description" content="{{ or .Card.Profile.Description .Card.UserHandle .Card.UserDid }}" /> 8 {{ end }} 9

History

14 rounds 6 comments
sign up or login to add to the discussion
1 commit
expand
cb75b373
appview: implement follower and following pages for users
expand 0 comments
pull request successfully merged
1 commit
expand
98413d89
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
118fb342
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
7a5c931a
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
773aa964
appview: implement follower and following pages for users
expand 1 comment
  • fixed timeline linking to wrong user (forgot to use subjectHandle instead of userHandle)
  • use ?tab= for followers / following like repo page does
  • fix repos opengraph url from /repos to ?tab=repos
1 commit
expand
ece60a35
appview: implement follower and following pages for users
expand 1 comment
  • added following / follower page links to timeline and follow cards
  • also added followers and following to profile tab switch case
1 commit
expand
a8bcde9d
appview: implement follower and following pages for users
expand 1 comment

using resolve in html instead of resolving handles in go code, and dedupped followers/followingPage into followPage

1 commit
expand
a285cd0f
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
3c2d8223
appview: implement follower and following pages for users
expand 1 comment

fixed some issues now that i got my dev setup working again

1 commit
expand
90b0a392
appview: implement follower and following pages for users
expand 1 comment

comments from #1 should be addressed now

on top of that changed GetProfiles to return a map instead of array, which seemed easier to do since it internally uses a map anyway and both places it's used in need it as a map

1 commit
expand
0dfc15e9
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
9643a898
appview: implement follower and following pages for users
expand 0 comments
1 commit
expand
cf9a2ce8
appview: implement follower and following pages for users
expand 1 comment

the pages themselves look pretty good for a start!

  • i'd like to add follower-following count to each item (to make these identical to the profile cards in the timeline)
  • this GetProfile call results in an N+1 query. we have a helper called GetProfiles to help with this, you can get profiles of multiple DIDs in one DB call. db/timeline.go has an example of the same.

overall, i'm loving this stack!

ptr.pet submitted #0
1 commit
expand
cbdbaf6d
appview: implement follower and following pages for users
expand 0 comments