1
|
|
|
// Code generated by templ - DO NOT EDIT. |
2
|
|
|
|
3
|
|
|
// templ: version: v0.2.598 |
4
|
|
|
package partials |
5
|
|
|
|
6
|
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present. |
7
|
|
|
|
8
|
|
|
import "github.com/a-h/templ" |
9
|
|
|
import "context" |
10
|
|
|
import "io" |
11
|
|
|
import "bytes" |
12
|
|
|
|
13
|
|
|
func LogoImg() templ.Component { |
14
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
15
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
16
|
|
|
if !templ_7745c5c3_IsBuffer { |
17
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
18
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
19
|
|
|
} |
20
|
|
|
ctx = templ.InitializeContext(ctx) |
21
|
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
22
|
|
|
if templ_7745c5c3_Var1 == nil { |
23
|
|
|
templ_7745c5c3_Var1 = templ.NopComponent |
24
|
|
|
} |
25
|
|
|
ctx = templ.ClearChildren(ctx) |
26
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<picture><source media=\"(min-width: 768px)\" srcset=\"/static/img/memnix_80x80.avif\" type=\"image/avif\"> <source media=\"(min-width: 768px)\" srcset=\"/static/img/memnix_80x80.webp\" type=\"image/webp\"> <source media=\"(max-width: 767px)\" srcset=\"/static/img/memnix_64x64.avif\" type=\"image/avif\"> <source media=\"(max-width: 767px)\" srcset=\"/static/img/memnix_64x64.webp\" type=\"image/webp\"> <img src=\"/static/img/icon.png\" class=\"mx-auto h-14 w-14 md:h-20 md:w-20\" alt=\"Memnix app logo\" width=\"80\" height=\"80\"></picture>") |
27
|
|
|
if templ_7745c5c3_Err != nil { |
28
|
|
|
return templ_7745c5c3_Err |
29
|
|
|
} |
30
|
|
|
if !templ_7745c5c3_IsBuffer { |
31
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
32
|
|
|
} |
33
|
|
|
return templ_7745c5c3_Err |
34
|
|
|
}) |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
func Navbar(username string, fromProtected bool) templ.Component { |
38
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
39
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
40
|
|
|
if !templ_7745c5c3_IsBuffer { |
41
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
42
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
43
|
|
|
} |
44
|
|
|
ctx = templ.InitializeContext(ctx) |
45
|
|
|
templ_7745c5c3_Var2 := templ.GetChildren(ctx) |
46
|
|
|
if templ_7745c5c3_Var2 == nil { |
47
|
|
|
templ_7745c5c3_Var2 = templ.NopComponent |
48
|
|
|
} |
49
|
|
|
ctx = templ.ClearChildren(ctx) |
50
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<nav class=\"navbar transition-all md:px-5\" data-testid=\"navbar\"><div class=\"navbar-start\" data-testid=\"navbarStart\">") |
51
|
|
|
if templ_7745c5c3_Err != nil { |
52
|
|
|
return templ_7745c5c3_Err |
53
|
|
|
} |
54
|
|
|
templ_7745c5c3_Err = LogoImg().Render(ctx, templ_7745c5c3_Buffer) |
55
|
|
|
if templ_7745c5c3_Err != nil { |
56
|
|
|
return templ_7745c5c3_Err |
57
|
|
|
} |
58
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"navbar-center\" data-testid=\"navbarCenter\"><a hx-swap=\"transition:true\" href=\"/\" class=\"text-3xl font-bold\" preload>Memnix</a></div><div class=\"navbar-end\" data-testid=\"navbarEnd\">") |
59
|
|
|
if templ_7745c5c3_Err != nil { |
60
|
|
|
return templ_7745c5c3_Err |
61
|
|
|
} |
62
|
|
|
if fromProtected { |
63
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span class=\"font-bold text-indigo-700 mr-8\" data-testid=\"username\">") |
64
|
|
|
if templ_7745c5c3_Err != nil { |
65
|
|
|
return templ_7745c5c3_Err |
66
|
|
|
} |
67
|
|
|
var templ_7745c5c3_Var3 string |
68
|
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(username) |
69
|
|
|
if templ_7745c5c3_Err != nil { |
70
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/partials/navbar.partial.templ`, Line: 25, Col: 15} |
71
|
|
|
} |
72
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) |
73
|
|
|
if templ_7745c5c3_Err != nil { |
74
|
|
|
return templ_7745c5c3_Err |
75
|
|
|
} |
76
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span> <button hx-swap=\"transition:true\" hx-post=\"/todo/logout\" hx-confirm=\"Are you sure you want to log out?\" hx-target=\"body\" hx-push-url=\"true\" class=\"btn btn-ghost text-lg\" data-testid=\"logoutButton\">Logout</button>") |
77
|
|
|
if templ_7745c5c3_Err != nil { |
78
|
|
|
return templ_7745c5c3_Err |
79
|
|
|
} |
80
|
|
|
} else { |
81
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a preload hx-swap=\"transition:true\" data-testid=\"loginButton\" class=\"btn btn-primary text-lg\" href=\"/login\">Login</a>") |
82
|
|
|
if templ_7745c5c3_Err != nil { |
83
|
|
|
return templ_7745c5c3_Err |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></nav>") |
87
|
|
|
if templ_7745c5c3_Err != nil { |
88
|
|
|
return templ_7745c5c3_Err |
89
|
|
|
} |
90
|
|
|
if !templ_7745c5c3_IsBuffer { |
91
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
92
|
|
|
} |
93
|
|
|
return templ_7745c5c3_Err |
94
|
|
|
}) |
95
|
|
|
} |
96
|
|
|
|