From 9d02dc16a8a0fc420fad36ed4c61bfcc3ea1518c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 10 Aug 2024 01:28:11 +0200 Subject: Do setting and theme toggling on the frontend --- templates/base.templ | 29 ++++- templates/base_templ.go | 31 ++--- templates/navbar.templ | 322 +++++++++++++++++++++++----------------------- templates/navbar_templ.go | 39 +----- 4 files changed, 202 insertions(+), 219 deletions(-) (limited to 'templates') 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) }} - + Euro Cash + 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("\">Euro Cash") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Euro Cash") 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() { 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("
  • ") - 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("
  • ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } -- cgit v1.2.3