1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package main
import "git.src.quest/~skye/felu-ddns/config"
func serviceName() string {
return config.FeluConfig.ServiceName
}
templ baseBase(title string) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="/static/styles.css"/>
<script src="/static/htmx.min.js"></script>
<title>{ title }</title>
</head>
<body>
<main>
{ children... }
</main>
<script src="/static/felu.js"></script>
</body>
</html>
}
templ base(title string) {
@baseBase(title) {
<div class="flex flex-col w-full items-center p-4">
<div class="flex flex-col items-center gap-4">
<a class="text-4xl" href="/">{ serviceName() }</a>
</div>
<div class="flex flex-col w-full max-w-5xl items-center gap-2">
{ children... }
</div>
</div>
}
}
templ manageBase(title string) {
@baseBase(title) {
<div class="flex flex-col w-full items-center p-4">
<div class="flex w-full max-w-5xl items-center gap-4">
<a href="/manage">{ serviceName() }</a>
</div>
<div class="flex flex-col w-full max-w-5xl items-center gap-2">
{ children... }
</div>
</div>
}
}
templ index() {
@base("Index") {
<div class="bg-rose-200">
have info about the service here,
with a login button somewhere.
<br/>and also something something, basic index page info, bla bla
</div>
<!-- some kind of if logged_in thing, and then show a "manage" button instead of a login button -->
}
}
templ pageLogin() {
@manageBase("Login") {
<div class="bg-lime-200">
<form class="flex flex-col p-2 gap-2" hx-post="/auth/login" hx-target="#login_error">
<label for="login_email">Email</label>
<input class="border" type="text" placeholder="..." name="email" id="login_email"/>
<label for="login_password">Password</label>
<input class="border" type="password" placeholder="..." name="password" id="login_password"/>
<div class="text-rose-600 text-center" id="login_error"></div>
<button class="border p-1" type="submit">Login</button>
</form>
</div>
}
}
templ pageManage() {
@manageBase("Manage") {
<div>
something something manaag
</div>
}
}