Signed-off-by: Anirudh Oppiliappan anirudh@tangled.sh
appview/db/timeline.go
appview/db/timeline.go
This file has not been changed.
+1
-48
appview/pages/templates/timeline/fragments/timeline.html
+1
-48
appview/pages/templates/timeline/fragments/timeline.html
···
52
52
<span class="text-gray-700 dark:text-gray-400 text-xs">{{ template "repo/fragments/time" $repo.Created }}</span>
53
53
</div>
54
54
{{ with $repo }}
55
-
<div class="py-4 px-6 gap-1 flex flex-col drop-shadow-sm rounded bg-white dark:bg-gray-800 min-h-32">
56
-
<div class="flex items-center justify-between">
57
-
<div class="font-medium dark:text-white flex items-center">
58
-
{{ if .Source }}
59
-
{{ i "git-fork" "w-4 h-4 mr-1.5 shrink-0" }}
60
-
{{ else }}
61
-
{{ i "book-marked" "w-4 h-4 mr-1.5 shrink-0" }}
62
-
{{ end }}
63
-
64
-
{{ $repoOwner := resolve .Did }}
65
-
<a href="/{{ $repoOwner }}/{{ .Name }}" class="truncate">{{ $repoOwner }}/{{ .Name }}</a>
66
-
</div>
67
-
68
-
{{ if $root.LoggedInUser }}
69
-
{{ template "repo/fragments/repoStar" (dict "IsStarred" $event.IsStarred "RepoAt" .RepoAt "Stats" (dict "StarCount" $event.StarCount)) }}
70
-
{{ end }}
71
-
</div>
72
-
73
-
{{ with .Description }}
74
-
<div class="text-gray-600 dark:text-gray-300 text-sm line-clamp-2">
75
-
{{ . | description }}
76
-
</div>
77
-
{{ end }}
78
-
79
-
{{ if .RepoStats }}
80
-
<div class="text-gray-400 text-sm font-mono inline-flex gap-4 mt-auto">
81
-
{{ with .RepoStats.Language }}
82
-
<div class="flex gap-2 items-center text-sm">
83
-
<div class="size-2 rounded-full"
84
-
style="background: radial-gradient(circle at 35% 35%, color-mix(in srgb, {{ langColor . }} 70%, white), {{ langColor . }} 30%, color-mix(in srgb, {{ langColor . }} 85%, black));"></div>
85
-
<span>{{ . }}</span>
86
-
</div>
87
-
{{ end }}
88
-
{{ with .RepoStats.IssueCount.Open }}
89
-
<div class="flex gap-1 items-center text-sm">
90
-
{{ i "circle-dot" "w-3 h-3" }}
91
-
<span>{{ . }}</span>
92
-
</div>
93
-
{{ end }}
94
-
{{ with .RepoStats.PullCount.Open }}
95
-
<div class="flex gap-1 items-center text-sm">
96
-
{{ i "git-pull-request" "w-3 h-3" }}
97
-
<span>{{ . }}</span>
98
-
</div>
99
-
{{ end }}
100
-
</div>
101
-
{{ end }}
102
-
</div>
55
+
{{ template "user/fragments/repoCard" (list $root . true true (dict "IsStarred" $event.IsStarred "RepoAt" .RepoAt "Stats" (dict "StarCount" $event.StarCount))) }}
103
56
{{ end }}
104
57
{{ end }}
105
58
+21
-7
appview/pages/templates/user/fragments/repoCard.html
+21
-7
appview/pages/templates/user/fragments/repoCard.html
···
2
2
{{ $root := index . 0 }}
3
3
{{ $repo := index . 1 }}
4
4
{{ $fullName := index . 2 }}
5
+
{{ $starButton := false }}
6
+
{{ $starData := dict }}
7
+
{{ if gt (len .) 3 }}
8
+
{{ $starButton = index . 3 }}
9
+
{{ if gt (len .) 4 }}
10
+
{{ $starData = index . 4 }}
11
+
{{ end }}
12
+
{{ end }}
5
13
6
14
{{ with $repo }}
7
15
<div class="py-4 px-6 gap-1 flex flex-col drop-shadow-sm rounded bg-white dark:bg-gray-800 min-h-32">
8
-
<div class="font-medium dark:text-white flex items-center">
16
+
<div class="font-medium dark:text-white flex items-center justify-between">
17
+
<div class="flex items-center">
9
18
{{ if .Source }}
10
19
{{ i "git-fork" "w-4 h-4 mr-1.5 shrink-0" }}
11
20
{{ else }}
12
21
{{ i "book-marked" "w-4 h-4 mr-1.5 shrink-0" }}
13
22
{{ end }}
14
23
15
-
{{ $repoOwner := resolve .Did }}
16
-
{{- if $fullName -}}
17
-
<a href="/{{ $repoOwner }}/{{ .Name }}" class="truncate">{{ $repoOwner }}/{{ .Name }}</a>
18
-
{{- else -}}
19
-
<a href="/{{ $repoOwner }}/{{ .Name }}" class="truncate">{{ .Name }}</a>
20
-
{{- end -}}
24
+
{{ $repoOwner := resolve .Did }}
25
+
{{- if $fullName -}}
26
+
<a href="/{{ $repoOwner }}/{{ .Name }}" class="truncate">{{ $repoOwner }}/{{ .Name }}</a>
27
+
{{- else -}}
28
+
<a href="/{{ $repoOwner }}/{{ .Name }}" class="truncate">{{ .Name }}</a>
29
+
{{- end -}}
30
+
</div>
31
+
32
+
{{ if and $starButton $root.LoggedInUser }}
33
+
{{ template "repo/fragments/repoStar" $starData }}
34
+
{{ end }}
21
35
</div>
22
36
{{ with .Description }}
23
37
<div class="text-gray-600 dark:text-gray-300 text-sm line-clamp-2">
History
3 rounds
1 comment
anirudh.fi
submitted
#2
1 commit
expand
collapse
appview/db: avoid N+1 queries in follow/star status fetching
Use a bulk fetcher for both.
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>
expand 0 comments
pull request successfully merged
anirudh.fi
submitted
#1
1 commit
expand
collapse
appview/{pages,db}: show star/unstar buttons on the timeline
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>
expand 1 comment
anirudh.fi
submitted
#0
1 commit
expand
collapse
appview/{pages,db}: show star/unstar buttons on the timeline
Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>
similarly,
GetStarStatusis an N+1 query, we can introduce a helper that gets this status in bulk instead.