forked from tangled.org/core
Monorepo for Tangled

hammerin on styles

look good already gah

Changed files
+72 -41
appview
db
pages
templates
+6 -4
appview/db/profile.go
··· 1 1 package db 2 2 3 3 import ( 4 - "encoding/json" 5 4 "fmt" 6 5 "time" 7 6 ) ··· 19 18 RepoEvents []RepoEvent 20 19 IssueEvents IssueEvents 21 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 22 27 } 23 28 24 29 type IssueEvents struct { ··· 154 159 Source: sourceRepo, 155 160 }) 156 161 } 157 - 158 - x, _ := json.MarshalIndent(timeline, "", "\t") 159 - fmt.Println(string(x)) 160 162 161 163 return &timeline, nil 162 164 }
+66 -37
appview/pages/templates/user/profile.html
··· 16 16 {{ end }} 17 17 18 18 {{ define "profileTimeline" }} 19 - <p class="text-sm font-bold py-2 dark:text-white">ACTIVITY</p> 19 + <p class="text-sm font-bold py-2 dark:text-white px-6">ACTIVITY</p> 20 20 <div class="flex flex-col gap-6 relative"> 21 21 {{ with .ProfileTimeline }} 22 22 {{ range $idx, $byMonth := .ByMonth }} 23 23 {{ with $byMonth }} 24 24 <div class="bg-white dark:bg-gray-800 px-6 py-4 rounded drop-shadow-sm"> 25 25 {{ if eq $idx 0 }} 26 - <p class="text-sm font-bold py-2 dark:text-white">This month</p> 26 + 27 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> 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 33 {{ end }} 34 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> 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 }} 40 46 </div> 41 47 42 48 {{ end }} ··· 52 58 {{ $handleMap := index . 1 }} 53 59 54 60 {{ if gt (len $items) 0 }} 55 - <details open> 56 - <summary class="list-none cursor-pointer"> 61 + <details> 62 + <summary class="list-none cursor-pointer hover:underline"> 57 63 <div class="flex items-center gap-2"> 64 + {{ i "book-plus" "w-4 h-4" }} 58 65 created {{ len $items }} {{if eq (len $items) 1 }}repository{{else}}repositories{{end}} 59 66 </div> 60 67 </summary> 61 - <div class="p-2 text-sm flex flex-col gap-3"> 68 + <div class="p-2 pr-0 text-sm flex flex-col gap-3"> 62 69 {{ range $items }} 63 70 <div class="flex flex-wrap items-center gap-2"> 64 71 <span class="text-gray-500 dark:text-gray-400"> ··· 86 93 {{ $handleMap := index . 1 }} 87 94 88 95 {{ if gt (len $items) 0 }} 89 - <details open> 90 - <summary class="list-none cursor-pointer"> 96 + <details> 97 + <summary class="list-none cursor-pointer hover:underline"> 91 98 <div class="flex items-center gap-2"> 92 - <span> 99 + {{ i "circle-dot" "w-4 h-4" }} 100 + 101 + <div> 93 102 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"> 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"> 99 113 {{$stats.Closed}} closed 100 114 </span> 115 + {{ end }} 116 + 101 117 </div> 102 118 </summary> 103 - <div class="p-2 text-sm flex flex-col gap-3"> 119 + <div class="p-2 pr-0 text-sm flex flex-col gap-3"> 104 120 {{ range $items }} 105 121 {{ $repoOwner := index $handleMap .Metadata.Repo.Did }} 106 122 {{ $repoName := .Metadata.Repo.Name }} ··· 138 154 {{ $stats := $i.Stats }} 139 155 {{ $handleMap := index . 1 }} 140 156 {{ if gt (len $items) 0 }} 141 - <details open> 142 - <summary class="list-none cursor-pointer"> 157 + <details> 158 + <summary class="list-none cursor-pointer hover:underline"> 143 159 <div class="flex items-center gap-2"> 144 - <span> 160 + {{ i "git-pull-request" "w-4 h-4" }} 161 + 162 + <div> 145 163 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 "> 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 "> 154 181 {{$stats.Closed}} closed 155 182 </span> 183 + {{ end }} 184 + 156 185 </div> 157 186 </summary> 158 - <div class="p-2 text-sm flex flex-col gap-3"> 187 + <div class="p-2 pr-0 text-sm flex flex-col gap-3"> 159 188 {{ range $items }} 160 189 {{ $repoOwner := index $handleMap .Repo.Did }} 161 190 {{ $repoName := .Repo.Name }} ··· 184 213 {{$repoUrl}} 185 214 </a> 186 215 <time class="text-gray-700 dark:text-gray-400 text-xs ml-2">{{ .Created | shortTimeFmt }}</time> 187 - </p> 216 + </div> 188 217 {{ end }} 189 218 </div> 190 219 </details>