DEVELOPMENT ENVIRONMENT

~liljamo/felu

ref: d42a0dff662231910094626e5595a9980affa260 felu/internal/components/manage.templ -rw-r--r-- 2.4 KiB
d42a0dffJonni Liljamo fix: don't fetch apikey in all domains 11 months ago
                                                                                
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
package components

import "git.src.quest/~skye/felu-ddns/internal/config"
import "fmt"

func getDomainPattern() string {
	return fmt.Sprintf(".%s", config.FeluConfig.DNSPattern)
}

templ Manage() {
	@ManageBase("Manage") {
		<div class="bg-teal-200">
			<form class="flex flex-col p-2 gap-2" hx-post="/manage/domains" hx-target="#add_domain_error">
				<label for="domain">Domain</label>
				<div>
					<input class="border" type="text" placeholder="..." name="domain" id="domain"/>
					<span>{ getDomainPattern() }</span>
				</div>
				<label for="a_record">A Record</label>
				<input class="border" type="text" placeholder="..." name="a_record" id="a_record"/>
				<div class="text-rose-600 text-center" id="add_domain_error"></div>
				<button class="border p-1" type="submit">Add</button>
			</form>
		</div>

		<div hx-get="/manage/partials/domains" hx-trigger="load, update-domain-list from:body" hx-target="this">
		</div>
	}
}

templ ManageUser(currentEmail string) {
	@ManageBase("Settings") {
		<div class="bg-violet-200">
			<form class="flex flex-col p-2 gap-2" hx-confirm="Sure?" hx-post="/manage/user/password" hx-target="#update_password_error">
				<label for="current_password">Current Password</label>
				<input class="border" type="password" placeholder="..." name="current_password" id="current_password"/>
				<label for="new_password">New Password</label>
				<input class="border" type="password" placeholder="..." name="new_password" id="new_password"/>
				<label for="confirm_new_password">Confirm</label>
				<input class="border" type="password" placeholder="..." name="confirm_new_password" id="confirm_new_password"/>
				<div class="text-rose-600 text-center" id="update_password_error"></div>
				<button class="border p-1">Update</button>
			</form>
		</div>
		<div class="bg-emerald-200">
			<form class="flex flex-col p-2 gap-2" hx-confirm="Sure?" hx-post="/manage/user/email" hx-target="#update_email_error">
				<label for="email">Email</label>
				<div>
					<input class="border" type="text" placeholder="..." name="email" id="email" value={ currentEmail }/>
					<input class="border" type="reset"/>
				</div>
				<div class="text-rose-600 text-center" id="update_email_error"></div>
				<button class="border p-1">Update</button>
			</form>
		</div>
		<div class="bg-rose-200">
			<button class="border p-1" hx-confirm="Sure? This will also delete all domain entries owned by the account." hx-delete="/manage/user">Delete Account</button>
		</div>
	}
}