+6
-1
appview/pages/pages.go
+6
-1
appview/pages/pages.go
···
14
"path/filepath"
15
"strings"
16
17
chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
18
"github.com/alecthomas/chroma/v2/lexers"
19
"github.com/alecthomas/chroma/v2/styles"
···
364
}
365
366
func (p *Pages) RepoBlob(w io.Writer, params RepoBlobParams) error {
367
if params.Lines < 5000 {
368
c := params.Contents
369
-
style := styles.Get("bw")
370
formatter := chromahtml.New(
371
chromahtml.InlineCode(true),
372
chromahtml.WithLineNumbers(true),
···
14
"path/filepath"
15
"strings"
16
17
+
"github.com/alecthomas/chroma/v2"
18
chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
19
"github.com/alecthomas/chroma/v2/lexers"
20
"github.com/alecthomas/chroma/v2/styles"
···
365
}
366
367
func (p *Pages) RepoBlob(w io.Writer, params RepoBlobParams) error {
368
+
style := styles.Get("bw")
369
+
b := style.Builder()
370
+
b.Add(chroma.LiteralString, "noitalic")
371
+
style, _ = b.Build()
372
+
373
if params.Lines < 5000 {
374
c := params.Contents
375
formatter := chromahtml.New(
376
chromahtml.InlineCode(true),
377
chromahtml.WithLineNumbers(true),
+26
-48
appview/pages/templates/layouts/topbar.html
+26
-48
appview/pages/templates/layouts/topbar.html
···
1
{{ define "layouts/topbar" }}
2
-
{{ with .LoggedInUser }}
3
-
<nav
4
-
class="flex items-center justify-center space-x-4 mb-4 py-2 border-b border-l border-r border-black"
5
-
>
6
-
<a
7
-
href="/"
8
-
hx-boost="true"
9
-
class="text-gray-600 hover:text-gray-900 no-underline"
10
-
>timeline</a
11
-
>
12
-
<a
13
-
href="/settings"
14
-
hx-boost="true"
15
-
class="text-gray-600 hover:text-gray-900 no-underline"
16
-
>settings</a
17
-
>
18
-
<a
19
-
href="/knots"
20
-
hx-boost="true"
21
-
class="text-gray-600 hover:text-gray-900 no-underline"
22
-
>knots</a
23
-
>
24
-
<a
25
-
href="/repo/new"
26
-
hx-boost="true"
27
-
class="text-gray-600 hover:text-gray-900 no-underline"
28
-
>add repos</a
29
-
>
30
-
{{ if .Handle }}
31
-
<a
32
-
href="/@{{ .Handle }}"
33
-
hx-boost="true"
34
-
class="text-gray-600 hover:text-gray-900 no-underline"
35
-
>my profile</a
36
-
>
37
-
{{ else }}
38
-
<a
39
-
href="/{{ .Did }}"
40
-
hx-boost="true"
41
-
class="text-gray-600 hover:text-gray-900 no-underline"
42
-
>my profile</a
43
-
>
44
-
{{ end }}
45
-
<button hx-get="/logout" class="btn">logout</a>
46
-
</nav>
47
-
{{ else }}
48
-
<a href="/login" class="btn my-2 no-underline">login</a>
49
-
{{ end }}
50
{{ end }}
···
1
{{ define "layouts/topbar" }}
2
+
{{ $linkstyle := "text-gray-400 hover:text-gray-900 no-underline" }}
3
+
<nav class="flex justify-between px-6 space-x-4 mb-4 py-2 border-b border-black">
4
+
<div id="left-items">
5
+
<a href="/" hx-boost="true" class="{{ $linkstyle }} flex gap-2">
6
+
<i class="w-6 h-6" data-lucide="tangent"></i>
7
+
tangled.sh
8
+
</a>
9
+
</div>
10
+
<div id="right-items" class="flex gap-2">
11
+
{{ with .LoggedInUser }}
12
+
<a href="/repo/new" hx-boost="true" class="{{ $linkstyle }}">
13
+
<i class="w-6 h-6" data-lucide="plus"></i>
14
+
</a>
15
+
<a href="/{{ didOrHandle .Did .Handle }}" hx-boost="true" class="{{ $linkstyle }}">
16
+
{{ didOrHandle .Did .Handle }}
17
+
</a>
18
+
<a href="/logout"class="{{ $linkstyle }}">
19
+
(logout)
20
+
</a>
21
+
{{ else }}
22
+
<a href="/login" hx-boost="true" class="{{ $linkstyle }}">
23
+
login
24
+
</a>
25
+
{{ end }}
26
+
</div>
27
+
</nav>
28
{{ end }}
-1
appview/pages/templates/repo/commit.html
-1
appview/pages/templates/repo/commit.html
···
109
<pre class="overflow-auto">
110
{{- range .TextFragments -}}
111
<div class="bg-gray-100 text-gray-500 select-none">{{ .Header }}</div>
112
-
113
{{- range .Lines -}}
114
{{- if eq .Op.String "+" -}}
115
<div class="bg-green-100 text-green-700"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
···
109
<pre class="overflow-auto">
110
{{- range .TextFragments -}}
111
<div class="bg-gray-100 text-gray-500 select-none">{{ .Header }}</div>
112
{{- range .Lines -}}
113
{{- if eq .Op.String "+" -}}
114
<div class="bg-green-100 text-green-700"><span class="select-none">{{ .Op.String }}</span><span>{{ .Line }}</span></div>
+4
-2
appview/pages/templates/repo/index.html
+4
-2
appview/pages/templates/repo/index.html
···
13
onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
14
class="p-1 border border-gray-500 bg-white"
15
>
16
-
<optgroup label="branches" class="uppercase bold text-sm">
17
{{ range .Branches }}
18
<option
19
value="{{ .Reference.Name }}"
···
24
</option>
25
{{ end }}
26
</optgroup>
27
-
<optgroup label="tags" class="uppercase bold text-sm">
28
{{ range .Tags }}
29
<option
30
value="{{ .Reference.Name }}"
···
33
>
34
{{ .Reference.Name }}
35
</option>
36
{{ end }}
37
</optgroup>
38
</select>
···
13
onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
14
class="p-1 border border-gray-500 bg-white"
15
>
16
+
<optgroup label="branches" class="bold text-sm">
17
{{ range .Branches }}
18
<option
19
value="{{ .Reference.Name }}"
···
24
</option>
25
{{ end }}
26
</optgroup>
27
+
<optgroup label="tags" class="bold text-sm">
28
{{ range .Tags }}
29
<option
30
value="{{ .Reference.Name }}"
···
33
>
34
{{ .Reference.Name }}
35
</option>
36
+
{{ else }}
37
+
<option class="py-1" disabled>no tags found</option>
38
{{ end }}
39
</optgroup>
40
</select>
-1
appview/state/middleware.go
-1
appview/state/middleware.go
-4
appview/state/repo.go
-4
appview/state/repo.go
···
53
return
54
}
55
56
-
log.Println(resp.Status, result)
57
-
58
user := s.auth.GetUser(r)
59
s.pages.RepoIndexPage(w, pages.RepoIndexParams{
60
LoggedInUser: user,
···
274
log.Println("failed to parse response:", err)
275
return
276
}
277
-
278
-
log.Println(result)
279
280
user := s.auth.GetUser(r)
281
s.pages.RepoBranches(w, pages.RepoBranchesParams{
+1
-4
knotserver/git/diff.go
+1
-4
knotserver/git/diff.go
+4
-4
types/diff.go
+4
-4
types/diff.go