1
|
|
|
// Code generated by templ - DO NOT EDIT. |
2
|
|
|
|
3
|
|
|
// templ: version: v0.2.663 |
4
|
|
|
package page |
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
|
|
|
import "github.com/memnix/memnix-rest/app/v2/views/layout" |
14
|
|
|
import "github.com/memnix/memnix-rest/domain" |
15
|
|
|
|
16
|
|
|
func hello(name string) templ.Component { |
17
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
18
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
19
|
|
|
if !templ_7745c5c3_IsBuffer { |
20
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
21
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
22
|
|
|
} |
23
|
|
|
ctx = templ.InitializeContext(ctx) |
24
|
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
25
|
|
|
if templ_7745c5c3_Var1 == nil { |
26
|
|
|
templ_7745c5c3_Var1 = templ.NopComponent |
27
|
|
|
} |
28
|
|
|
ctx = templ.ClearChildren(ctx) |
29
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col\" data-testid=\"helloComponent\"><h1 class=\"mx-auto\" data-testid=\"helloH1\">Hello, ") |
30
|
|
|
if templ_7745c5c3_Err != nil { |
31
|
|
|
return templ_7745c5c3_Err |
32
|
|
|
} |
33
|
|
|
var templ_7745c5c3_Var2 string |
34
|
|
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name) |
35
|
|
|
if templ_7745c5c3_Err != nil { |
36
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/page/index.page.templ`, Line: 8, Col: 57} |
37
|
|
|
} |
38
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) |
39
|
|
|
if templ_7745c5c3_Err != nil { |
40
|
|
|
return templ_7745c5c3_Err |
41
|
|
|
} |
42
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" !</h1><h2 class=\"mx-auto \">Banana !</h2><button hx-post=\"/clicked\" hx-trigger=\"click\" hx-swap=\"outerHTML\">Click Me!</button></div>") |
43
|
|
|
if templ_7745c5c3_Err != nil { |
44
|
|
|
return templ_7745c5c3_Err |
45
|
|
|
} |
46
|
|
|
if !templ_7745c5c3_IsBuffer { |
47
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
48
|
|
|
} |
49
|
|
|
return templ_7745c5c3_Err |
50
|
|
|
}) |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
func Clicked() templ.Component { |
54
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
55
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
56
|
|
|
if !templ_7745c5c3_IsBuffer { |
57
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
58
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
59
|
|
|
} |
60
|
|
|
ctx = templ.InitializeContext(ctx) |
61
|
|
|
templ_7745c5c3_Var3 := templ.GetChildren(ctx) |
62
|
|
|
if templ_7745c5c3_Var3 == nil { |
63
|
|
|
templ_7745c5c3_Var3 = templ.NopComponent |
64
|
|
|
} |
65
|
|
|
ctx = templ.ClearChildren(ctx) |
66
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"parent-div\" class=\"flex flex-col\"><p class=\"mx-auto \">Clicked!</p></div>") |
67
|
|
|
if templ_7745c5c3_Err != nil { |
68
|
|
|
return templ_7745c5c3_Err |
69
|
|
|
} |
70
|
|
|
if !templ_7745c5c3_IsBuffer { |
71
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
72
|
|
|
} |
73
|
|
|
return templ_7745c5c3_Err |
74
|
|
|
}) |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
func heroImage() templ.Component { |
78
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
79
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
80
|
|
|
if !templ_7745c5c3_IsBuffer { |
81
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
82
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
83
|
|
|
} |
84
|
|
|
ctx = templ.InitializeContext(ctx) |
85
|
|
|
templ_7745c5c3_Var4 := templ.GetChildren(ctx) |
86
|
|
|
if templ_7745c5c3_Var4 == nil { |
87
|
|
|
templ_7745c5c3_Var4 = templ.NopComponent |
88
|
|
|
} |
89
|
|
|
ctx = templ.ClearChildren(ctx) |
90
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<picture><source media=\"(min-width: 1025px)\" srcset=\"/static/img/memnix_500x500.avif\" type=\"image/avif\"> <source media=\"(min-width: 1025px)\" srcset=\"/static/img/memnix_500x500.webp\" type=\"image/webp\"> <source media=\"(max-width: 1024px)\" srcset=\"/static/img/memnix_400x400.avif\" type=\"image/avif\"> <source media=\"(max-width: 1024px)\" srcset=\"/static/img/memnix_400x400.webp\" type=\"image/webp\"> <img src=\"/static/img/icon.png\" class=\"mx-auto hidden md:block\" loading=\"lazy\" decoding=\"async\" alt=\"Memnix app logo\" width=\"500\" height=\"500\"></picture>") |
91
|
|
|
if templ_7745c5c3_Err != nil { |
92
|
|
|
return templ_7745c5c3_Err |
93
|
|
|
} |
94
|
|
|
if !templ_7745c5c3_IsBuffer { |
95
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
96
|
|
|
} |
97
|
|
|
return templ_7745c5c3_Err |
98
|
|
|
}) |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
func Hero(name string) templ.Component { |
102
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
103
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
104
|
|
|
if !templ_7745c5c3_IsBuffer { |
105
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
106
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
107
|
|
|
} |
108
|
|
|
ctx = templ.InitializeContext(ctx) |
109
|
|
|
templ_7745c5c3_Var5 := templ.GetChildren(ctx) |
110
|
|
|
if templ_7745c5c3_Var5 == nil { |
111
|
|
|
templ_7745c5c3_Var5 = templ.NopComponent |
112
|
|
|
} |
113
|
|
|
ctx = templ.ClearChildren(ctx) |
114
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<style>\n\t\t\tme {\n\t\t\t\talign-items: center;\n\t\t\t\tpadding: 0 1rem;\n\t\t\t\tmin-height: 100vh;\n\t\t\t\tpadding-top: 164px;\n\t\t\t\tpadding-bottom: 164px;\n\t\t\t}\n\t\t</style><section data-testid=\"hero\"><style>\n\t\t\tme {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: row;\n\t\t\t\tjustify-content: space-between;\n\t\t\t\talign-items: center;\n\t\t\t\tpadding: 0 1rem;\n\t\t\t}\n\t\t</style><div><h1>A spaced repetition<br>learning app<br>using AI</h1><div><button href=\"/login\" rel=\"noopener\" preload>Get Started</button> <button href=\"https://github.com/memnix\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"outline\">Learn more</button></div></div><div>") |
115
|
|
|
if templ_7745c5c3_Err != nil { |
116
|
|
|
return templ_7745c5c3_Err |
117
|
|
|
} |
118
|
|
|
templ_7745c5c3_Err = heroImage().Render(ctx, templ_7745c5c3_Buffer) |
119
|
|
|
if templ_7745c5c3_Err != nil { |
120
|
|
|
return templ_7745c5c3_Err |
121
|
|
|
} |
122
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></section>") |
123
|
|
|
if templ_7745c5c3_Err != nil { |
124
|
|
|
return templ_7745c5c3_Err |
125
|
|
|
} |
126
|
|
|
if !templ_7745c5c3_IsBuffer { |
127
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
128
|
|
|
} |
129
|
|
|
return templ_7745c5c3_Err |
130
|
|
|
}) |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
func HomePage(title, |
134
|
|
|
username string, |
135
|
|
|
fromProtected bool, nonce domain.Nonce, |
136
|
|
|
cmp templ.Component) templ.Component { |
137
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
138
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
139
|
|
|
if !templ_7745c5c3_IsBuffer { |
140
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
141
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
142
|
|
|
} |
143
|
|
|
ctx = templ.InitializeContext(ctx) |
144
|
|
|
templ_7745c5c3_Var6 := templ.GetChildren(ctx) |
145
|
|
|
if templ_7745c5c3_Var6 == nil { |
146
|
|
|
templ_7745c5c3_Var6 = templ.NopComponent |
147
|
|
|
} |
148
|
|
|
ctx = templ.ClearChildren(ctx) |
149
|
|
|
templ_7745c5c3_Var7 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
150
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
151
|
|
|
if !templ_7745c5c3_IsBuffer { |
152
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
153
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
154
|
|
|
} |
155
|
|
|
templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) |
156
|
|
|
if templ_7745c5c3_Err != nil { |
157
|
|
|
return templ_7745c5c3_Err |
158
|
|
|
} |
159
|
|
|
if !templ_7745c5c3_IsBuffer { |
160
|
|
|
_, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) |
161
|
|
|
} |
162
|
|
|
return templ_7745c5c3_Err |
163
|
|
|
}) |
164
|
|
|
templ_7745c5c3_Err = layout.Base(title, username, fromProtected, nonce).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) |
165
|
|
|
if templ_7745c5c3_Err != nil { |
166
|
|
|
return templ_7745c5c3_Err |
167
|
|
|
} |
168
|
|
|
if !templ_7745c5c3_IsBuffer { |
169
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
170
|
|
|
} |
171
|
|
|
return templ_7745c5c3_Err |
172
|
|
|
}) |
173
|
|
|
} |
174
|
|
|
|