Improve favicons (#576)

- dark-mode favicon variants
- favicons based on pipeline state if opened build page

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Anbraten 2021-12-08 13:58:00 +01:00 committed by GitHub
parent ca465cec1a
commit 56f957b4e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 87 additions and 4 deletions

View file

@ -37,7 +37,8 @@ func New() *gin.Engine {
e.Use(setupCache)
h := http.FileServer(web.HTTPFS())
e.GET("/favicon.svg", gin.WrapH(h))
e.GET("/favicon.svg", redirect("/favicons/favicon-light-default.svg", http.StatusPermanentRedirect))
e.GET("/favicons/*filepath", gin.WrapH(h))
e.GET("/assets/*filepath", gin.WrapH(h))
e.NoRoute(handleIndex)
@ -45,6 +46,18 @@ func New() *gin.Engine {
return e
}
// redirect return gin helper to redirect a request
func redirect(location string, status ...int) func(ctx *gin.Context) {
return func(ctx *gin.Context) {
code := http.StatusFound
if len(status) == 1 {
code = status[0]
}
http.Redirect(ctx.Writer, ctx.Request, location, code)
}
}
func handleIndex(c *gin.Context) {
rw := c.Writer
data := web.MustLookup("index.html")

View file

@ -2,7 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.svg" />
<link rel="alternate icon" type="image/png" href="/favicons/favicon-light-default.png" id="favicon-png" />
<link rel="icon" type="image/svg+xml" href="/favicons/favicon-light-default.svg" id="favicon-svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Woodpecker</title>
<script type="" src="/web-config.js"></script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M1.263 2.744C2.41 3.832 2.845 4.932 4.118 5.08l.036.007c-.588.606-1.09 1.402-1.443 2.423-.38 1.096-.488 2.285-.614 3.659-.19 2.046-.401 4.364-1.556 7.269-2.486 6.258-1.12 11.63.332 17.317.664 2.604 1.348 5.297 1.642 8.107a.857.857 0 00.633.744.86.86 0 00.922-.323c.227-.313.524-.797.86-1.424.84 3.323 1.355 6.13 1.783 8.697a.866.866 0 001.517.41c2.88-3.463 3.763-8.636 2.184-12.674.459-2.433 1.402-4.45 2.398-6.583.536-1.15 1.08-2.318 1.55-3.566.228-.084.569-.314.79-.441l1.707-.981-.256 1.052a.864.864 0 001.678.408l.68-2.858 1.285-2.95a.863.863 0 10-1.581-.687l-1.152 2.669-2.383 1.372a18.97 18.97 0 00.508-2.981c.432-4.86-.718-9.074-3.066-11.266-.163-.157-.208-.281-.247-.26.095-.12.249-.26.358-.374 2.283-1.693 6.047-.147 8.319.75.589.232.876-.337.316-.67-1.95-1.153-5.948-4.196-8.188-6.193-.313-.275-.527-.607-.89-.913C9.825.555 4.072 3.057 1.355 2.569c-.102-.018-.166.103-.092.175m10.98 5.899c-.06 1.242-.603 1.8-1 2.208-.217.224-.426.436-.524.738-.236.714.008 1.51.66 2.143 1.974 1.84 2.925 5.527 2.538 9.86-.291 3.288-1.448 5.763-2.671 8.385-1.031 2.207-2.096 4.489-2.577 7.259a.853.853 0 00.056.48c1.02 2.434 1.135 6.197-.672 9.46a96.586 96.586 0 00-1.97-8.711c1.964-4.488 4.203-11.75 2.919-17.668-.325-1.497-1.304-3.276-2.387-4.207-.208-.18-.402-.237-.495-.167-.084.06-.151.238-.062.444.55 1.266.879 2.599 1.226 4.276 1.125 5.443-.956 12.49-2.835 16.782l-.116.259-.457.982c-.356-2.014-.85-3.95-1.33-5.84-1.38-5.406-2.68-10.515-.401-16.254 1.247-3.137 1.483-5.692 1.672-7.746.116-1.263.216-2.355.526-3.252.905-2.605 3.062-3.178 4.744-2.852 1.632.316 3.24 1.593 3.156 3.42zm-2.868.62a1.177 1.177 0 10.736-2.236 1.178 1.178 0 10-.736 2.237z" fill="white" /></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22"><g clip-path="url(#a)"><path fill="#fff" fill-rule="evenodd" d="M2.157 3.714a12.067 12.067 0 0 0-.894-.97c-.074-.072-.01-.193.092-.175.798.143 1.857.029 3.016-.096 2.791-.302 6.163-.666 7.87 2.347.193.164.345.335.492.5.127.145.252.285.397.413 2.24 1.997 6.238 5.04 8.188 6.193.56.333.273.902-.316.67l-.15-.06c-2.285-.903-5.936-2.346-8.169-.69a6.748 6.748 0 0 1-.153.154h-1.894c.011-.139.039-.276.083-.411.096-.297.3-.506.512-.726l.012-.012c.397-.408.94-.966 1-2.208v-.001c.084-1.827-1.524-3.104-3.156-3.42-1.682-.326-3.839.247-4.744 2.852-.31.896-.41 1.986-.526 3.247v.005c-.189 2.054-.425 4.609-1.672 7.746-2.279 5.739-.979 10.848.401 16.254l.02.082c.474 1.864.96 3.773 1.31 5.758l.457-.982.116-.259c1.88-4.292 3.96-11.339 2.835-16.782-.347-1.677-.676-3.01-1.226-4.276-.089-.206-.022-.384.062-.444.093-.07.287-.013.495.167 1.083.931 2.062 2.71 2.387 4.207 1.284 5.918-.955 13.18-2.919 17.668a96.584 96.584 0 0 1 1.97 8.711c1.807-3.263 1.692-7.026.672-9.46a.853.853 0 0 1-.056-.48c.481-2.77 1.546-5.052 2.577-7.259l.008-.016c1.22-2.616 2.373-5.088 2.663-8.369A21.25 21.25 0 0 0 14 22h1.726c-.006.57-.035 1.154-.088 1.746a18.988 18.988 0 0 1-.508 2.981l2.383-1.372 1.152-2.669a.862.862 0 1 1 1.581.687l-1.285 2.95-.68 2.858a.864.864 0 0 1-1.678-.408l.256-1.052-1.707.981a9.086 9.086 0 0 0-.207.124c-.195.12-.418.256-.583.317-.47 1.248-1.014 2.416-1.55 3.566l-.005.011c-.994 2.129-1.935 4.143-2.393 6.572 1.579 4.038.696 9.211-2.184 12.674a.866.866 0 0 1-1.517-.41c-.428-2.567-.943-5.374-1.783-8.697a13.09 13.09 0 0 1-.86 1.424.86.86 0 0 1-.922.323.857.857 0 0 1-.633-.744c-.294-2.81-.978-5.503-1.642-8.107-1.452-5.687-2.818-11.059-.332-17.317 1.15-2.891 1.364-5.2 1.553-7.24l.003-.029.001-.015c.126-1.368.234-2.552.613-3.644.353-1.021.855-1.817 1.443-2.423l-.036-.007c-.885-.103-1.365-.666-1.961-1.366ZM9.83 9.32a1.177 1.177 0 0 1-.456-.056v.001a1.178 1.178 0 1 1 .736-2.237 1.177 1.177 0 0 1-.28 2.292Z" clip-rule="evenodd"/></g><path fill="#EA4A5A" fill-rule="evenodd" d="M13.089 17 10 20.089l.911.911L14 17.911 17.089 21l.911-.911L14.911 17 18 13.911 17.089 13 14 16.089 10.911 13l-.911.911L13.089 17Z" clip-rule="evenodd"/><defs><clipPath id="a"><path fill="#fff" d="M0 0h22v22H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22"><g clip-path="url(#a)"><path fill="#fff" fill-rule="evenodd" d="M2.157 3.714a12.067 12.067 0 0 0-.894-.97c-.074-.072-.01-.193.092-.175.798.143 1.857.029 3.016-.096 2.791-.302 6.163-.666 7.87 2.347.193.164.345.335.492.5.127.145.252.285.397.413 2.24 1.997 6.238 5.04 8.188 6.193.56.333.273.902-.316.67l-.15-.06c-2.285-.903-5.936-2.346-8.169-.69a6.748 6.748 0 0 1-.153.154h-1.894c.011-.139.039-.276.083-.411.096-.297.3-.506.512-.726l.012-.012c.397-.408.94-.966 1-2.208v-.001c.084-1.827-1.524-3.104-3.156-3.42-1.682-.326-3.839.247-4.744 2.852-.31.896-.41 1.986-.526 3.247v.005c-.189 2.054-.425 4.609-1.672 7.746-2.279 5.739-.979 10.848.401 16.254l.02.082c.474 1.864.96 3.773 1.31 5.758l.457-.982.116-.259c1.88-4.292 3.96-11.339 2.835-16.782-.347-1.677-.676-3.01-1.226-4.276-.089-.206-.022-.384.062-.444.093-.07.287-.013.495.167 1.083.931 2.062 2.71 2.387 4.207 1.284 5.918-.955 13.18-2.919 17.668a96.584 96.584 0 0 1 1.97 8.711c1.807-3.263 1.692-7.026.672-9.46a.853.853 0 0 1-.056-.48c.481-2.77 1.546-5.052 2.577-7.259l.008-.016c1.22-2.616 2.373-5.088 2.663-8.369A21.25 21.25 0 0 0 14 22h1.726c-.006.57-.035 1.154-.088 1.746a18.988 18.988 0 0 1-.508 2.981l2.383-1.372 1.152-2.669a.862.862 0 1 1 1.581.687l-1.285 2.95-.68 2.858a.864.864 0 0 1-1.678-.408l.256-1.052-1.707.981a9.086 9.086 0 0 0-.207.124c-.195.12-.418.256-.583.317-.47 1.248-1.014 2.416-1.55 3.566l-.005.011c-.994 2.129-1.935 4.143-2.393 6.572 1.579 4.038.696 9.211-2.184 12.674a.866.866 0 0 1-1.517-.41c-.428-2.567-.943-5.374-1.783-8.697a13.09 13.09 0 0 1-.86 1.424.86.86 0 0 1-.922.323.857.857 0 0 1-.633-.744c-.294-2.81-.978-5.503-1.642-8.107-1.452-5.687-2.818-11.059-.332-17.317 1.15-2.891 1.364-5.2 1.553-7.24l.003-.029.001-.015c.126-1.368.234-2.552.613-3.644.353-1.021.855-1.817 1.443-2.423l-.036-.007c-.885-.103-1.365-.666-1.961-1.366ZM9.83 9.32a1.177 1.177 0 0 1-.456-.056v.001a1.178 1.178 0 1 1 .736-2.237 1.177 1.177 0 0 1-.28 2.292Z" clip-rule="evenodd"/></g><path fill="#F9C513" d="M14 21a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"/><defs><clipPath id="a"><path fill="#fff" d="M0 0h22v22H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22"><path fill="#34D058" fill-rule="evenodd" d="M19 13.974 13.04 21 10 17.416l.826-.974 2.214 2.61L18.174 13l.826.974Z" clip-rule="evenodd"/><path fill="#fff" fill-rule="evenodd" stroke="#428f29" stroke-width=".006" d="M6.99 21.74a19.267 19.267 0 0 0-.795-2.584c-.17-.427-.188-.518-.122-.646.107-.206.349-.098.798.354.538.543.986 1.185 1.4 2.004.198.39.478 1.041.478 1.11 0 .012-.382.022-.85.022h-.85Z" paint-order="markers fill stroke"/><path fill="#fff" fill-rule="evenodd" stroke="#428f29" stroke-width=".006" d="M.021 21v-1.016l.16-.474a27.6 27.6 0 0 1 .346-.959c.908-2.346 1.277-4.01 1.558-7.03.152-1.63.23-2.256.36-2.904.264-1.317.806-2.47 1.562-3.32.093-.104.17-.197.17-.206 0-.009-.029-.016-.063-.016-.123 0-.474-.106-.664-.2-.386-.194-.64-.425-1.27-1.158a18.72 18.72 0 0 0-.633-.696c-.165-.17-.3-.322-.3-.337 0-.014.017-.04.038-.058.03-.025.096-.025.296 0 .414.052 1.45.017 2.369-.08 1.987-.21 2.16-.222 3.076-.225.92-.003 1.181.017 1.79.134 1.056.202 1.905.627 2.578 1.289.251.247.594.678.738.927.113.195.96 1.063 1.46 1.494 2.292 1.981 5.661 4.519 7.524 5.668.34.21.403.267.466.416.087.21-.058.39-.315.39-.097 0-.268-.054-.709-.225-2.023-.786-3.084-1.094-4.37-1.27-.403-.056-1.467-.048-1.81.013a4.913 4.913 0 0 0-1.1.335c-.256.122-.59.336-.683.438l-.065.07h-1.875l.023-.127c.07-.379.16-.533.604-1.015.18-.196.38-.43.446-.522.503-.706.672-1.753.422-2.618-.396-1.37-1.902-2.448-3.573-2.558-.806-.053-1.473.067-2.124.38-.381.185-.71.42-1.024.735a4.06 4.06 0 0 0-.811 1.157c-.45.912-.588 1.575-.802 3.849a48.737 48.737 0 0 1-.267 2.424 23.399 23.399 0 0 1-1.393 5.33c-.388 1.01-.672 1.923-.833 2.68l-.063.3H.02z" paint-order="markers fill stroke"/><path fill="#fff" fill-rule="evenodd" stroke="#428f29" stroke-width=".006" d="M9.562 9.291a1.31 1.31 0 0 1-.674-.347 1.145 1.145 0 0 1 .337-1.855c.46-.218.987-.115 1.35.265.761.798.088 2.086-1.013 1.937Z" paint-order="markers fill stroke"/></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22"><g clip-path="url(#a)"><path fill="#000" fill-rule="evenodd" d="M2.157 3.714a12.067 12.067 0 0 0-.894-.97c-.074-.072-.01-.193.092-.175.798.143 1.857.029 3.016-.096 2.791-.302 6.163-.666 7.87 2.347.193.164.345.335.492.5.127.145.252.285.397.413 2.24 1.997 6.238 5.04 8.188 6.193.56.333.273.902-.316.67l-.15-.06c-2.285-.903-5.936-2.346-8.169-.69a6.748 6.748 0 0 1-.153.154h-1.894c.011-.139.039-.276.083-.411.096-.297.3-.506.512-.726l.012-.012c.397-.408.94-.966 1-2.208v-.001c.084-1.827-1.524-3.104-3.156-3.42-1.682-.326-3.839.247-4.744 2.852-.31.896-.41 1.986-.526 3.247v.005c-.189 2.054-.425 4.609-1.672 7.746-2.279 5.739-.979 10.848.401 16.254l.02.082c.474 1.864.96 3.773 1.31 5.758l.457-.982.116-.259c1.88-4.292 3.96-11.339 2.835-16.782-.347-1.677-.676-3.01-1.226-4.276-.089-.206-.022-.384.062-.444.093-.07.287-.013.495.167 1.083.931 2.062 2.71 2.387 4.207 1.284 5.918-.955 13.18-2.919 17.668a96.584 96.584 0 0 1 1.97 8.711c1.807-3.263 1.692-7.026.672-9.46a.853.853 0 0 1-.056-.48c.481-2.77 1.546-5.052 2.577-7.259l.008-.016c1.22-2.616 2.373-5.088 2.663-8.369A21.25 21.25 0 0 0 14 22h1.726c-.006.57-.035 1.154-.088 1.746a18.988 18.988 0 0 1-.508 2.981l2.383-1.372 1.152-2.669a.862.862 0 1 1 1.581.687l-1.285 2.95-.68 2.858a.864.864 0 0 1-1.678-.408l.256-1.052-1.707.981a9.086 9.086 0 0 0-.207.124c-.195.12-.418.256-.583.317-.47 1.248-1.014 2.416-1.55 3.566l-.005.011c-.994 2.129-1.935 4.143-2.393 6.572 1.579 4.038.696 9.211-2.184 12.674a.866.866 0 0 1-1.517-.41c-.428-2.567-.943-5.374-1.783-8.697a13.09 13.09 0 0 1-.86 1.424.86.86 0 0 1-.922.323.857.857 0 0 1-.633-.744c-.294-2.81-.978-5.503-1.642-8.107-1.452-5.687-2.818-11.059-.332-17.317 1.15-2.891 1.364-5.2 1.553-7.24l.003-.029.001-.015c.126-1.368.234-2.552.613-3.644.353-1.021.855-1.817 1.443-2.423l-.036-.007c-.885-.103-1.365-.666-1.961-1.366ZM9.83 9.32a1.177 1.177 0 0 1-.456-.056v.001a1.178 1.178 0 1 1 .736-2.237 1.177 1.177 0 0 1-.28 2.292Z" clip-rule="evenodd"/></g><path fill="#EA4A5A" fill-rule="evenodd" d="M13.089 17 10 20.089l.911.911L14 17.911 17.089 21l.911-.911L14.911 17 18 13.911 17.089 13 14 16.089 10.911 13l-.911.911L13.089 17Z" clip-rule="evenodd"/><defs><clipPath id="a"><path fill="#fff" d="M0 0h22v22H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22"><g clip-path="url(#a)"><path fill="#000" fill-rule="evenodd" d="M2.157 3.714a12.067 12.067 0 0 0-.894-.97c-.074-.072-.01-.193.092-.175.798.143 1.857.029 3.016-.096 2.791-.302 6.163-.666 7.87 2.347.193.164.345.335.492.5.127.145.252.285.397.413 2.24 1.997 6.238 5.04 8.188 6.193.56.333.273.902-.316.67l-.15-.06c-2.285-.903-5.936-2.346-8.169-.69a6.748 6.748 0 0 1-.153.154h-1.894c.011-.139.039-.276.083-.411.096-.297.3-.506.512-.726l.012-.012c.397-.408.94-.966 1-2.208v-.001c.084-1.827-1.524-3.104-3.156-3.42-1.682-.326-3.839.247-4.744 2.852-.31.896-.41 1.986-.526 3.247v.005c-.189 2.054-.425 4.609-1.672 7.746-2.279 5.739-.979 10.848.401 16.254l.02.082c.474 1.864.96 3.773 1.31 5.758l.457-.982.116-.259c1.88-4.292 3.96-11.339 2.835-16.782-.347-1.677-.676-3.01-1.226-4.276-.089-.206-.022-.384.062-.444.093-.07.287-.013.495.167 1.083.931 2.062 2.71 2.387 4.207 1.284 5.918-.955 13.18-2.919 17.668a96.584 96.584 0 0 1 1.97 8.711c1.807-3.263 1.692-7.026.672-9.46a.853.853 0 0 1-.056-.48c.481-2.77 1.546-5.052 2.577-7.259l.008-.016c1.22-2.616 2.373-5.088 2.663-8.369A21.25 21.25 0 0 0 14 22h1.726c-.006.57-.035 1.154-.088 1.746a18.988 18.988 0 0 1-.508 2.981l2.383-1.372 1.152-2.669a.862.862 0 1 1 1.581.687l-1.285 2.95-.68 2.858a.864.864 0 0 1-1.678-.408l.256-1.052-1.707.981a9.086 9.086 0 0 0-.207.124c-.195.12-.418.256-.583.317-.47 1.248-1.014 2.416-1.55 3.566l-.005.011c-.994 2.129-1.935 4.143-2.393 6.572 1.579 4.038.696 9.211-2.184 12.674a.866.866 0 0 1-1.517-.41c-.428-2.567-.943-5.374-1.783-8.697a13.09 13.09 0 0 1-.86 1.424.86.86 0 0 1-.922.323.857.857 0 0 1-.633-.744c-.294-2.81-.978-5.503-1.642-8.107-1.452-5.687-2.818-11.059-.332-17.317 1.15-2.891 1.364-5.2 1.553-7.24l.003-.029.001-.015c.126-1.368.234-2.552.613-3.644.353-1.021.855-1.817 1.443-2.423l-.036-.007c-.885-.103-1.365-.666-1.961-1.366ZM9.83 9.32a1.177 1.177 0 0 1-.456-.056v.001a1.178 1.178 0 1 1 .736-2.237 1.177 1.177 0 0 1-.28 2.292Z" clip-rule="evenodd"/></g><path fill="#F9C513" d="M14 21a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"/><defs><clipPath id="a"><path fill="#fff" d="M0 0h22v22H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22"><g clip-path="url(#a)"><path fill="#000" fill-rule="evenodd" d="M2.157 3.714a12.067 12.067 0 0 0-.894-.97c-.074-.072-.01-.193.092-.175.798.143 1.857.029 3.016-.096 2.791-.302 6.163-.666 7.87 2.347.193.164.345.335.492.5.127.145.252.285.397.413 2.24 1.997 6.238 5.04 8.188 6.193.56.333.273.902-.316.67l-.15-.06c-2.285-.903-5.936-2.346-8.169-.69a6.748 6.748 0 0 1-.153.154h-1.894c.011-.139.039-.276.083-.411.096-.297.3-.506.512-.726l.012-.012c.397-.408.94-.966 1-2.208v-.001c.084-1.827-1.524-3.104-3.156-3.42-1.682-.326-3.839.247-4.744 2.852-.31.896-.41 1.986-.526 3.247v.005c-.189 2.054-.425 4.609-1.672 7.746-2.279 5.739-.979 10.848.401 16.254l.02.082c.474 1.864.96 3.773 1.31 5.758l.457-.982.116-.259c1.88-4.292 3.96-11.339 2.835-16.782-.347-1.677-.676-3.01-1.226-4.276-.089-.206-.022-.384.062-.444.093-.07.287-.013.495.167 1.083.931 2.062 2.71 2.387 4.207 1.284 5.918-.955 13.18-2.919 17.668a96.584 96.584 0 0 1 1.97 8.711c1.807-3.263 1.692-7.026.672-9.46a.853.853 0 0 1-.056-.48c.481-2.77 1.546-5.052 2.577-7.259l.008-.016c1.22-2.616 2.373-5.088 2.663-8.369A21.25 21.25 0 0 0 14 22h1.726c-.006.57-.035 1.154-.088 1.746a18.988 18.988 0 0 1-.508 2.981l2.383-1.372 1.152-2.669a.862.862 0 1 1 1.581.687l-1.285 2.95-.68 2.858a.864.864 0 0 1-1.678-.408l.256-1.052-1.707.981a9.086 9.086 0 0 0-.207.124c-.195.12-.418.256-.583.317-.47 1.248-1.014 2.416-1.55 3.566l-.005.011c-.994 2.129-1.935 4.143-2.393 6.572 1.579 4.038.696 9.211-2.184 12.674a.866.866 0 0 1-1.517-.41c-.428-2.567-.943-5.374-1.783-8.697a13.09 13.09 0 0 1-.86 1.424.86.86 0 0 1-.922.323.857.857 0 0 1-.633-.744c-.294-2.81-.978-5.503-1.642-8.107-1.452-5.687-2.818-11.059-.332-17.317 1.15-2.891 1.364-5.2 1.553-7.24l.003-.029.001-.015c.126-1.368.234-2.552.613-3.644.353-1.021.855-1.817 1.443-2.423l-.036-.007c-.885-.103-1.365-.666-1.961-1.366ZM9.83 9.32a1.177 1.177 0 0 1-.456-.056v.001a1.178 1.178 0 1 1 .736-2.237 1.177 1.177 0 0 1-.28 2.292Z" clip-rule="evenodd"/></g><path fill="#34D058" fill-rule="evenodd" d="M19 13.974 13.04 21 10 17.416l.826-.974 2.214 2.61L18.174 13l.826.974Z" clip-rule="evenodd"/><defs><clipPath id="a"><path fill="#fff" d="M0 0h22v22H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -39,7 +39,7 @@ export default defineComponent({
const notifications = useNotifications();
// eslint-disable-next-line promise/prefer-await-to-callbacks
apiClient.setErrorHandler((err) => {
notifications.notify({ title: err.message || 'An unkown error occurred', type: 'error' });
notifications.notify({ title: err.message || 'An unknown error occurred', type: 'error' });
});
const blank = computed(() => route.meta.blank);

View file

@ -0,0 +1,54 @@
import { computed, ref, watch } from 'vue';
import { useDarkMode } from '~/compositions/useDarkMode';
import { BuildStatus } from '~/lib/api/types';
const darkMode = computed(() => (useDarkMode().darkMode.value ? 'dark' : 'light'));
type Status = 'default' | 'success' | 'pending' | 'error';
const faviconStatus = ref<Status>('default');
watch(
[darkMode, faviconStatus],
() => {
const faviconPNG = document.getElementById('favicon-png');
if (faviconPNG) {
(faviconPNG as HTMLLinkElement).href = `/favicons/favicon-${darkMode.value}-${faviconStatus.value}.png`;
}
const faviconSVG = document.getElementById('favicon-svg');
if (faviconSVG) {
(faviconSVG as HTMLLinkElement).href = `/favicons/favicon-${darkMode.value}-${faviconStatus.value}.svg`;
}
},
{ immediate: true },
);
function convertStatus(status: BuildStatus): Status {
if (['blocked', 'declined', 'error', 'failure', 'killed'].includes(status)) {
return 'error';
}
if (['started', 'running', 'pending'].includes(status)) {
return 'pending';
}
if (['success', 'declined', 'error', 'failure', 'killed'].includes(status)) {
return 'success';
}
// skipped
return 'default';
}
export function useFavicon() {
return {
updateStatus(status?: BuildStatus | 'default') {
if (status === undefined || status === 'default') {
faviconStatus.value = 'default';
} else {
faviconStatus.value = convertStatus(status);
}
},
};
}

View file

@ -1,4 +1,5 @@
import 'windi.css';
import '~/compositions/useFavicon';
import { createPinia } from 'pinia';
import { createApp } from 'vue';

View file

@ -69,7 +69,7 @@
</template>
<script lang="ts">
import { computed, defineComponent, inject, onMounted, PropType, Ref, toRef, watch } from 'vue';
import { computed, defineComponent, inject, onBeforeUnmount, onMounted, PropType, Ref, toRef, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import Button from '~/components/atomic/Button.vue';
@ -81,6 +81,7 @@ import BuildStatusIcon from '~/components/repo/build/BuildStatusIcon.vue';
import useApiClient from '~/compositions/useApiClient';
import { useAsyncAction } from '~/compositions/useAsyncAction';
import useBuild from '~/compositions/useBuild';
import { useFavicon } from '~/compositions/useFavicon';
import useNotifications from '~/compositions/useNotifications';
import { Repo, RepoPermissions } from '~/lib/api/types';
import BuildStore from '~/store/builds';
@ -131,6 +132,7 @@ export default defineComponent({
const router = useRouter();
const route = useRoute();
const notifications = useNotifications();
const favicon = useFavicon();
const buildStore = BuildStore();
const buildId = toRef(props, 'buildId');
@ -172,6 +174,8 @@ export default defineComponent({
}
await buildStore.loadBuild(repo.value.owner, repo.value.name, parseInt(buildId.value, 10));
favicon.updateStatus(build.value.status);
}
const { doSubmit: cancelBuild, isLoading: isCancelingBuild } = useAsyncAction(async () => {
@ -225,6 +229,9 @@ export default defineComponent({
onMounted(loadBuild);
watch([repo, buildId], loadBuild);
onBeforeUnmount(() => {
favicon.updateStatus('default');
});
return {
repoPermissions,