forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
at fork-pulls 8.7 kB view raw
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 class="text-xl font-bold text-center dark:text-white"> 112 {{ truncateAt30 (didOrHandle .UserDid .UserHandle) }} 113 </p> 114 <div class="text-sm text-center dark:text-gray-300"> 115 <span>{{ .ProfileStats.Followers }} followers</span> 116 <div 117 class="inline-block px-1 select-none after:content-['·']" 118 ></div> 119 <span>{{ .ProfileStats.Following }} following</span> 120 </div> 121 122 {{ if ne .FollowStatus.String "IsSelf" }} 123 {{ template "fragments/follow" . }} 124 {{ end }} 125 </div> 126{{ end }} 127 128{{ define "ownRepos" }} 129 <p class="text-sm font-bold py-2 px-6 dark:text-white">REPOS</p> 130 <div id="repos" class="grid grid-cols-1 gap-4 mb-6"> 131 {{ range .Repos }} 132 <div 133 id="repo-card" 134 class="py-4 px-6 drop-shadow-sm rounded bg-white dark:bg-gray-800" 135 > 136 <div id="repo-card-name" class="font-medium dark:text-white"> 137 <a href="/@{{ or $.UserHandle $.UserDid }}/{{ .Name }}" 138 >{{ .Name }}</a 139 > 140 </div> 141 {{ if .Description }} 142 <div class="text-gray-600 dark:text-gray-300 text-sm"> 143 {{ .Description }} 144 </div> 145 {{ end }} 146 <div 147 class="text-gray-400 pt-1 text-sm font-mono inline-flex gap-4 mt-auto" 148 > 149 150 {{ if .RepoStats.StarCount }} 151 <div class="flex gap-1 items-center text-sm"> 152 {{ i "star" "w-3 h-3 fill-current" }} 153 <span>{{ .RepoStats.StarCount }}</span> 154 </div> 155 {{ end }} 156 </div> 157 </div> 158 {{ else }} 159 <p class="px-6 dark:text-white">This user does not have any repos yet.</p> 160 {{ end }} 161 </div> 162 163 <p class="text-sm font-bold py-2 px-6 dark:text-white">COLLABORATING ON</p> 164 <div id="collaborating" class="grid grid-cols-1 gap-4 mb-6"> 165 {{ range .CollaboratingRepos }} 166 <div 167 id="repo-card" 168 class="py-4 px-6 drop-shadow-sm rounded bg-white dark:bg-gray-800 flex flex-col" 169 > 170 <div id="repo-card-name" class="font-medium dark:text-white"> 171 <a href="/{{ index $.DidHandleMap .Did }}/{{ .Name }}"> 172 {{ index $.DidHandleMap .Did }}/{{ .Name }} 173 </a> 174 </div> 175 {{ if .Description }} 176 <div class="text-gray-600 dark:text-gray-300 text-sm"> 177 {{ .Description }} 178 </div> 179 {{ end }} 180 <div class="text-gray-400 pt-1 text-sm font-mono inline-flex gap-4 mt-auto"> 181 182 {{ if .RepoStats.StarCount }} 183 <div class="flex gap-1 items-center text-sm"> 184 {{ i "star" "w-3 h-3 fill-current" }} 185 <span>{{ .RepoStats.StarCount }}</span> 186 </div> 187 {{ end }} 188 </div> 189 </div> 190 {{ else }} 191 <p class="px-6 dark:text-white">This user is not collaborating.</p> 192 {{ end }} 193 </div> 194{{ end }}