tangled
alpha
login
or
join now
julien.rbrt.fr
/
tangled-core
forked from
tangled.org/core
0
fork
atom
Monorepo for Tangled — https://tangled.org
0
fork
atom
overview
issues
pulls
pipelines
clean up knot view
anirudh.fi
1 year ago
3d6962a7
5f7ec0de
verified
This commit was signed with the committer's
known signature
.
anirudh.fi
SSH Key Fingerprint:
SHA256:FQUiBXeyBQT4WKOm7EKh6hLkHjBh9MdfkV3my0dueGE=
+171
-124
5 changed files
expand all
collapse all
unified
split
appview
pages
templates
knots.html
layouts
base.html
topbar.html
user
profile.html
input.css
+82
-47
appview/pages/templates/knots.html
···
3
3
{{ define "content" }}
4
4
<h1>knots</h1>
5
5
6
6
-
<h2>register</h2>
7
7
-
put in a domain, and use the key while booting up your knotserver
8
8
-
<form hx-post="/knots/key">
9
9
-
<label for="domain">domain:</label>
10
10
-
<input type="text" id="domain" name="domain" required />
11
11
-
<button class="btn my-2" type="text">generate key</button>
12
12
-
</form>
6
6
+
<section class="mb-12">
7
7
+
<h2 class="text-2xl mb-4">register a knot</h2>
8
8
+
<form hx-post="/knots/key" class="flex gap-4 items-end">
9
9
+
<div>
10
10
+
<label for="domain"
11
11
+
>Generate a key to start your knot with.</label
12
12
+
>
13
13
+
<input
14
14
+
type="text"
15
15
+
id="domain"
16
16
+
name="domain"
17
17
+
placeholder="knot.example.com"
18
18
+
required
19
19
+
/>
20
20
+
</div>
21
21
+
<button class="btn" type="submit">generate key</button>
22
22
+
</form>
23
23
+
</section>
13
24
14
14
-
<h3>my knots</h3>
15
15
-
<ul id="my-knots">
16
16
-
{{ range .Registrations }}
17
17
-
{{ if .Registered }}
18
18
-
<li>
19
19
-
<code
20
20
-
>domain:
21
21
-
<a href="/knots/{{ .Domain }}">{{ .Domain }}</a></code
22
22
-
><br />
23
23
-
<code>opened by: {{ .ByDid }}</code><br />
24
24
-
<code>on: {{ .Created }}</code><br />
25
25
-
<code>registered on: {{ .Registered }}</code>
26
26
-
</li>
25
25
+
<section class="mb-12">
26
26
+
<h3 class="text-xl font-semibold mb-4">my knots</h3>
27
27
+
<ul id="my-knots" class="space-y-6">
28
28
+
{{ range .Registrations }}
29
29
+
{{ if .Registered }}
30
30
+
<li class="border rounded p-4 flex flex-col gap-2">
31
31
+
<div>
32
32
+
<a href="/knots/{{ .Domain }}" class="font-semibold"
33
33
+
>{{ .Domain }}</a
34
34
+
>
35
35
+
</div>
36
36
+
<div class="text-gray-600">
37
37
+
Owned by
38
38
+
{{ .ByDid }}
39
39
+
</div>
40
40
+
<div class="text-gray-600">
41
41
+
Registered on
42
42
+
{{ .Registered }}
43
43
+
</div>
44
44
+
</li>
45
45
+
{{ end }}
46
46
+
{{ else }}
47
47
+
<p class="text-gray-600">you don't have any knots yet</p>
27
48
{{ end }}
28
28
-
{{ else }}
29
29
-
<p>you don't have any knots yet</p>
30
30
-
{{ end }}
31
31
-
</ul>
32
32
-
<h3>pending registrations</h3>
33
33
-
<ul id="pending-registrations">
34
34
-
{{ range .Registrations }}
35
35
-
{{ if not .Registered }}
36
36
-
<li>
37
37
-
<code
38
38
-
>domain:
39
39
-
<a href="/knots/{{ .Domain }}">{{ .Domain }}</a></code
40
40
-
><br />
41
41
-
<code>opened by: {{ .ByDid }}</code><br />
42
42
-
<code>on: {{ .Created }}</code><br />
43
43
-
<code>pending registration</code>
44
44
-
<button
45
45
-
class="btn my-2"
46
46
-
hx-post="/knots/{{ .Domain }}/init"
47
47
-
>
48
48
-
initialize
49
49
-
</button>
50
50
-
</li>
49
49
+
</ul>
50
50
+
</section>
51
51
+
52
52
+
<section>
53
53
+
<h3 class="text-xl font-semibold mb-4">pending registrations</h3>
54
54
+
<ul id="pending-registrations" class="space-y-6">
55
55
+
{{ range .Registrations }}
56
56
+
{{ if not .Registered }}
57
57
+
<li class="border rounded p-4 flex flex-col gap-2">
58
58
+
<div>
59
59
+
<a
60
60
+
href="/knots/{{ .Domain }}"
61
61
+
class="text-blue-600 hover:underline"
62
62
+
>{{ .Domain }}</a
63
63
+
>
64
64
+
</div>
65
65
+
<div class="text-gray-600">
66
66
+
Opened by
67
67
+
{{ .ByDid }}
68
68
+
</div>
69
69
+
<div class="text-gray-600">
70
70
+
Created on
71
71
+
{{ .Created }}
72
72
+
</div>
73
73
+
<div class="flex items-center gap-4 mt-2">
74
74
+
<span class="text-amber-600"
75
75
+
>pending registration</span
76
76
+
>
77
77
+
<button
78
78
+
class="btn"
79
79
+
hx-post="/knots/{{ .Domain }}/init"
80
80
+
>
81
81
+
initialize
82
82
+
</button>
83
83
+
</div>
84
84
+
</li>
85
85
+
{{ end }}
86
86
+
{{ else }}
87
87
+
<p class="text-gray-600">no registrations yet</p>
51
88
{{ end }}
52
52
-
{{ else }}
53
53
-
<p>no registrations yet</p>
54
54
-
{{ end }}
55
55
-
</ul>
89
89
+
</ul>
90
90
+
</section>
56
91
{{ end }}
+3
-3
appview/pages/templates/layouts/base.html
···
8
8
content="width=device-width, initial-scale=1.0"
9
9
/>
10
10
<script src="/static/htmx.min.js"></script>
11
11
-
<link href="/static/tw.css" rel="stylesheet" />
11
11
+
<link href="/static/tw.css" rel="stylesheet" type="text/css" />
12
12
<title>{{ block "title" . }}tangled{{ end }}</title>
13
13
</head>
14
14
-
<body class="container">
15
15
-
<header class="topbar">
14
14
+
<body class="container mx-auto px-10">
15
15
+
<header>
16
16
{{ block "topbar" . }}
17
17
{{ template "layouts/topbar" . }}
18
18
{{ end }}
+45
-45
appview/pages/templates/layouts/topbar.html
···
1
1
{{ define "layouts/topbar" }}
2
2
-
<nav class="flex items-center space-x-4">
3
3
-
<a
4
4
-
href="/"
5
5
-
hx-boost="true"
6
6
-
class="text-gray-600 hover:text-gray-900"
7
7
-
>timeline</a
8
8
-
>
9
9
-
{{ with .LoggedInUser }}
10
10
-
<a
11
11
-
href="/settings"
12
12
-
hx-boost="true"
13
13
-
class="text-gray-600 hover:text-gray-900"
14
14
-
>settings</a
15
15
-
>
16
16
-
<a
17
17
-
href="/knots"
18
18
-
hx-boost="true"
19
19
-
class="text-gray-600 hover:text-gray-900"
20
20
-
>knots</a
21
21
-
>
22
22
-
<a
23
23
-
href="/repo/new"
24
24
-
hx-boost="true"
25
25
-
class="text-gray-600 hover:text-gray-900"
26
26
-
>add repos</a
27
27
-
>
28
28
-
{{ if .Handle }}
29
29
-
<a
30
30
-
href="/@{{ .Handle }}"
31
31
-
hx-boost="true"
32
32
-
class="text-gray-600 hover:text-gray-900"
33
33
-
>my profile</a
34
34
-
>
35
35
-
{{ else }}
36
36
-
<a
37
37
-
href="/{{ .Did }}"
38
38
-
hx-boost="true"
39
39
-
class="text-gray-600 hover:text-gray-900"
40
40
-
>my profile</a
41
41
-
>
42
42
-
{{ end }}
43
43
-
{{ else }}
44
44
-
<a href="/login" class="btn my-2">login</a>
45
45
-
{{ end }}
46
46
-
</nav>
2
2
+
{{ with .LoggedInUser }}
3
3
+
<nav class="flex items-center space-x-4 py-10">
4
4
+
<a
5
5
+
href="/"
6
6
+
hx-boost="true"
7
7
+
class="text-gray-600 hover:text-gray-900"
8
8
+
>timeline</a
9
9
+
>
10
10
+
<a
11
11
+
href="/settings"
12
12
+
hx-boost="true"
13
13
+
class="text-gray-600 hover:text-gray-900"
14
14
+
>settings</a
15
15
+
>
16
16
+
<a
17
17
+
href="/knots"
18
18
+
hx-boost="true"
19
19
+
class="text-gray-600 hover:text-gray-900"
20
20
+
>knots</a
21
21
+
>
22
22
+
<a
23
23
+
href="/repo/new"
24
24
+
hx-boost="true"
25
25
+
class="text-gray-600 hover:text-gray-900"
26
26
+
>add repos</a
27
27
+
>
28
28
+
{{ if .Handle }}
29
29
+
<a
30
30
+
href="/@{{ .Handle }}"
31
31
+
hx-boost="true"
32
32
+
class="text-gray-600 hover:text-gray-900"
33
33
+
>my profile</a
34
34
+
>
35
35
+
{{ else }}
36
36
+
<a
37
37
+
href="/{{ .Did }}"
38
38
+
hx-boost="true"
39
39
+
class="text-gray-600 hover:text-gray-900"
40
40
+
>my profile</a
41
41
+
>
42
42
+
{{ end }}
43
43
+
</nav>
44
44
+
{{ else }}
45
45
+
<a href="/login" class="btn my-2">login</a>
46
46
+
{{ end }}
47
47
{{ end }}
+31
-19
appview/pages/templates/user/profile.html
···
1
1
-
{{define "title"}}{{ or .UserHandle .UserDid }}{{end}}
1
1
+
{{ define "title" }}{{ or .UserHandle .UserDid }}{{ end }}
2
2
3
3
-
{{define "content"}}
4
4
-
<h1>{{ didOrHandle .UserDid .UserHandle }}</h1>
5
5
-
6
6
-
<div id="my-repos" class="grid grid-cols-1 md:grid-cols-2 gap-4">
7
7
-
{{range .Repos}}
8
8
-
<div id="repo-card" class="border border-black p-4 shadow-sm bg-white">
9
9
-
<div id="repo-card-name" class="font-medium">
10
10
-
<a href="/@{{or $.UserHandle $.UserDid }}/{{.Name}}">{{.Name}}</a>
11
11
-
</div>
12
12
-
<div id="repo-knot-name" class="text-gray-600 text-sm font-mono">
13
13
-
{{.Knot}}
14
14
-
</div>
15
15
-
</div>
16
16
-
{{else}}
17
17
-
<p>This user does not have any repos yet.</p>
18
18
-
{{end}}
19
19
-
</div>
20
20
-
{{end}}
3
3
+
{{ define "content" }}
4
4
+
<h1>
5
5
+
<h1>{{ didOrHandle .UserDid .UserHandle }}</h1>
6
6
+
</h1>
7
7
+
<section>
8
8
+
<h2 class="text-xl font-semibold mb-4">repos</h2>
9
9
+
<ul id="my-knots" class="space-y-4">
10
10
+
{{ range .Repos }}
11
11
+
<li class="p-4 bg-gray-50 rounded-lg">
12
12
+
<div class="font-mono">
13
13
+
<div class="mb-2">
14
14
+
name:
15
15
+
<a
16
16
+
href="/@{{ or $.UserHandle $.UserDid }}/{{ .Name }}"
17
17
+
class="text-blue-600 hover:text-blue-800"
18
18
+
>{{ .Name }}</a
19
19
+
>
20
20
+
</div>
21
21
+
<div>
22
22
+
knot:
23
23
+
{{ .Knot }}
24
24
+
</div>
25
25
+
</div>
26
26
+
</li>
27
27
+
{{ else }}
28
28
+
<p class="text-gray-600">does not have any repos yet</p>
29
29
+
{{ end }}
30
30
+
</ul>
31
31
+
</section>
32
32
+
{{ end }}
+10
-10
input.css
···
39
39
@layer components {
40
40
.btn {
41
41
@apply relative z-10 inline-flex min-h-[30px] cursor-pointer items-center
42
42
-
justify-center bg-transparent px-2 pb-[0.2rem] text-base
43
43
-
text-black before:absolute before:inset-0 before:-z-10
44
44
-
before:block before:rounded-sm before:border before:border-black
45
45
-
before:bg-white before:shadow-[0_2px_2px_0_rgba(0,0,0,0.1),inset_0_-2px_0_0_#ffffff]
46
46
-
before:content-[''] hover:before:border-gray-800
47
47
-
hover:before:bg-gray-50
48
48
-
hover:before:shadow-[0_2px_2px_0_rgba(0,0,0,0.1),inset_0_-2px_0_0_#ffffff]
49
49
-
focus:outline-none focus-visible:before:outline
50
50
-
focus-visible:before:outline-4 focus-visible:before:outline-black
51
51
-
active:before:shadow-[inset_0_2px_2px_0_rgba(0,0,0,0.1)];
42
42
+
justify-center bg-transparent px-2 pb-[0.2rem] text-base
43
43
+
text-gray-900 before:absolute before:inset-0 before:-z-10
44
44
+
before:block before:rounded-sm before:border before:border-blue-200
45
45
+
before:bg-white before:shadow-[0_2px_2px_0_rgba(20,20,96,0.1),inset_0_-2px_0_0_#e5edff]
46
46
+
before:content-[''] hover:before:border-blue-300
47
47
+
hover:before:bg-blue-50
48
48
+
hover:before:shadow-[0_2px_2px_0_rgba(20,20,96,0.1),inset_0_-2px_0_0_#e5edff]
49
49
+
focus:outline-none focus-visible:before:outline
50
50
+
focus-visible:before:outline-4 focus-visible:before:outline-blue-500
51
51
+
active:before:shadow-[inset_0_2px_2px_0_rgba(20,20,96,0.1)];
52
52
}
53
53
}
54
54
@layer utilities {