@@ -4,6 +4,7 @@ package components
44import (
55 " soko/pkg/models"
66 " strconv"
7+ " strings"
78)
89
910css badgeColor (color string ) {
@@ -15,7 +16,11 @@ func isDarkBadgeColor(color string) bool {
1516 return color == " 5319e7" || color == " 0052cc" || color == " b60205"
1617}
1718
18- templ PullRequests (pullRequests []*models.GithubPullRequest ) {
19+ var prTypeToURL = map [string ]string {
20+ " github" : " https://github.com/gentoo/gentoo/pull/" ,
21+ }
22+
23+ templ PullRequests (pullRequests []*models.PullRequest ) {
1924 <div class =" row" >
2025 <div class =" col-md-9" >
2126 if len (pullRequests) > 0 {
@@ -26,7 +31,8 @@ templ PullRequests(pullRequests []*models.GithubPullRequest) {
2631 <div class =" row" >
2732 <div class =" col-md-11" >
2833 <span class =" octicon octicon-git-pull-request opticon-resource-icon ml-1" style =" color:SeaGreen;" ></span >
29- <a href ={ templ.URL (" https://github.com/gentoo/gentoo/pull/" + pr.Id ) } class =" text-dark" >
34+ {{ prType , id , _ := strings.Cut (pr.Id , " /" ) }}
35+ <a href ={ templ.URL (prTypeToURL[prType] + id) } class =" text-dark" >
3036 <b >{ pr.Title }</b >
3137 </a >
3238 <a href ={ templ.URL (pr.CiStateLink ) }>
@@ -50,14 +56,14 @@ templ PullRequests(pullRequests []*models.GithubPullRequest) {
5056 }
5157 </div >
5258 <div class =" col-md-1 text-right" >
53- <a href ={ templ.URL (" https://github.com/gentoo/gentoo/pull/ " + pr. Id ) } class =" text-muted" >
59+ <a href ={ templ.URL (prTypeToURL[prType] + id ) } class =" text-muted" >
5460 <i class =" fa fa-comment-o" aria-hidden =" true" ></i >
5561 { strconv.Itoa (pr.Comments ) }
5662 </a >
5763 </div >
5864 <div class =" col-md-12 text-muted" >
5965 <span style =" font-size: 90%;" >
60- #{ pr. Id } opened { pr.CreatedAt } by { pr.Author }
66+ #{ id } opened { pr.CreatedAt } by { pr.Author }
6167 </span >
6268 </div >
6369 </div >
0 commit comments