forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
1{{ define "title" }}{{ or .UserHandle .UserDid }}{{ end }} 2 3{{ define "content" }} 4<div class="grid grid-cols-1 md:grid-cols-5 gap-6"> 5 <div class="md:col-span-1 order-1 md:order-1"> 6 {{ block "profileCard" . }}{{ end }} 7 </div> 8 <div class="md:col-span-2 order-2 md:order-2"> 9 {{ block "ownRepos" . }}{{ end }} 10 {{ block "collaboratingRepos" . }}{{ end }} 11 </div> 12 13 <div class="md:col-span-2 order-3 md:order-3"> 14 {{ block "profileTimeline" . }}{{ end }} 15 </div> 16</div> 17{{ end }} 18 19 20{{ define "profileTimeline" }} 21 <div class="flex flex-col gap-3 relative"> 22 <p class="px-6 text-sm font-bold py-2 dark:text-white">ACTIVITY</p> 23 {{ range .ProfileTimeline }} 24 {{ if eq .Type "issue" }} 25 <div class="px-6 py-2 bg-white dark:bg-gray-800 rounded drop-shadow-sm w-fit max-w-full flex items-center gap-2"> 26 {{ $textColor := "text-gray-800 dark:text-gray-400" }} 27 {{ $icon := "ban" }} 28 {{ if .Issue.Open }} 29 {{ $textColor = "text-green-600 dark:text-green-500" }} 30 {{ $icon = "circle-dot" }} 31 {{ end }} 32 <div class="p-1 {{ $textColor }}"> 33 {{ i $icon "w-5 h-5" }} 34 </div> 35 <div> 36 <p class="text-gray-600 dark:text-gray-300"> 37 <a href="/{{ index $.DidHandleMap .Repo.Did }}/{{ .Repo.Name }}/issues/{{ .Issue.IssueId }}" class="no-underline hover:underline">{{ .Issue.Title }} <span class="text-gray-500 dark:text-gray-400">#{{ .Issue.IssueId }}</span></a> 38 on 39 <a href="/{{ index $.DidHandleMap .Repo.Did }}/{{ .Repo.Name }}" class="no-underline hover:underline">{{ index $.DidHandleMap .Repo.Did }}<span class="select-none">/</span>{{ .Repo.Name }}</a> 40 <time class="text-gray-700 dark:text-gray-400 text-xs ml-2">{{ .Issue.Created | shortTimeFmt }}</time> 41 </p> 42 </div> 43 </div> 44 {{ else if eq .Type "pull" }} 45 <div class="px-6 py-2 bg-white dark:bg-gray-800 rounded drop-shadow-sm w-fit flex items-center gap-3"> 46 {{ $textColor := "text-gray-800 dark:text-gray-400" }} 47 {{ $icon := "git-pull-request-closed" }} 48 {{ if .Pull.State.IsOpen }} 49 {{ $textColor = "text-green-600 dark:text-green-500" }} 50 {{ $icon = "git-pull-request" }} 51 {{ else if .Pull.State.IsMerged }} 52 {{ $textColor = "text-purple-600 dark:text-purple-500" }} 53 {{ $icon = "git-merge" }} 54 {{ end }} 55 <div class="{{ $textColor }} p-1"> 56 {{ i $icon "w-5 h-5" }} 57 </div> 58 <div> 59 <p class="text-gray-600 dark:text-gray-300"> 60 <a href="/{{ index $.DidHandleMap .Repo.Did }}/{{ .Repo.Name }}/pulls/{{ .Pull.PullId }}" class="no-underline hover:underline">{{ .Pull.Title }} <span class="text-gray-500 dark:text-gray-400">#{{ .Pull.PullId }}</span></a> 61 on 62 <a href="/{{ index $.DidHandleMap .Repo.Did }}/{{ .Repo.Name }}" class="no-underline hover:underline"> 63 {{ index $.DidHandleMap .Repo.Did }}<span class="select-none">/</span>{{ .Repo.Name }}</a> 64 <time class="text-gray-700 dark:text-gray-400 text-xs ml-2">{{ .Pull.Created | shortTimeFmt }}</time> 65 </p> 66 </div> 67 </div> 68 {{ else if eq .Type "repo" }} 69 <div class="px-6 py-2 bg-white dark:bg-gray-800 rounded drop-shadow-sm w-fit flex items-center gap-3"> 70 {{ if .Source }} 71 <div class="text-gray-800 dark:text-gray-400 p-1"> 72 {{ i "git-fork" "w-5 h-5" }} 73 </div> 74 {{ else }} 75 <div class="text-gray-800 dark:text-gray-400 p-1"> 76 {{ i "book-plus" "w-5 h-5" }} 77 </div> 78 {{ end }} 79 <div> 80 <p class="text-gray-600 dark:text-gray-300"> 81 82 {{ if .Source }} 83 forked 84 <a href="/{{ index $.DidHandleMap .Source.Did }}/{{ .Source.Name }}" class="no-underline hover:underline"> 85 {{ index $.DidHandleMap .Source.Did }}/{{ .Source.Name }} 86 </a> 87 to 88 <a href="/{{ didOrHandle $.UserHandle $.UserDid }}/{{ .Repo.Name }}" class="no-underline hover:underline">{{ .Repo.Name }}</a> 89 {{ else }} 90 created 91 <a href="/{{ index $.DidHandleMap .Repo.Did }}/{{ .Repo.Name }}" class="no-underline hover:underline">{{ .Repo.Name }}</a> 92 {{ end }} 93 <time class="text-gray-700 dark:text-gray-400 text-xs ml-2">{{ .Repo.Created | shortTimeFmt }}</time> 94 </p> 95 </div> 96 </div> 97 {{ end }} 98 {{ else }} 99 <p class="px-6 dark:text-white">This user does not have any activity yet.</p> 100 {{ end }} 101 </div> 102{{ end }} 103 104{{ define "profileCard" }} 105 <div class="bg-white dark:bg-gray-800 px-6 py-4 rounded drop-shadow-sm max-h-fit"> 106 <div class="flex justify-center items-center"> 107 {{ if .AvatarUri }} 108 <img class="w-3/4 rounded-full p-2" src="{{ .AvatarUri }}" /> 109 {{ end }} 110 </div> 111 <p 112 title="{{ didOrHandle .UserDid .UserHandle }}" 113 class="text-lg font-bold text-center dark:text-white overflow-hidden text-ellipsis whitespace-nowrap max-w-full" 114 > 115 {{ didOrHandle .UserDid .UserHandle }} 116 </p> 117 <div class="text-sm text-center dark:text-gray-300"> 118 <span>{{ .ProfileStats.Followers }} followers</span> 119 <div 120 class="inline-block px-1 select-none after:content-['·']" 121 ></div> 122 <span>{{ .ProfileStats.Following }} following</span> 123 </div> 124 125 {{ if ne .FollowStatus.String "IsSelf" }} 126 {{ template "fragments/follow" . }} 127 {{ end }} 128 </div> 129{{ end }} 130 131{{ define "ownRepos" }} 132 <p class="text-sm font-bold py-2 px-6 dark:text-white">REPOS</p> 133 <div id="repos" class="grid grid-cols-1 gap-4 mb-6"> 134 {{ range .Repos }} 135 <div 136 id="repo-card" 137 class="py-4 px-6 drop-shadow-sm rounded bg-white dark:bg-gray-800" 138 > 139 <div id="repo-card-name" class="font-medium dark:text-white"> 140 <a href="/@{{ or $.UserHandle $.UserDid }}/{{ .Name }}" 141 >{{ .Name }}</a 142 > 143 </div> 144 {{ if .Description }} 145 <div class="text-gray-600 dark:text-gray-300 text-sm"> 146 {{ .Description }} 147 </div> 148 {{ end }} 149 <div 150 class="text-gray-400 pt-1 text-sm font-mono inline-flex gap-4 mt-auto" 151 > 152 153 {{ if .RepoStats.StarCount }} 154 <div class="flex gap-1 items-center text-sm"> 155 {{ i "star" "w-3 h-3 fill-current" }} 156 <span>{{ .RepoStats.StarCount }}</span> 157 </div> 158 {{ end }} 159 </div> 160 </div> 161 {{ else }} 162 <p class="px-6 dark:text-white">This user does not have any repos yet.</p> 163 {{ end }} 164 </div> 165 166 <p class="text-sm font-bold py-2 px-6 dark:text-white">COLLABORATING ON</p> 167 <div id="collaborating" class="grid grid-cols-1 gap-4 mb-6"> 168 {{ range .CollaboratingRepos }} 169 <div 170 id="repo-card" 171 class="py-4 px-6 drop-shadow-sm rounded bg-white dark:bg-gray-800 flex flex-col" 172 > 173 <div id="repo-card-name" class="font-medium dark:text-white"> 174 <a href="/{{ index $.DidHandleMap .Did }}/{{ .Name }}"> 175 {{ index $.DidHandleMap .Did }}/{{ .Name }} 176 </a> 177 </div> 178 {{ if .Description }} 179 <div class="text-gray-600 dark:text-gray-300 text-sm"> 180 {{ .Description }} 181 </div> 182 {{ end }} 183 <div class="text-gray-400 pt-1 text-sm font-mono inline-flex gap-4 mt-auto"> 184 185 {{ if .RepoStats.StarCount }} 186 <div class="flex gap-1 items-center text-sm"> 187 {{ i "star" "w-3 h-3 fill-current" }} 188 <span>{{ .RepoStats.StarCount }}</span> 189 </div> 190 {{ end }} 191 </div> 192 </div> 193 {{ else }} 194 <p class="px-6 dark:text-white">This user is not collaborating.</p> 195 {{ end }} 196 </div> 197{{ end }}