Now worky

This commit is contained in:
Henri Burau
2024-06-04 14:49:57 +02:00
parent e2b9b8f176
commit b6555a1cc8
11 changed files with 58 additions and 6 deletions

View File

@ -10,6 +10,8 @@ import "context"
import "io"
import "bytes"
import "gitea.henriburau.de/haw-lan/cod4watcher/views"
func Nagivation() templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
@ -27,6 +29,21 @@ func Nagivation() templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if ctx.Value(views.PathContext) == "" || ctx.Value(views.PathContext) == "/" {
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
}