Signed-off-by: oppiliappan me@oppi.li
+35
-15
appview/pages/pages.go
+35
-15
appview/pages/pages.go
···
410
410
}
411
411
412
412
type ProfileCard struct {
413
-
UserDid string
414
-
UserHandle string
415
-
FollowStatus db.FollowStatus
416
-
FollowersCount int
417
-
FollowingCount int
418
-
Punchcard *db.Punchcard
419
-
Profile *db.Profile
420
-
Active string
413
+
UserDid string
414
+
UserHandle string
415
+
FollowStatus db.FollowStatus
416
+
Punchcard *db.Punchcard
417
+
Profile *db.Profile
418
+
Stats ProfileStats
419
+
Active string
420
+
}
421
+
422
+
type ProfileStats struct {
423
+
RepoCount int64
424
+
StarredCount int64
425
+
StringCount int64
426
+
FollowersCount int64
427
+
FollowingCount int64
421
428
}
422
429
423
-
func (p *ProfileCard) GetTabs() [][]string {
424
-
tabs := [][]string{
425
-
{"overview", "overview", "square-chart-gantt"},
426
-
{"repos", "repos", "book-marked"},
427
-
{"starred", "starred", "star"},
430
+
func (p *ProfileCard) GetTabs() [][]any {
431
+
tabs := [][]any{
432
+
{"overview", "overview", "square-chart-gantt", nil},
433
+
{"repos", "repos", "book-marked", p.Stats.RepoCount},
434
+
{"starred", "starred", "star", p.Stats.StarredCount},
435
+
{"strings", "strings", "line-squiggle", p.Stats.StringCount},
428
436
}
429
437
430
438
return tabs
···
468
476
return p.executeProfile("user/starred", w, params)
469
477
}
470
478
479
+
type ProfileStringsParams struct {
480
+
LoggedInUser *oauth.User
481
+
Strings []db.String
482
+
Card *ProfileCard
483
+
Active string
484
+
}
485
+
486
+
func (p *Pages) ProfileStrings(w io.Writer, params ProfileStringsParams) error {
487
+
params.Active = "strings"
488
+
return p.executeProfile("user/strings", w, params)
489
+
}
490
+
471
491
type FollowCard struct {
472
492
UserDid string
473
493
FollowStatus db.FollowStatus
474
-
FollowersCount int
475
-
FollowingCount int
494
+
FollowersCount int64
495
+
FollowingCount int64
476
496
Profile *db.Profile
477
497
}
478
498
+2
-7
appview/pages/repoinfo/repoinfo.go
+2
-7
appview/pages/repoinfo/repoinfo.go
···
78
78
func (r RepoInfo) TabMetadata() map[string]any {
79
79
meta := make(map[string]any)
80
80
81
-
if r.Stats.PullCount.Open > 0 {
82
-
meta["pulls"] = r.Stats.PullCount.Open
83
-
}
84
-
85
-
if r.Stats.IssueCount.Open > 0 {
86
-
meta["issues"] = r.Stats.IssueCount.Open
87
-
}
81
+
meta["pulls"] = r.Stats.PullCount.Open
82
+
meta["issues"] = r.Stats.IssueCount.Open
88
83
89
84
// more stuff?
90
85
+4
-4
appview/pages/templates/layouts/profilebase.html
+4
-4
appview/pages/templates/layouts/profilebase.html
···
9
9
10
10
{{ define "content" }}
11
11
{{ template "profileTabs" . }}
12
-
<section class="bg-white dark:bg-gray-800 p-6 rounded w-full dark:text-white">
12
+
<section class="bg-white dark:bg-gray-800 p-6 rounded w-full dark:text-white drop-shadow-sm">
13
13
<div class="grid grid-cols-1 md:grid-cols-11 gap-4">
14
14
<div class="md:col-span-3 order-1 md:order-1">
15
15
<div class="flex flex-col gap-4">
···
32
32
{{ $key := index $item 0 }}
33
33
{{ $value := index $item 1 }}
34
34
{{ $icon := index $item 2 }}
35
-
{{ $meta := index $tabmeta $key }}
35
+
{{ $meta := index $item 3 }}
36
36
<a
37
37
href="?tab={{ $value }}"
38
38
class="relative -mr-px group no-underline hover:no-underline"
···
48
48
<span class="flex items-center justify-center">
49
49
{{ i $icon "w-4 h-4 mr-2" }}
50
50
{{ $key }}
51
-
{{ if not (isNil $meta) }}
52
-
<span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span>
51
+
{{ if $meta }}
52
+
<span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span>
53
53
{{ end }}
54
54
</span>
55
55
</div>
+2
-2
appview/pages/templates/layouts/repobase.html
+2
-2
appview/pages/templates/layouts/repobase.html
···
71
71
<span class="flex items-center justify-center">
72
72
{{ i $icon "w-4 h-4 mr-2" }}
73
73
{{ $key }}
74
-
{{ if not (isNil $meta) }}
75
-
<span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span>
74
+
{{ if $meta }}
75
+
<span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span>
76
76
{{ end }}
77
77
</span>
78
78
</div>
+2
-2
appview/pages/templates/user/fragments/profileCard.html
+2
-2
appview/pages/templates/user/fragments/profileCard.html
···
92
92
{{ with $root }}
93
93
<div class="flex items-center gap-2 my-2 overflow-hidden text-ellipsis whitespace-nowrap max-w-full text-sm">
94
94
<span class="flex-shrink-0">{{ i "users" "size-4" }}</span>
95
-
<span id="followers"><a href="/{{ $userIdent }}?tab=followers">{{ .FollowersCount }} followers</a></span>
95
+
<span id="followers"><a href="/{{ $userIdent }}?tab=followers">{{ .Stats.FollowersCount }} followers</a></span>
96
96
<span class="select-none after:content-['·']"></span>
97
-
<span id="following"><a href="/{{ $userIdent }}?tab=following">{{ .FollowingCount }} following</a></span>
97
+
<span id="following"><a href="/{{ $userIdent }}?tab=following">{{ .Stats.FollowingCount }} following</a></span>
98
98
</div>
99
99
{{ end }}
100
100
{{ end }}