|
1
|
|
|
// Code generated by templ - DO NOT EDIT. |
|
2
|
|
|
|
|
3
|
|
|
// templ: version: v0.2.543 |
|
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 Hero(name string) 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("<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\">cta.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\">cta.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\">") |
|
90
|
|
|
if templ_7745c5c3_Err != nil { |
|
91
|
|
|
return templ_7745c5c3_Err |
|
92
|
|
|
} |
|
93
|
|
|
templ_7745c5c3_Err = hello(name).Render(ctx, templ_7745c5c3_Buffer) |
|
94
|
|
|
if templ_7745c5c3_Err != nil { |
|
95
|
|
|
return templ_7745c5c3_Err |
|
96
|
|
|
} |
|
97
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></section>") |
|
98
|
|
|
if templ_7745c5c3_Err != nil { |
|
99
|
|
|
return templ_7745c5c3_Err |
|
100
|
|
|
} |
|
101
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
102
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
|
103
|
|
|
} |
|
104
|
|
|
return templ_7745c5c3_Err |
|
105
|
|
|
}) |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
func HomePage(title, |
|
109
|
|
|
username string, |
|
110
|
|
|
fromProtected bool, |
|
111
|
|
|
isError bool, |
|
112
|
|
|
errMsgs, sucMsgs []string, |
|
113
|
|
|
cmp templ.Component) templ.Component { |
|
114
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
|
115
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
|
116
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
117
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
|
118
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
|
119
|
|
|
} |
|
120
|
|
|
ctx = templ.InitializeContext(ctx) |
|
121
|
|
|
templ_7745c5c3_Var5 := templ.GetChildren(ctx) |
|
122
|
|
|
if templ_7745c5c3_Var5 == nil { |
|
123
|
|
|
templ_7745c5c3_Var5 = templ.NopComponent |
|
124
|
|
|
} |
|
125
|
|
|
ctx = templ.ClearChildren(ctx) |
|
126
|
|
|
templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
|
127
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
|
128
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
129
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer() |
|
130
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
|
131
|
|
|
} |
|
132
|
|
|
templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) |
|
133
|
|
|
if templ_7745c5c3_Err != nil { |
|
134
|
|
|
return templ_7745c5c3_Err |
|
135
|
|
|
} |
|
136
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
137
|
|
|
_, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) |
|
138
|
|
|
} |
|
139
|
|
|
return templ_7745c5c3_Err |
|
140
|
|
|
}) |
|
141
|
|
|
templ_7745c5c3_Err = layout.Base(title, username, fromProtected, isError, errMsgs, sucMsgs).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) |
|
142
|
|
|
if templ_7745c5c3_Err != nil { |
|
143
|
|
|
return templ_7745c5c3_Err |
|
144
|
|
|
} |
|
145
|
|
|
if !templ_7745c5c3_IsBuffer { |
|
146
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
|
147
|
|
|
} |
|
148
|
|
|
return templ_7745c5c3_Err |
|
149
|
|
|
}) |
|
150
|
|
|
} |
|
151
|
|
|
|