From 61b626bac5481cf43eb7a6b09f7187c9dc5f1a61 Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Sat, 2 Mar 2024 12:19:13 +0200 Subject: use newer templ for simpler pull requests badges Signed-off-by: Arthur Zamarin --- Dockerfile | 2 +- go.mod | 2 +- go.sum | 8 ++--- pkg/app/handler/arches/changedVersions.templ | 10 +++--- .../handler/packages/components/pullrequests.templ | 36 ++++++++++++---------- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0332055..a6b927a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM golang:1.22.0 AS builder -RUN go install github.com/a-h/templ/cmd/templ@latest +RUN go install github.com/a-h/templ/cmd/templ@v0.2.598 WORKDIR /go/src/soko COPY . /go/src/soko RUN templ generate && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o bin . diff --git a/go.mod b/go.mod index b9b374d..04aa5a1 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/99designs/gqlgen v0.17.44 - github.com/a-h/templ v0.2.543 + github.com/a-h/templ v0.2.598 github.com/go-git/go-git/v5 v5.11.0 github.com/go-pg/pg v8.0.7+incompatible github.com/go-pg/pg/v10 v10.12.0 diff --git a/go.sum b/go.sum index 194e7ec..1d2f7c3 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/a-h/templ v0.2.543 h1:8YyLvyUtf0/IE2nIwZ62Z/m2o2NqwhnMynzOL78Lzbk= -github.com/a-h/templ v0.2.543/go.mod h1:jP908DQCwI08IrnTalhzSEH9WJqG/Q94+EODQcJGFUA= +github.com/a-h/templ v0.2.598 h1:6jMIHv6wQZvdPxTuv87erW4RqN/FPU0wk7ZHN5wVuuo= +github.com/a-h/templ v0.2.598/go.mod h1:SA7mtYwVEajbIXFRh3vKdYm/4FYyLQAtPH1+KxzGPA8= github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= @@ -39,8 +39,8 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/El github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= diff --git a/pkg/app/handler/arches/changedVersions.templ b/pkg/app/handler/arches/changedVersions.templ index 7247ab0..1c7dc16 100644 --- a/pkg/app/handler/arches/changedVersions.templ +++ b/pkg/app/handler/arches/changedVersions.templ @@ -47,11 +47,11 @@ templ archesHeader(currentArch string, userPreferences models.ArchesPreferences) } templ changedVersions( - currentArch string, - name string, - feedName string, - versions []*models.Version, - userPreferences models.ArchesPreferences, + currentArch string, + name string, + feedName string, + versions []*models.Version, + userPreferences models.ArchesPreferences, ) { @archesHeader(currentArch, userPreferences)
diff --git a/pkg/app/handler/packages/components/pullrequests.templ b/pkg/app/handler/packages/components/pullrequests.templ index 77f0fa7..dfd2d9f 100644 --- a/pkg/app/handler/packages/components/pullrequests.templ +++ b/pkg/app/handler/packages/components/pullrequests.templ @@ -3,6 +3,15 @@ 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) {
@@ -25,23 +34,16 @@ templ PullRequests(hasPullRequests bool, pullRequests []*models.GithubPullReques } for _, label := range pr.Labels { - // the style attribute can be made more beautiful when this commit is released - // https://github.com/a-h/templ/commit/f24922fd3442f39c737273023f2f13b606274b20 - if label.Color == "5319e7" || label.Color == "0052cc" || label.Color == "b60205" { - - { label.Name } - - } else { - - { label.Name } - - } + + { label.Name } + }
-- cgit v1.2.3-65-gdbad