This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / timeline / fragments / timeline.html
6.0 kB 140 lines
1{{ define "timeline/fragments/timeline" }} 2 <div class="py-4"> 3 <h3 class="text-xl font-bold dark:text-white flex items-center gap-4 px-4 pb-4"> 4 {{ i "gallery-vertical" "size-5 flex-shrink-0" }} 5 Timeline 6 </h3> 7 8 <div class="flex flex-col gap-4"> 9 {{ range $i, $g := .Timeline }} 10 <div class="relative"> 11 {{ if ne $i 0 }} 12 <div class="absolute left-8 -top-4 w-px h-4 bg-gray-300 dark:bg-gray-600"></div> 13 {{ end }} 14 {{ $primary := $g.Primary }} 15 <div class="flex flex-col divide-y divide-gray-200 dark:divide-gray-700 border border-gray-200 dark:border-gray-700 rounded-sm"> 16 {{ if $primary.Repo }} 17 {{ template "timeline/fragments/repoEvent" (list $ $g) }} 18 {{ else if $primary.RepoStar }} 19 {{ template "timeline/fragments/starEvent" (list $ $g) }} 20 {{ else if $primary.Follow }} 21 {{ template "timeline/fragments/followEvent" (list $ $g) }} 22 {{ end }} 23 </div> 24 </div> 25 {{ end }} 26 </div> 27 </div> 28{{ end }} 29 30{{ define "timeline/fragments/repoEvent" }} 31 {{ $root := index . 0 }} 32 {{ $group := index . 1 }} 33 {{ $event := $group.Primary }} 34 {{ $repo := $event.Repo }} 35 {{ $source := $event.Source }} 36 {{ $userHandle := resolve $repo.Did }} 37 <div class="pl-6 py-2 bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 flex flex-wrap items-center gap-2 text-sm"> 38 {{ template "user/fragments/picHandleLink" $repo.Did }} 39 {{ with $source }} 40 {{ $sourceDid := resolve .Did }} 41 forked 42 <a href="/{{ $sourceDid }}/{{ .Name }}"class="no-underline hover:underline"> 43 {{ $sourceDid }}/{{ .Name }} 44 </a> 45 to 46 <a href="/{{ $userHandle }}/{{ $repo.Name }}" class="no-underline hover:underline">{{ $repo.Name }}</a> 47 {{ else }} 48 created 49 <a href="/{{ $userHandle }}/{{ $repo.Name }}" class="no-underline hover:underline"> 50 {{ $repo.Name }} 51 </a> 52 {{ end }} 53 <span class="text-gray-700 dark:text-gray-400 text-xs">{{ template "repo/fragments/time" $repo.Created }}</span> 54 </div> 55 {{ with $repo }} 56 {{ template "user/fragments/repoCard" (list $root . true true (dict "IsStarred" $event.IsStarred "SubjectAt" .RepoAt "StarCount" $event.StarCount)) }} 57 {{ end }} 58{{ end }} 59 60{{ define "timeline/fragments/starEvent" }} 61 {{ $root := index . 0 }} 62 {{ $group := index . 1 }} 63 {{ $event := $group.Primary }} 64 {{ $star := $event.RepoStar }} 65 {{ with $star }} 66 {{ $repoOwnerHandle := resolve .Repo.Did }} 67 <div class="pl-6 py-2 bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 flex flex-wrap items-center gap-2 text-sm"> 68 {{ template "user/fragments/picHandleLink" .Did }} 69 {{ if $group.IsCollapsed }} 70 <span class="inline-flex items-center gap-1.5"> 71 {{ template "timeline/fragments/othersBadge" $group }} 72 starred 73 </span> 74 {{ else }} 75 starred 76 {{ end }} 77 <a href="/{{ $repoOwnerHandle }}/{{ .Repo.Name }}" class="no-underline hover:underline"> 78 {{ $repoOwnerHandle | truncateAt30 }}/{{ .Repo.Name }} 79 </a> 80 <span class="text-gray-700 dark:text-gray-400 text-xs">{{ template "repo/fragments/time" .Created }}</span> 81 </div> 82 {{ with .Repo }} 83 {{ template "user/fragments/repoCard" (list $root . true true (dict "IsStarred" $event.IsStarred "SubjectAt" .RepoAt "StarCount" $event.StarCount)) }} 84 {{ end }} 85 {{ end }} 86{{ end }} 87 88{{ define "timeline/fragments/followEvent" }} 89 {{ $root := index . 0 }} 90 {{ $group := index . 1 }} 91 {{ $event := $group.Primary }} 92 {{ $follow := $event.Follow }} 93 {{ $profile := $event.Profile }} 94 {{ $followStats := $event.FollowStats }} 95 {{ $followStatus := $event.FollowStatus }} 96 97 {{ $subjectHandle := resolve $follow.SubjectDid }} 98 <div class="pl-6 py-2 bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 flex flex-wrap items-center gap-2 text-sm"> 99 {{ template "user/fragments/picHandleLink" $follow.UserDid }} 100 {{ if $group.IsCollapsed }} 101 <span class="inline-flex items-center gap-1.5"> 102 {{ template "timeline/fragments/othersBadge" $group }} 103 followed 104 </span> 105 {{ else }} 106 followed 107 {{ end }} 108 {{ template "user/fragments/picHandleLink" $subjectHandle }} 109 <span class="text-gray-700 dark:text-gray-400 text-xs">{{ template "repo/fragments/time" $follow.FollowedAt }}</span> 110 </div> 111 {{ template "user/fragments/followCard" 112 (dict 113 "LoggedInUser" $root.LoggedInUser 114 "UserDid" $follow.SubjectDid 115 "Profile" $profile 116 "FollowStatus" $followStatus 117 "FollowersCount" $followStats.Followers 118 "FollowingCount" $followStats.Following) }} 119{{ end }} 120 121{{ define "timeline/fragments/othersBadge" }} 122 {{ $group := . }} 123 <span class="relative group inline-flex items-center cursor-pointer" tabindex="0" 124 >and&nbsp;<span class="underline decoration-dotted decoration-gray-400">{{ $group.OthersCount }} other{{ if ne $group.OthersCount 1 }}s{{ end }}</span 125 ><div class="absolute left-0 top-full pt-1 z-10 hidden group-hover:block group-focus-within:block"> 126 <div class="min-w-48 max-w-xs bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded shadow-lg p-2 cursor-default"> 127 <ul class="flex flex-col gap-1"> 128 {{ range $other := $group.Others }} 129 <li class="flex items-center gap-2 text-sm cursor-pointer"> 130 {{ if $other.RepoStar }} 131 {{ template "user/fragments/picHandleLink" $other.RepoStar.Did }} 132 {{ else if $other.Follow }} 133 {{ template "user/fragments/picHandleLink" $other.Follow.UserDid }} 134 {{ end }} 135 </li> 136 {{ end }} 137 </ul> 138 </div> 139 </div></span> 140{{ end }}