diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-10 01:28:11 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-10 01:28:11 +0200 |
commit | 9d02dc16a8a0fc420fad36ed4c61bfcc3ea1518c (patch) | |
tree | 10f9994918081f08840bd4c1da642218f4b6c621 | |
parent | 32fcd6f170e8d8c77936d477f4e489f03d079375 (diff) |
Do setting and theme toggling on the frontend
-rw-r--r-- | main.go | 35 | ||||
-rw-r--r-- | middleware/pipe.go | 14 | ||||
-rw-r--r-- | middleware/theme.go | 42 | ||||
-rw-r--r-- | templates/base.templ | 29 | ||||
-rw-r--r-- | templates/base_templ.go | 31 | ||||
-rw-r--r-- | templates/navbar.templ | 322 | ||||
-rw-r--r-- | templates/navbar_templ.go | 39 |
7 files changed, 203 insertions, 309 deletions
@@ -38,12 +38,8 @@ func main() { mux.Handle("GET /favicon.ico", fs) mux.Handle("GET /fonts/", fs) mux.Handle("GET /style.css", fs) - mux.Handle("GET /", middleware.Pipe( - middleware.Theme, - middleware.I18n, - )(http.HandlerFunc(finalHandler))) + mux.Handle("GET /", middleware.I18n(http.HandlerFunc(finalHandler))) mux.Handle("POST /language", http.HandlerFunc(setUserLanguage)) - mux.Handle("POST /theme", http.HandlerFunc(setUserTheme)) portStr := ":" + strconv.Itoa(*port) log.Println("Listening on", portStr) @@ -101,32 +97,3 @@ func setUserLanguage(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, c.Value, http.StatusFound) } } - -func setUserTheme(w http.ResponseWriter, r *http.Request) { - c, err := r.Cookie("theme") - if errors.Is(err, http.ErrNoCookie) { - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(w, "No ‘theme’ cookie exists") - return - } - - var theme string - - switch c.Value { - case "dark": - theme = "light" - case "light": - theme = "dark" - default: - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(w, "Theme ‘%s’ is invalid", c.Value) - return - } - - http.SetCookie(w, &http.Cookie{ - Name: "theme", - Value: theme, - MaxAge: math.MaxInt32, - }) - http.Redirect(w, r, r.Referer(), http.StatusFound) -} diff --git a/middleware/pipe.go b/middleware/pipe.go deleted file mode 100644 index 4b5064d..0000000 --- a/middleware/pipe.go +++ /dev/null @@ -1,14 +0,0 @@ -package middleware - -import "net/http" - -type Middleware func(http.Handler) http.Handler - -func Pipe(xs ...Middleware) Middleware { - return func(next http.Handler) http.Handler { - for i := len(xs) - 1; i >= 0; i-- { - next = xs[i](next) - } - return next - } -} diff --git a/middleware/theme.go b/middleware/theme.go deleted file mode 100644 index 4f14c97..0000000 --- a/middleware/theme.go +++ /dev/null @@ -1,42 +0,0 @@ -package middleware - -import ( - "cmp" - "context" - "math" - "net/http" -) - -const defaultTheme = "dark" - -func Theme(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - var userTheme string - - /* Grab the ‘theme’ cookie to figure out what the users current - theme is and add it to the context. If the user doesn’t yet - have a theme cookie or the cookie they have contains an - invalid theme then we fallback to the default theme and - (re)set the cookie. */ - - c, err := r.Cookie("theme") - if err == nil { - switch c.Value { - case "dark", "light": - userTheme = c.Value - } - } - - theme := cmp.Or(userTheme, defaultTheme) - if userTheme == "" { - http.SetCookie(w, &http.Cookie{ - Name: "theme", - Value: theme, - MaxAge: math.MaxInt32, - }) - } - - ctx := context.WithValue(r.Context(), "theme", theme) - next.ServeHTTP(w, r.WithContext(ctx)) - }) -} diff --git a/templates/base.templ b/templates/base.templ index 88a9e77..e6c4a1d 100644 --- a/templates/base.templ +++ b/templates/base.templ @@ -5,12 +5,39 @@ import "git.thomasvoss.com/euro-cash.eu/i18n" templ Base(head, body templ.Component) { {{ p := ctx.Value("printer").(i18n.Printer) }} <!DOCTYPE html> - <html lang={ p.Locale.Bcp } data-theme={ ctx.Value("theme").(string) }> + <html lang={ p.Locale.Bcp }> <head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <link rel="stylesheet" type="text/css" href="/style.css"/> <title>Euro Cash</title> + <script type="text/javascript"> + const validate = theme => + ["light", "dark"].includes(theme) ? theme : "light"; + + const toggle = theme => + theme == "light" ? "dark" : "light"; + + const setTheme = theme => { + localStorage.setItem("theme", theme); + document + .getElementsByTagName("html")[0] + .setAttribute("data-theme", theme); + document + .getElementById(`nav-icon-theme-${theme}`) + .style.display = ''; + document + .getElementById(`nav-icon-theme-${toggle(theme)}`) + .style.display = 'none'; + }; + + document.addEventListener('DOMContentLoaded', _ => { + document.getElementById("theme-button").onclick = () => { + setTheme(toggle(validate(localStorage.getItem("theme")))); + }; + setTheme(validate(localStorage.getItem("theme"))); + }); + </script> if head != nil { @head } diff --git a/templates/base_templ.go b/templates/base_templ.go index 2bc2034..399b577 100644 --- a/templates/base_templ.go +++ b/templates/base_templ.go @@ -42,20 +42,7 @@ func Base(head, body templ.Component) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" data-theme=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var3 string - templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(ctx.Value("theme").(string)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `base.templ`, Line: 8, Col: 69} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\"><title>Euro Cash</title>") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\"><title>Euro Cash</title><script type=\"text/javascript\">\n\t\t\t\tconst validate = theme =>\n\t\t\t\t\t[\"light\", \"dark\"].includes(theme) ? theme : \"light\";\n\n\t\t\t\tconst toggle = theme =>\n\t\t\t\t\ttheme == \"light\" ? \"dark\" : \"light\";\n\n\t\t\t\tconst setTheme = theme => {\n\t\t\t\t\tlocalStorage.setItem(\"theme\", theme);\n\t\t\t\t\tdocument\n\t\t\t\t\t\t.getElementsByTagName(\"html\")[0]\n\t\t\t\t\t\t.setAttribute(\"data-theme\", theme);\n\t\t\t\t\tdocument\n\t\t\t\t\t\t.getElementById(`nav-icon-theme-${theme}`)\n\t\t\t\t\t\t.style.display = '';\n\t\t\t\t\tdocument\n\t\t\t\t\t\t.getElementById(`nav-icon-theme-${toggle(theme)}`)\n\t\t\t\t\t\t.style.display = 'none';\n\t\t\t\t};\n\n\t\t\t\tdocument.addEventListener('DOMContentLoaded', _ => {\n\t\t\t\t\tdocument.getElementById(\"theme-button\").onclick = () => {\n\t\t\t\t\t\tsetTheme(toggle(validate(localStorage.getItem(\"theme\"))));\n\t\t\t\t\t};\n\t\t\t\t\tsetTheme(validate(localStorage.getItem(\"theme\")));\n\t\t\t\t});\n\t\t\t</script>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -79,12 +66,12 @@ func Base(head, body templ.Component) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(p.T("Found a mistake or want to contribute missing information?")) + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(p.T("Found a mistake or want to contribute missing information?")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `base.templ`, Line: 25, Col: 73} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `base.templ`, Line: 52, Col: 73} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -92,12 +79,12 @@ func Base(head, body templ.Component) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(p.T("Feel free to contact us!")) + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(p.T("Feel free to contact us!")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `base.templ`, Line: 26, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `base.templ`, Line: 53, Col: 51} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/templates/navbar.templ b/templates/navbar.templ index dd34d4b..f0b030c 100644 --- a/templates/navbar.templ +++ b/templates/navbar.templ @@ -67,164 +67,170 @@ templ navbar() { </a> </li> <li id="nav-icon-theme"> - <form class={ noMargin() } action="/theme" method="POST"> - <button> - <svg - version="1.1" - width="24" - height="24" - viewBox="0 0 24 24" - fill="none" - xmlns="http://www.w3.org/2000/svg" - > - if ctx.Value("theme").(string) == "dark" { - <path - d="M 7.28451 10.3333 - C 7.10026 10.8546 - 7 11.4156 - 7 12 - C 7 14.7614 - 9.23858 17 - 12 17 - C 14.7614 17 - 17 14.7614 - 17 12 - C 17 9.23858 - 14.7614 7 - 12 7 - C 11.4156 7 - 10.8546 7.10026 - 10.3333 7.28451" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 12 2 V 4" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 12 20 V 22" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 4 12 L 2 12" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 22 12 L 20 12" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 19.7778 4.22266 L 17.5558 6.25424" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 4.22217 4.22266 L 6.44418 6.25424" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 6.44434 17.5557 L 4.22211 19.7779" - stroke-width="1.5" - stroke-linecap="round" - ></path> - <path - d="M 19.7778 19.7773 L 17.5558 17.5551" - stroke-width="1.5" - stroke-linecap="round" - ></path> - } else { - <path - d="M 21.0672 11.8568 - L 20.4253 11.469 - L 21.0672 11.8568 - Z - M 12.1432 2.93276 - L 11.7553 2.29085 - V 2.29085 - L 12.1432 2.93276 - Z - M 7.37554 20.013 - C 7.017 19.8056 6.5582 19.9281 6.3508 20.2866 - C 6.14339 20.6452 6.26591 21.104 6.62446 21.3114 - L 7.37554 20.013 - Z - M 2.68862 17.3755 - C 2.89602 17.7341 3.35482 17.8566 3.71337 17.6492 - C 4.07191 17.4418 4.19443 16.983 3.98703 16.6245 - L 2.68862 17.3755 - Z - M 21.25 12 - C 21.25 17.1086 17.1086 21.25 12 21.25 - V 22.75 - C 17.9371 22.75 22.75 17.9371 22.75 12 - H 21.25 - Z - M 2.75 12 - C 2.75 6.89137 6.89137 2.75 12 2.75 - V 1.25 - C 6.06294 1.25 1.25 6.06294 1.25 12 - H 2.75 - Z - M 15.5 14.25 - C 12.3244 14.25 9.75 11.6756 9.75 8.5 - H 8.25 - C 8.25 12.5041 11.4959 15.75 15.5 15.75 - V 14.25 - Z - M 20.4253 11.469 - C 19.4172 13.1373 17.5882 14.25 15.5 14.25 - V 15.75 - C 18.1349 15.75 20.4407 14.3439 21.7092 12.2447 - L 20.4253 11.469 - Z - M 9.75 8.5 - C 9.75 6.41182 10.8627 4.5828 12.531 3.57467 - L 11.7553 2.29085 - C 9.65609 3.5593 8.25 5.86509 8.25 8.5 - H 9.75 - Z - M 12 2.75 - C 11.9115 2.75 11.8077 2.71008 11.7324 2.63168 - C 11.6686 2.56527 11.6538 2.50244 11.6503 2.47703 - C 11.6461 2.44587 11.6482 2.35557 11.7553 2.29085 - L 12.531 3.57467 - C 13.0342 3.27065 13.196 2.71398 13.1368 2.27627 - C 13.0754 1.82126 12.7166 1.25 12 1.25 - V 2.75 - Z - M 21.7092 12.2447 - C 21.6444 12.3518 21.5541 12.3539 21.523 12.3497 - C 21.4976 12.3462 21.4347 12.3314 21.3683 12.2676 - C 21.2899 12.1923 21.25 12.0885 21.25 12 - H 22.75 - C 22.75 11.2834 22.1787 10.9246 21.7237 10.8632 - C 21.286 10.804 20.7293 10.9658 20.4253 11.469 - L 21.7092 12.2447 - Z - M 12 21.25 - C 10.3139 21.25 8.73533 20.7996 7.37554 20.013 - L 6.62446 21.3114 - C 8.2064 22.2265 10.0432 22.75 12 22.75 - V 21.25 - Z - M 3.98703 16.6245 - C 3.20043 15.2647 2.75 13.6861 2.75 12 - H 1.25 - C 1.25 13.9568 1.77351 15.7936 2.68862 17.3755 - L 3.98703 16.6245 - Z - " - ></path> - } - </svg> - </button> - </form> + <button id="theme-button"> + <svg + id="nav-icon-theme-dark" + version="1.1" + width="24" + height="24" + viewBox="0 0 24 24" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M 7.28451 10.3333 + C 7.10026 10.8546 + 7 11.4156 + 7 12 + C 7 14.7614 + 9.23858 17 + 12 17 + C 14.7614 17 + 17 14.7614 + 17 12 + C 17 9.23858 + 14.7614 7 + 12 7 + C 11.4156 7 + 10.8546 7.10026 + 10.3333 7.28451" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 12 2 V 4" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 12 20 V 22" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 4 12 L 2 12" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 22 12 L 20 12" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 19.7778 4.22266 L 17.5558 6.25424" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 4.22217 4.22266 L 6.44418 6.25424" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 6.44434 17.5557 L 4.22211 19.7779" + stroke-width="1.5" + stroke-linecap="round" + ></path> + <path + d="M 19.7778 19.7773 L 17.5558 17.5551" + stroke-width="1.5" + stroke-linecap="round" + ></path> + </svg> + <svg + id="nav-icon-theme-light" + version="1.1" + width="24" + height="24" + viewBox="0 0 24 24" + fill="none" + xmlns="http://www.w3.org/2000/svg" + > + <path + d="M 21.0672 11.8568 + L 20.4253 11.469 + L 21.0672 11.8568 + Z + M 12.1432 2.93276 + L 11.7553 2.29085 + V 2.29085 + L 12.1432 2.93276 + Z + M 7.37554 20.013 + C 7.017 19.8056 6.5582 19.9281 6.3508 20.2866 + C 6.14339 20.6452 6.26591 21.104 6.62446 21.3114 + L 7.37554 20.013 + Z + M 2.68862 17.3755 + C 2.89602 17.7341 3.35482 17.8566 3.71337 17.6492 + C 4.07191 17.4418 4.19443 16.983 3.98703 16.6245 + L 2.68862 17.3755 + Z + M 21.25 12 + C 21.25 17.1086 17.1086 21.25 12 21.25 + V 22.75 + C 17.9371 22.75 22.75 17.9371 22.75 12 + H 21.25 + Z + M 2.75 12 + C 2.75 6.89137 6.89137 2.75 12 2.75 + V 1.25 + C 6.06294 1.25 1.25 6.06294 1.25 12 + H 2.75 + Z + M 15.5 14.25 + C 12.3244 14.25 9.75 11.6756 9.75 8.5 + H 8.25 + C 8.25 12.5041 11.4959 15.75 15.5 15.75 + V 14.25 + Z + M 20.4253 11.469 + C 19.4172 13.1373 17.5882 14.25 15.5 14.25 + V 15.75 + C 18.1349 15.75 20.4407 14.3439 21.7092 12.2447 + L 20.4253 11.469 + Z + M 9.75 8.5 + C 9.75 6.41182 10.8627 4.5828 12.531 3.57467 + L 11.7553 2.29085 + C 9.65609 3.5593 8.25 5.86509 8.25 8.5 + H 9.75 + Z + M 12 2.75 + C 11.9115 2.75 11.8077 2.71008 11.7324 2.63168 + C 11.6686 2.56527 11.6538 2.50244 11.6503 2.47703 + C 11.6461 2.44587 11.6482 2.35557 11.7553 2.29085 + L 12.531 3.57467 + C 13.0342 3.27065 13.196 2.71398 13.1368 2.27627 + C 13.0754 1.82126 12.7166 1.25 12 1.25 + V 2.75 + Z + M 21.7092 12.2447 + C 21.6444 12.3518 21.5541 12.3539 21.523 12.3497 + C 21.4976 12.3462 21.4347 12.3314 21.3683 12.2676 + C 21.2899 12.1923 21.25 12.0885 21.25 12 + H 22.75 + C 22.75 11.2834 22.1787 10.9246 21.7237 10.8632 + C 21.286 10.804 20.7293 10.9658 20.4253 11.469 + L 21.7092 12.2447 + Z + M 12 21.25 + C 10.3139 21.25 8.73533 20.7996 7.37554 20.013 + L 6.62446 21.3114 + C 8.2064 22.2265 10.0432 22.75 12 22.75 + V 21.25 + Z + M 3.98703 16.6245 + C 3.20043 15.2647 2.75 13.6861 2.75 12 + H 1.25 + C 1.25 13.9568 1.77351 15.7936 2.68862 17.3755 + L 3.98703 16.6245 + Z + " + ></path> + </svg> + </button> </li> </menu> </nav> diff --git a/templates/navbar_templ.go b/templates/navbar_templ.go index 3674775..96aea3a 100644 --- a/templates/navbar_templ.go +++ b/templates/navbar_templ.go @@ -146,44 +146,7 @@ func navbar() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li><li id=\"nav-icon-theme\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var11 = []any{noMargin()} - templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var11...) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form class=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var12 string - templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var11).String()) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `navbar.templ`, Line: 1, Col: 0} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" action=\"/theme\" method=\"POST\"><button><svg version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if ctx.Value("theme").(string) == "dark" { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<path d=\"M 7.28451 10.3333\n\t\t\t\t\t\t\t\t\t C 7.10026 10.8546\n\t\t\t\t\t\t\t\t\t\t 7 11.4156\n\t\t\t\t\t\t\t\t\t\t 7 12\n\t\t\t\t\t\t\t\t\t C 7 14.7614\n\t\t\t\t\t\t\t\t\t\t 9.23858 17\n\t\t\t\t\t\t\t\t\t\t 12 17\n\t\t\t\t\t\t\t\t\t C 14.7614 17\n\t\t\t\t\t\t\t\t\t\t 17 14.7614\n\t\t\t\t\t\t\t\t\t\t 17 12\n\t\t\t\t\t\t\t\t\t C 17 9.23858\n\t\t\t\t\t\t\t\t\t\t 14.7614 7\n\t\t\t\t\t\t\t\t\t\t 12 7\n\t\t\t\t\t\t\t\t\t C 11.4156 7\n\t\t\t\t\t\t\t\t\t\t 10.8546 7.10026\n\t\t\t\t\t\t\t\t\t\t 10.3333 7.28451\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 12 2 V 4\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 12 20 V 22\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 4 12 L 2 12\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 22 12 L 20 12\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 19.7778 4.22266 L 17.5558 6.25424\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 4.22217 4.22266 L 6.44418 6.25424\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 6.44434 17.5557 L 4.22211 19.7779\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 19.7778 19.7773 L 17.5558 17.5551\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } else { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<path d=\"M 21.0672 11.8568\n\t\t\t\t\t\t\t\t\t\t L 20.4253 11.469\n\t\t\t\t\t\t\t\t\t\t L 21.0672 11.8568\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 12.1432 2.93276\n\t\t\t\t\t\t\t\t\t\t L 11.7553 2.29085\n\t\t\t\t\t\t\t\t\t\t V 2.29085\n\t\t\t\t\t\t\t\t\t\t L 12.1432 2.93276\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 7.37554 20.013\n\t\t\t\t\t\t\t\t\t\t C 7.017 19.8056 6.5582 19.9281 6.3508 20.2866\n\t\t\t\t\t\t\t\t\t\t C 6.14339 20.6452 6.26591 21.104 6.62446 21.3114\n\t\t\t\t\t\t\t\t\t\t L 7.37554 20.013\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 2.68862 17.3755\n\t\t\t\t\t\t\t\t\t\t C 2.89602 17.7341 3.35482 17.8566 3.71337 17.6492\n\t\t\t\t\t\t\t\t\t\t C 4.07191 17.4418 4.19443 16.983 3.98703 16.6245\n\t\t\t\t\t\t\t\t\t\t L 2.68862 17.3755\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 21.25 12\n\t\t\t\t\t\t\t\t\t\t C 21.25 17.1086 17.1086 21.25 12 21.25\n\t\t\t\t\t\t\t\t\t\t V 22.75\n\t\t\t\t\t\t\t\t\t\t C 17.9371 22.75 22.75 17.9371 22.75 12\n\t\t\t\t\t\t\t\t\t\t H 21.25\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 2.75 12\n\t\t\t\t\t\t\t\t\t\t C 2.75 6.89137 6.89137 2.75 12 2.75\n\t\t\t\t\t\t\t\t\t\t V 1.25\n\t\t\t\t\t\t\t\t\t\t C 6.06294 1.25 1.25 6.06294 1.25 12\n\t\t\t\t\t\t\t\t\t\t H 2.75\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 15.5 14.25\n\t\t\t\t\t\t\t\t\t\t C 12.3244 14.25 9.75 11.6756 9.75 8.5\n\t\t\t\t\t\t\t\t\t\t H 8.25\n\t\t\t\t\t\t\t\t\t\t C 8.25 12.5041 11.4959 15.75 15.5 15.75\n\t\t\t\t\t\t\t\t\t\t V 14.25\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 20.4253 11.469\n\t\t\t\t\t\t\t\t\t\t C 19.4172 13.1373 17.5882 14.25 15.5 14.25\n\t\t\t\t\t\t\t\t\t\t V 15.75\n\t\t\t\t\t\t\t\t\t\t C 18.1349 15.75 20.4407 14.3439 21.7092 12.2447\n\t\t\t\t\t\t\t\t\t\t L 20.4253 11.469\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 9.75 8.5\n\t\t\t\t\t\t\t\t\t\t C 9.75 6.41182 10.8627 4.5828 12.531 3.57467\n\t\t\t\t\t\t\t\t\t\t L 11.7553 2.29085\n\t\t\t\t\t\t\t\t\t\t C 9.65609 3.5593 8.25 5.86509 8.25 8.5\n\t\t\t\t\t\t\t\t\t\t H 9.75\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 12 2.75\n\t\t\t\t\t\t\t\t\t\t C 11.9115 2.75 11.8077 2.71008 11.7324 2.63168\n\t\t\t\t\t\t\t\t\t\t C 11.6686 2.56527 11.6538 2.50244 11.6503 2.47703\n\t\t\t\t\t\t\t\t\t\t C 11.6461 2.44587 11.6482 2.35557 11.7553 2.29085\n\t\t\t\t\t\t\t\t\t\t L 12.531 3.57467\n\t\t\t\t\t\t\t\t\t\t C 13.0342 3.27065 13.196 2.71398 13.1368 2.27627\n\t\t\t\t\t\t\t\t\t\t C 13.0754 1.82126 12.7166 1.25 12 1.25\n\t\t\t\t\t\t\t\t\t\t V 2.75\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 21.7092 12.2447\n\t\t\t\t\t\t\t\t\t\t C 21.6444 12.3518 21.5541 12.3539 21.523 12.3497\n\t\t\t\t\t\t\t\t\t\t C 21.4976 12.3462 21.4347 12.3314 21.3683 12.2676\n\t\t\t\t\t\t\t\t\t\t C 21.2899 12.1923 21.25 12.0885 21.25 12\n\t\t\t\t\t\t\t\t\t\t H 22.75\n\t\t\t\t\t\t\t\t\t\t C 22.75 11.2834 22.1787 10.9246 21.7237 10.8632\n\t\t\t\t\t\t\t\t\t\t C 21.286 10.804 20.7293 10.9658 20.4253 11.469\n\t\t\t\t\t\t\t\t\t\t L 21.7092 12.2447\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 12 21.25\n\t\t\t\t\t\t\t\t\t\t C 10.3139 21.25 8.73533 20.7996 7.37554 20.013\n\t\t\t\t\t\t\t\t\t\t L 6.62446 21.3114\n\t\t\t\t\t\t\t\t\t\t C 8.2064 22.2265 10.0432 22.75 12 22.75\n\t\t\t\t\t\t\t\t\t\t V 21.25\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t\t M 3.98703 16.6245\n\t\t\t\t\t\t\t\t\t\t C 3.20043 15.2647 2.75 13.6861 2.75 12\n\t\t\t\t\t\t\t\t\t\t H 1.25\n\t\t\t\t\t\t\t\t\t\t C 1.25 13.9568 1.77351 15.7936 2.68862 17.3755\n\t\t\t\t\t\t\t\t\t\t L 3.98703 16.6245\n\t\t\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t\t \"></path>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</svg></button></form></li></menu></nav>") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li><li id=\"nav-icon-theme\"><button id=\"theme-button\"><svg id=\"nav-icon-theme-dark\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.28451 10.3333\n\t\t\t\t\t\t\t C 7.10026 10.8546\n\t\t\t\t\t\t\t\t 7 11.4156\n\t\t\t\t\t\t\t\t 7 12\n\t\t\t\t\t\t\t C 7 14.7614\n\t\t\t\t\t\t\t\t 9.23858 17\n\t\t\t\t\t\t\t\t 12 17\n\t\t\t\t\t\t\t C 14.7614 17\n\t\t\t\t\t\t\t\t 17 14.7614\n\t\t\t\t\t\t\t\t 17 12\n\t\t\t\t\t\t\t C 17 9.23858\n\t\t\t\t\t\t\t\t 14.7614 7\n\t\t\t\t\t\t\t\t 12 7\n\t\t\t\t\t\t\t C 11.4156 7\n\t\t\t\t\t\t\t\t 10.8546 7.10026\n\t\t\t\t\t\t\t\t 10.3333 7.28451\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 12 2 V 4\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 12 20 V 22\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 4 12 L 2 12\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 22 12 L 20 12\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 19.7778 4.22266 L 17.5558 6.25424\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 4.22217 4.22266 L 6.44418 6.25424\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 6.44434 17.5557 L 4.22211 19.7779\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M 19.7778 19.7773 L 17.5558 17.5551\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></svg> <svg id=\"nav-icon-theme-light\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 21.0672 11.8568\n\t\t\t\t\t\t\t\t L 20.4253 11.469\n\t\t\t\t\t\t\t\t L 21.0672 11.8568\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 12.1432 2.93276\n\t\t\t\t\t\t\t\t L 11.7553 2.29085\n\t\t\t\t\t\t\t\t V 2.29085\n\t\t\t\t\t\t\t\t L 12.1432 2.93276\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 7.37554 20.013\n\t\t\t\t\t\t\t\t C 7.017 19.8056 6.5582 19.9281 6.3508 20.2866\n\t\t\t\t\t\t\t\t C 6.14339 20.6452 6.26591 21.104 6.62446 21.3114\n\t\t\t\t\t\t\t\t L 7.37554 20.013\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 2.68862 17.3755\n\t\t\t\t\t\t\t\t C 2.89602 17.7341 3.35482 17.8566 3.71337 17.6492\n\t\t\t\t\t\t\t\t C 4.07191 17.4418 4.19443 16.983 3.98703 16.6245\n\t\t\t\t\t\t\t\t L 2.68862 17.3755\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 21.25 12\n\t\t\t\t\t\t\t\t C 21.25 17.1086 17.1086 21.25 12 21.25\n\t\t\t\t\t\t\t\t V 22.75\n\t\t\t\t\t\t\t\t C 17.9371 22.75 22.75 17.9371 22.75 12\n\t\t\t\t\t\t\t\t H 21.25\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 2.75 12\n\t\t\t\t\t\t\t\t C 2.75 6.89137 6.89137 2.75 12 2.75\n\t\t\t\t\t\t\t\t V 1.25\n\t\t\t\t\t\t\t\t C 6.06294 1.25 1.25 6.06294 1.25 12\n\t\t\t\t\t\t\t\t H 2.75\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 15.5 14.25\n\t\t\t\t\t\t\t\t C 12.3244 14.25 9.75 11.6756 9.75 8.5\n\t\t\t\t\t\t\t\t H 8.25\n\t\t\t\t\t\t\t\t C 8.25 12.5041 11.4959 15.75 15.5 15.75\n\t\t\t\t\t\t\t\t V 14.25\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 20.4253 11.469\n\t\t\t\t\t\t\t\t C 19.4172 13.1373 17.5882 14.25 15.5 14.25\n\t\t\t\t\t\t\t\t V 15.75\n\t\t\t\t\t\t\t\t C 18.1349 15.75 20.4407 14.3439 21.7092 12.2447\n\t\t\t\t\t\t\t\t L 20.4253 11.469\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 9.75 8.5\n\t\t\t\t\t\t\t\t C 9.75 6.41182 10.8627 4.5828 12.531 3.57467\n\t\t\t\t\t\t\t\t L 11.7553 2.29085\n\t\t\t\t\t\t\t\t C 9.65609 3.5593 8.25 5.86509 8.25 8.5\n\t\t\t\t\t\t\t\t H 9.75\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 12 2.75\n\t\t\t\t\t\t\t\t C 11.9115 2.75 11.8077 2.71008 11.7324 2.63168\n\t\t\t\t\t\t\t\t C 11.6686 2.56527 11.6538 2.50244 11.6503 2.47703\n\t\t\t\t\t\t\t\t C 11.6461 2.44587 11.6482 2.35557 11.7553 2.29085\n\t\t\t\t\t\t\t\t L 12.531 3.57467\n\t\t\t\t\t\t\t\t C 13.0342 3.27065 13.196 2.71398 13.1368 2.27627\n\t\t\t\t\t\t\t\t C 13.0754 1.82126 12.7166 1.25 12 1.25\n\t\t\t\t\t\t\t\t V 2.75\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 21.7092 12.2447\n\t\t\t\t\t\t\t\t C 21.6444 12.3518 21.5541 12.3539 21.523 12.3497\n\t\t\t\t\t\t\t\t C 21.4976 12.3462 21.4347 12.3314 21.3683 12.2676\n\t\t\t\t\t\t\t\t C 21.2899 12.1923 21.25 12.0885 21.25 12\n\t\t\t\t\t\t\t\t H 22.75\n\t\t\t\t\t\t\t\t C 22.75 11.2834 22.1787 10.9246 21.7237 10.8632\n\t\t\t\t\t\t\t\t C 21.286 10.804 20.7293 10.9658 20.4253 11.469\n\t\t\t\t\t\t\t\t L 21.7092 12.2447\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 12 21.25\n\t\t\t\t\t\t\t\t C 10.3139 21.25 8.73533 20.7996 7.37554 20.013\n\t\t\t\t\t\t\t\t L 6.62446 21.3114\n\t\t\t\t\t\t\t\t C 8.2064 22.2265 10.0432 22.75 12 22.75\n\t\t\t\t\t\t\t\t V 21.25\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t\t M 3.98703 16.6245\n\t\t\t\t\t\t\t\t C 3.20043 15.2647 2.75 13.6861 2.75 12\n\t\t\t\t\t\t\t\t H 1.25\n\t\t\t\t\t\t\t\t C 1.25 13.9568 1.77351 15.7936 2.68862 17.3755\n\t\t\t\t\t\t\t\t L 3.98703 16.6245\n\t\t\t\t\t\t\t\t Z\n\t\t\t\t\t\t\t \"></path></svg></button></li></menu></nav>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } |