1
|
|
|
// Code generated by templ - DO NOT EDIT. |
2
|
|
|
|
3
|
|
|
// templ: version: v0.2.598 |
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
|
|
|
|
15
|
|
|
func hello(name string) templ.Component { |
16
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
17
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
18
|
|
|
if !templ_7745c5c3_IsBuffer { |
19
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
20
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
21
|
|
|
} |
22
|
|
|
ctx = templ.InitializeContext(ctx) |
23
|
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
24
|
|
|
if templ_7745c5c3_Var1 == nil { |
25
|
|
|
templ_7745c5c3_Var1 = templ.NopComponent |
26
|
|
|
} |
27
|
|
|
ctx = templ.ClearChildren(ctx) |
28
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col\" data-testid=\"helloComponent\"><h1 class=\"mx-auto\" data-testid=\"helloH1\">Hello, ") |
29
|
|
|
if templ_7745c5c3_Err != nil { |
30
|
|
|
return templ_7745c5c3_Err |
31
|
|
|
} |
32
|
|
|
var templ_7745c5c3_Var2 string |
33
|
|
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name) |
34
|
|
|
if templ_7745c5c3_Err != nil { |
35
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/page/index.page.templ`, Line: 6, Col: 57} |
36
|
|
|
} |
37
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) |
38
|
|
|
if templ_7745c5c3_Err != nil { |
39
|
|
|
return templ_7745c5c3_Err |
40
|
|
|
} |
41
|
|
|
_, 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>") |
42
|
|
|
if templ_7745c5c3_Err != nil { |
43
|
|
|
return templ_7745c5c3_Err |
44
|
|
|
} |
45
|
|
|
if !templ_7745c5c3_IsBuffer { |
46
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
47
|
|
|
} |
48
|
|
|
return templ_7745c5c3_Err |
49
|
|
|
}) |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
func Clicked() templ.Component { |
53
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
54
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
55
|
|
|
if !templ_7745c5c3_IsBuffer { |
56
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
57
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
58
|
|
|
} |
59
|
|
|
ctx = templ.InitializeContext(ctx) |
60
|
|
|
templ_7745c5c3_Var3 := templ.GetChildren(ctx) |
61
|
|
|
if templ_7745c5c3_Var3 == nil { |
62
|
|
|
templ_7745c5c3_Var3 = templ.NopComponent |
63
|
|
|
} |
64
|
|
|
ctx = templ.ClearChildren(ctx) |
65
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"parent-div\" class=\"flex flex-col\"><p class=\"mx-auto \">Clicked!</p></div>") |
66
|
|
|
if templ_7745c5c3_Err != nil { |
67
|
|
|
return templ_7745c5c3_Err |
68
|
|
|
} |
69
|
|
|
if !templ_7745c5c3_IsBuffer { |
70
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
71
|
|
|
} |
72
|
|
|
return templ_7745c5c3_Err |
73
|
|
|
}) |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
func heroImage() templ.Component { |
77
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
78
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
79
|
|
|
if !templ_7745c5c3_IsBuffer { |
80
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
81
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
82
|
|
|
} |
83
|
|
|
ctx = templ.InitializeContext(ctx) |
84
|
|
|
templ_7745c5c3_Var4 := templ.GetChildren(ctx) |
85
|
|
|
if templ_7745c5c3_Var4 == nil { |
86
|
|
|
templ_7745c5c3_Var4 = templ.NopComponent |
87
|
|
|
} |
88
|
|
|
ctx = templ.ClearChildren(ctx) |
89
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col\" data-testid=\"heroImage\"><img src=\"/img/icon.png\" class=\"mx-auto\" alt=\"Memnix app logo\" class=\"hidden md:block\" width=\"800\" height=\"800\"></div>") |
90
|
|
|
if templ_7745c5c3_Err != nil { |
91
|
|
|
return templ_7745c5c3_Err |
92
|
|
|
} |
93
|
|
|
if !templ_7745c5c3_IsBuffer { |
94
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
95
|
|
|
} |
96
|
|
|
return templ_7745c5c3_Err |
97
|
|
|
}) |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
func Hero(name string) templ.Component { |
101
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
102
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
103
|
|
|
if !templ_7745c5c3_IsBuffer { |
104
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
105
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
106
|
|
|
} |
107
|
|
|
ctx = templ.InitializeContext(ctx) |
108
|
|
|
templ_7745c5c3_Var5 := templ.GetChildren(ctx) |
109
|
|
|
if templ_7745c5c3_Var5 == nil { |
110
|
|
|
templ_7745c5c3_Var5 = templ.NopComponent |
111
|
|
|
} |
112
|
|
|
ctx = templ.ClearChildren(ctx) |
113
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<section data-testid=\"hero\" class=\"mx-auto max-w-6xl px-4 sm:px-6 md:flex md:h-screen md:min-h-[calc(100vh-72px)] 2xl:h-auto\"><div class=\"block py-12 text-center md:flex md:py-12 md:text-left lg:py-16\"><div class=\"mx-auto flex basis-3/5 items-center pb-12 md:py-0 md:pr-16\"><div><h1 class=\"leading-tighter font-heading mb-4 px-4 text-5xl font-bold tracking-tighter md:px-0 md:text-[3.48rem]\">A <span class=\"text-accent\">spaced repetition </span> <span class=\"lg:block\">learning app </span> <span class=\"text-secondary sm:whitespace-nowrap\">using AI</span></h1><div class=\"mx-auto max-w-3xl\"><div class=\"m-auto flex max-w-xs flex-col flex-nowrap justify-center gap-4 sm:max-w-md sm:flex-row md:m-0 md:justify-start\"><div class=\"flex w-full sm:w-auto\"><a class=\"btn btn-primary w-full sm:mb-0\" to=\"/auth\" rel=\"noopener\">Get Started</a></div><div class=\"flex w-full sm:w-auto\"><a to=\"https://github.com/CorentinGS\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"btn btn-outline w-full\">Learn more</a></div></div></div></div></div><div class=\"block flex-1 items-center md:flex\"><div class=\"relative m-auto max-w-4xl\">") |
114
|
|
|
if templ_7745c5c3_Err != nil { |
115
|
|
|
return templ_7745c5c3_Err |
116
|
|
|
} |
117
|
|
|
templ_7745c5c3_Err = heroImage().Render(ctx, templ_7745c5c3_Buffer) |
118
|
|
|
if templ_7745c5c3_Err != nil { |
119
|
|
|
return templ_7745c5c3_Err |
120
|
|
|
} |
121
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></section>") |
122
|
|
|
if templ_7745c5c3_Err != nil { |
123
|
|
|
return templ_7745c5c3_Err |
124
|
|
|
} |
125
|
|
|
if !templ_7745c5c3_IsBuffer { |
126
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
127
|
|
|
} |
128
|
|
|
return templ_7745c5c3_Err |
129
|
|
|
}) |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
func HomePage(title, |
133
|
|
|
username string, |
134
|
|
|
fromProtected bool, |
135
|
|
|
isError bool, |
136
|
|
|
errMsgs, sucMsgs []string, |
137
|
|
|
cmp templ.Component) templ.Component { |
138
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
139
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
140
|
|
|
if !templ_7745c5c3_IsBuffer { |
141
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
142
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
143
|
|
|
} |
144
|
|
|
ctx = templ.InitializeContext(ctx) |
145
|
|
|
templ_7745c5c3_Var6 := templ.GetChildren(ctx) |
146
|
|
|
if templ_7745c5c3_Var6 == nil { |
147
|
|
|
templ_7745c5c3_Var6 = templ.NopComponent |
148
|
|
|
} |
149
|
|
|
ctx = templ.ClearChildren(ctx) |
150
|
|
|
templ_7745c5c3_Var7 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
151
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
152
|
|
|
if !templ_7745c5c3_IsBuffer { |
153
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
154
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
155
|
|
|
} |
156
|
|
|
templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) |
157
|
|
|
if templ_7745c5c3_Err != nil { |
158
|
|
|
return templ_7745c5c3_Err |
159
|
|
|
} |
160
|
|
|
if !templ_7745c5c3_IsBuffer { |
161
|
|
|
_, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) |
162
|
|
|
} |
163
|
|
|
return templ_7745c5c3_Err |
164
|
|
|
}) |
165
|
|
|
templ_7745c5c3_Err = layout.Base(title, username, fromProtected, isError, errMsgs, sucMsgs).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) |
166
|
|
|
if templ_7745c5c3_Err != nil { |
167
|
|
|
return templ_7745c5c3_Err |
168
|
|
|
} |
169
|
|
|
if !templ_7745c5c3_IsBuffer { |
170
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
171
|
|
|
} |
172
|
|
|
return templ_7745c5c3_Err |
173
|
|
|
}) |
174
|
|
|
} |
175
|
|
|
|