blob: dfd2d9fd8d8ac265d4f701501fa303d23141d62a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
package components
import "soko/pkg/models"
import "strconv"
css badgeColor(color string) {
font-weight: normal;
background-color: { "#" + color + "!important" };
}
func isDarkBadgeColor(color string) bool {
return color == "5319e7" || color == "0052cc" || color == "b60205"
}
templ PullRequests(hasPullRequests bool, pullRequests []*models.GithubPullRequest) {
<div class="row">
<div class="col-md-9">
if hasPullRequests {
<h3 class="mb-4">Pull Requests</h3>
<ul class="list-group">
for _, pr := range pullRequests {
<li class="list-group-item">
<div class="row">
<div class="col-md-11">
<span class="octicon octicon-git-pull-request opticon-resource-icon ml-1" style="color:SeaGreen;"></span>
<a href={ templ.URL("https://github.com/gentoo/gentoo/pull/" + pr.Id) } class="text-dark">
<b>{ pr.Title }</b>
</a>
<a href={ templ.URL(pr.CiStateLink) }>
if pr.CiState == "SUCCESS" {
<i class="fa fa-check mx-1" aria-hidden="true" style="color: SeaGreen;"></i>
} else {
<i class="fa fa-times mx-1" aria-hidden="true" style="color: #b60205;"></i>
}
</a>
for _, label := range pr.Labels {
<span
class={
"badge badge-pill p-1",
badgeColor(label.Color),
templ.KV("badge-light", !isDarkBadgeColor(label.Color)),
templ.KV("badge-dark", isDarkBadgeColor(label.Color)),
}
>
{ label.Name }
</span>
}
</div>
<div class="col-md-1 text-right">
<a href={ templ.URL("https://github.com/gentoo/gentoo/pull/" + pr.Id) } class="text-muted">
<i class="fa fa-comment-o" aria-hidden="true"></i>
{ strconv.Itoa(pr.Comments) }
</a>
</div>
<div class="col-md-12 text-muted">
<span style="font-size: 90%;">
#{ pr.Id } opened { pr.CreatedAt } by { pr.Author }
</span>
</div>
</div>
</li>
}
</ul>
} else {
<div class="row pt-5">
<div class="col-md-4">
<img style="width: 100%;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Larry-the-cow-full.svg/1200px-Larry-the-cow-full.svg.png"/>
</div>
<div class="col-md-8 pt-3">
<h2>There are no pull requests</h2>
<span>You think something is missing here? <br/> Start with filling a <a href="https://wiki.gentoo.org/wiki/Gentoo_GitHub">new pull requests</a>.</span>
</div>
</div>
}
</div>
<div class="col-md-3 pt-4">
<h4 class="">
<a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseDescription" role="button" aria-expanded="false" aria-controls="collapseDescription">
Description
</a>
</h4>
<div class="collapse show" id="collapseDescription">
<span class="text-muted">
If you also like to help the Gentoo project, you can consider sending a Pull Request via GitHub.
<br/>
Before doing so, you might want to take a look at <a href="https://wiki.gentoo.org/wiki/Gentoo_GitHub">the wiki page</a>.
</span>
</div>
</div>
</div>
}
|