forked from tangled.org/core
this repo has no description

hammerin on styles

look good already gah

Changed files
+72 -41
appview
db
pages
templates
+6 -4
appview/db/profile.go
··· 1 package db 2 3 import ( 4 - "encoding/json" 5 "fmt" 6 "time" 7 ) ··· 19 RepoEvents []RepoEvent 20 IssueEvents IssueEvents 21 PullEvents PullEvents 22 } 23 24 type IssueEvents struct { ··· 154 Source: sourceRepo, 155 }) 156 } 157 - 158 - x, _ := json.MarshalIndent(timeline, "", "\t") 159 - fmt.Println(string(x)) 160 161 return &timeline, nil 162 }
··· 1 package db 2 3 import ( 4 "fmt" 5 "time" 6 ) ··· 18 RepoEvents []RepoEvent 19 IssueEvents IssueEvents 20 PullEvents PullEvents 21 + } 22 + 23 + func (b ByMonth) IsEmpty() bool { 24 + return len(b.RepoEvents) == 0 && 25 + len(b.IssueEvents.Items) == 0 && 26 + len(b.PullEvents.Items) == 0 27 } 28 29 type IssueEvents struct { ··· 159 Source: sourceRepo, 160 }) 161 } 162 163 return &timeline, nil 164 }
+66 -37
appview/pages/templates/user/profile.html
··· 16 {{ end }} 17 18 {{ define "profileTimeline" }} 19 - <p class="text-sm font-bold py-2 dark:text-white">ACTIVITY</p> 20 <div class="flex flex-col gap-6 relative"> 21 {{ with .ProfileTimeline }} 22 {{ range $idx, $byMonth := .ByMonth }} 23 {{ with $byMonth }} 24 <div class="bg-white dark:bg-gray-800 px-6 py-4 rounded drop-shadow-sm"> 25 {{ if eq $idx 0 }} 26 - <p class="text-sm font-bold py-2 dark:text-white">This month</p> 27 {{ else }} 28 - {{ $s := "s" }} 29 - {{ if eq $idx 1 }} 30 - {{ $s = "" }} 31 - {{ end }} 32 - <p class="text-sm font-bold py-2 dark:text-white">{{$idx}} month{{$s}} ago</p> 33 {{ end }} 34 35 - <div class="flex flex-col gap-4"> 36 - {{ block "repoEvents" (list .RepoEvents $.DidHandleMap) }} {{ end }} 37 - {{ block "issueEvents" (list .IssueEvents $.DidHandleMap) }} {{ end }} 38 - {{ block "pullEvents" (list .PullEvents $.DidHandleMap) }} {{ end }} 39 - </div> 40 </div> 41 42 {{ end }} ··· 52 {{ $handleMap := index . 1 }} 53 54 {{ if gt (len $items) 0 }} 55 - <details open> 56 - <summary class="list-none cursor-pointer"> 57 <div class="flex items-center gap-2"> 58 created {{ len $items }} {{if eq (len $items) 1 }}repository{{else}}repositories{{end}} 59 </div> 60 </summary> 61 - <div class="p-2 text-sm flex flex-col gap-3"> 62 {{ range $items }} 63 <div class="flex flex-wrap items-center gap-2"> 64 <span class="text-gray-500 dark:text-gray-400"> ··· 86 {{ $handleMap := index . 1 }} 87 88 {{ if gt (len $items) 0 }} 89 - <details open> 90 - <summary class="list-none cursor-pointer"> 91 <div class="flex items-center gap-2"> 92 - <span> 93 created {{ len $items }} {{if eq (len $items) 1 }}issue{{else}}issues{{end}} 94 - </span> 95 - <span class="px-2 py-1/2 text-sm rounded-sm text-white bg-green-600 dark:bg-green-700"> 96 - {{$stats.Open}} open 97 - </span> 98 - <span class="px-2 py-1/2 text-sm rounded-sm text-white bg-gray-800 dark:bg-gray-700"> 99 {{$stats.Closed}} closed 100 </span> 101 </div> 102 </summary> 103 - <div class="p-2 text-sm flex flex-col gap-3"> 104 {{ range $items }} 105 {{ $repoOwner := index $handleMap .Metadata.Repo.Did }} 106 {{ $repoName := .Metadata.Repo.Name }} ··· 138 {{ $stats := $i.Stats }} 139 {{ $handleMap := index . 1 }} 140 {{ if gt (len $items) 0 }} 141 - <details open> 142 - <summary class="list-none cursor-pointer"> 143 <div class="flex items-center gap-2"> 144 - <span> 145 created {{ len $items }} {{if eq (len $items) 1 }}pull request{{else}}pull requests{{end}} 146 - </span> 147 - <span class="px-2 py-1/2 text-sm rounded-sm text-white bg-green-600 dark:bg-green-700"> 148 - {{$stats.Open}} open 149 - </span> 150 - <span class="px-2 py-1/2 text-sm rounded-sm text-white bg-purple-600 dark:bg-purple-700"> 151 - {{$stats.Merged}} merged 152 - </span> 153 - <span class="px-2 py-1/2 text-sm rounded-sm text-black dark:text-white bg-gray-50 dark:bg-gray-700 "> 154 {{$stats.Closed}} closed 155 </span> 156 </div> 157 </summary> 158 - <div class="p-2 text-sm flex flex-col gap-3"> 159 {{ range $items }} 160 {{ $repoOwner := index $handleMap .Repo.Did }} 161 {{ $repoName := .Repo.Name }} ··· 184 {{$repoUrl}} 185 </a> 186 <time class="text-gray-700 dark:text-gray-400 text-xs ml-2">{{ .Created | shortTimeFmt }}</time> 187 - </p> 188 {{ end }} 189 </div> 190 </details>
··· 16 {{ end }} 17 18 {{ define "profileTimeline" }} 19 + <p class="text-sm font-bold py-2 dark:text-white px-6">ACTIVITY</p> 20 <div class="flex flex-col gap-6 relative"> 21 {{ with .ProfileTimeline }} 22 {{ range $idx, $byMonth := .ByMonth }} 23 {{ with $byMonth }} 24 <div class="bg-white dark:bg-gray-800 px-6 py-4 rounded drop-shadow-sm"> 25 {{ if eq $idx 0 }} 26 + 27 {{ else }} 28 + {{ $s := "s" }} 29 + {{ if eq $idx 1 }} 30 + {{ $s = "" }} 31 + {{ end }} 32 + <p class="text-sm font-bold dark:text-white mb-2">{{$idx}} month{{$s}} ago</p> 33 {{ end }} 34 35 + {{ if .IsEmpty }} 36 + <div class="text-gray-500 dark:text-gray-400"> 37 + No activity for this month 38 + </div> 39 + {{ else }} 40 + <div class="flex flex-col gap-1"> 41 + {{ block "repoEvents" (list .RepoEvents $.DidHandleMap) }} {{ end }} 42 + {{ block "issueEvents" (list .IssueEvents $.DidHandleMap) }} {{ end }} 43 + {{ block "pullEvents" (list .PullEvents $.DidHandleMap) }} {{ end }} 44 + </div> 45 + {{ end }} 46 </div> 47 48 {{ end }} ··· 58 {{ $handleMap := index . 1 }} 59 60 {{ if gt (len $items) 0 }} 61 + <details> 62 + <summary class="list-none cursor-pointer hover:underline"> 63 <div class="flex items-center gap-2"> 64 + {{ i "book-plus" "w-4 h-4" }} 65 created {{ len $items }} {{if eq (len $items) 1 }}repository{{else}}repositories{{end}} 66 </div> 67 </summary> 68 + <div class="p-2 pr-0 text-sm flex flex-col gap-3"> 69 {{ range $items }} 70 <div class="flex flex-wrap items-center gap-2"> 71 <span class="text-gray-500 dark:text-gray-400"> ··· 93 {{ $handleMap := index . 1 }} 94 95 {{ if gt (len $items) 0 }} 96 + <details> 97 + <summary class="list-none cursor-pointer hover:underline"> 98 <div class="flex items-center gap-2"> 99 + {{ i "circle-dot" "w-4 h-4" }} 100 + 101 + <div> 102 created {{ len $items }} {{if eq (len $items) 1 }}issue{{else}}issues{{end}} 103 + </div> 104 + 105 + {{ if gt $stats.Open 0 }} 106 + <span class="px-2 py-1/2 text-sm rounded text-white bg-green-600 dark:bg-green-700"> 107 + {{$stats.Open}} open 108 + </span> 109 + {{ end }} 110 + 111 + {{ if gt $stats.Closed 0 }} 112 + <span class="px-2 py-1/2 text-sm rounded text-white bg-gray-800 dark:bg-gray-700"> 113 {{$stats.Closed}} closed 114 </span> 115 + {{ end }} 116 + 117 </div> 118 </summary> 119 + <div class="p-2 pr-0 text-sm flex flex-col gap-3"> 120 {{ range $items }} 121 {{ $repoOwner := index $handleMap .Metadata.Repo.Did }} 122 {{ $repoName := .Metadata.Repo.Name }} ··· 154 {{ $stats := $i.Stats }} 155 {{ $handleMap := index . 1 }} 156 {{ if gt (len $items) 0 }} 157 + <details> 158 + <summary class="list-none cursor-pointer hover:underline"> 159 <div class="flex items-center gap-2"> 160 + {{ i "git-pull-request" "w-4 h-4" }} 161 + 162 + <div> 163 created {{ len $items }} {{if eq (len $items) 1 }}pull request{{else}}pull requests{{end}} 164 + </div> 165 + 166 + {{ if gt $stats.Open 0 }} 167 + <span class="px-2 py-1/2 text-sm rounded text-white bg-green-600 dark:bg-green-700"> 168 + {{$stats.Open}} open 169 + </span> 170 + {{ end }} 171 + 172 + {{ if gt $stats.Merged 0 }} 173 + <span class="px-2 py-1/2 text-sm rounded text-white bg-purple-600 dark:bg-purple-700"> 174 + {{$stats.Merged}} merged 175 + </span> 176 + {{ end }} 177 + 178 + 179 + {{ if gt $stats.Closed 0 }} 180 + <span class="px-2 py-1/2 text-sm rounded text-black dark:text-white bg-gray-50 dark:bg-gray-700 "> 181 {{$stats.Closed}} closed 182 </span> 183 + {{ end }} 184 + 185 </div> 186 </summary> 187 + <div class="p-2 pr-0 text-sm flex flex-col gap-3"> 188 {{ range $items }} 189 {{ $repoOwner := index $handleMap .Repo.Did }} 190 {{ $repoName := .Repo.Name }} ··· 213 {{$repoUrl}} 214 </a> 215 <time class="text-gray-700 dark:text-gray-400 text-xs ml-2">{{ .Created | shortTimeFmt }}</time> 216 + </div> 217 {{ end }} 218 </div> 219 </details>