- commit
- aea7552
- parent
- 8367b92
- author
- Eric Bower
- date
- 2025-03-17 14:30:11 -0400 EDT
docs(tui): descriptions for pubkeys and tokens
2 files changed,
+41,
-34
+25,
-20
1@@ -126,20 +126,22 @@ func (m *PubkeysPage) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error) {
2 w := ctx.Max.Width
3 h := ctx.Max.Height
4 root := vxfw.NewSurface(w, h, m)
5+ ah := 0
6
7- header := richtext.New([]vaxis.Segment{
8- {
9- Text: fmt.Sprintf(
10- "%d pubkeys\n",
11- len(m.keys),
12- ),
13- },
14- })
15- headerSurf, _ := header.Draw(createDrawCtx(ctx, 2))
16- root.AddChild(0, 0, headerSurf)
17+ info := text.New("Pubkeys are SSH public keys which grant access to your pico account. You can have many pubkeys associated with your account and they all have the same level of access. You cannot delete all pubkeys since it will revoke all access to the account.")
18+ brd := NewBorder(info)
19+ brd.Label = "desc"
20+ brdSurf, _ := brd.Draw(ctx)
21+ root.AddChild(0, ah, brdSurf)
22+ ah += int(brdSurf.Size.Height)
23+
24+ header := text.New(fmt.Sprintf("%d pubkeys\n\n", len(m.keys)))
25+ headerSurf, _ := header.Draw(ctx)
26+ root.AddChild(0, ah, headerSurf)
27+ ah += int(headerSurf.Size.Height)
28
29- listSurf, _ := m.list.Draw(createDrawCtx(ctx, h-5))
30- root.AddChild(0, 3, listSurf)
31+ listSurf, _ := m.list.Draw(ctx)
32+ root.AddChild(0, ah, listSurf)
33
34 segs := []vaxis.Segment{}
35 if m.confirm {
36@@ -157,7 +159,7 @@ func (m *PubkeysPage) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error) {
37 segs = append(segs, vaxis.Segment{Text: "\n"})
38
39 footer := richtext.New(segs)
40- footerSurf, _ := footer.Draw(createDrawCtx(ctx, 3))
41+ footerSurf, _ := footer.Draw(ctx)
42 root.AddChild(0, int(h)-3, footerSurf)
43
44 return root, nil
45@@ -239,19 +241,22 @@ func (m *AddKeyPage) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error) {
46 w := ctx.Max.Width
47 h := ctx.Max.Height
48 root := vxfw.NewSurface(w, h, m)
49+ ah := 0
50
51- header := text.New("Enter a new public key")
52- headerSurf, _ := header.Draw(createDrawCtx(ctx, 2))
53- root.AddChild(0, 0, headerSurf)
54+ header := text.New("Enter a new public key. You can typically grab an SSH pubkey in the `.ssh` folder: cat ~/.ssh/id_ed25519.pub. You can include the comment as well.")
55+ headerSurf, _ := header.Draw(ctx)
56+ root.AddChild(0, ah, headerSurf)
57+ ah += int(headerSurf.Size.Height) + 1
58
59- inputSurf, _ := m.input.Draw(createDrawCtx(ctx, 4))
60- root.AddChild(0, 3, inputSurf)
61+ inputSurf, _ := m.input.Draw(ctx)
62+ root.AddChild(0, ah, inputSurf)
63+ ah += int(headerSurf.Size.Height) + 1
64
65 btnSurf, _ := m.btn.Draw(vxfw.DrawContext{
66 Characters: ctx.Characters,
67 Max: vxfw.Size{Width: 5, Height: 1},
68 })
69- root.AddChild(0, 6, btnSurf)
70+ root.AddChild(0, ah, btnSurf)
71
72 if m.err != nil {
73 e := richtext.New([]vaxis.Segment{
74@@ -261,7 +266,7 @@ func (m *AddKeyPage) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error) {
75 },
76 })
77 errSurf, _ := e.Draw(createDrawCtx(ctx, 1))
78- root.AddChild(0, 6, errSurf)
79+ root.AddChild(0, ah, errSurf)
80 }
81
82 return root, nil
+16,
-14
1@@ -111,20 +111,22 @@ func (m *TokensPage) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error) {
2 w := ctx.Max.Width
3 h := ctx.Max.Height
4 root := vxfw.NewSurface(w, h, m)
5-
6- header := richtext.New([]vaxis.Segment{
7- {
8- Text: fmt.Sprintf(
9- "%d tokens\n",
10- len(m.tokens),
11- ),
12- },
13- })
14- headerSurf, _ := header.Draw(createDrawCtx(ctx, 2))
15- root.AddChild(0, 0, headerSurf)
16-
17- listSurf, _ := m.list.Draw(createDrawCtx(ctx, h-5))
18- root.AddChild(0, 3, listSurf)
19+ ah := 0
20+
21+ info := text.New("Tokens allows users to generate a 'password' for use with web services that cannot use SSH keys for authentication. For example, tokens are used to access our IRC bouncer.")
22+ brd := NewBorder(info)
23+ brd.Label = "desc"
24+ brdSurf, _ := brd.Draw(ctx)
25+ root.AddChild(0, ah, brdSurf)
26+ ah += int(brdSurf.Size.Height)
27+
28+ header := text.New(fmt.Sprintf("%d tokens\n\n", len(m.tokens)))
29+ headerSurf, _ := header.Draw(ctx)
30+ root.AddChild(0, ah, headerSurf)
31+ ah += int(headerSurf.Size.Height)
32+
33+ listSurf, _ := m.list.Draw(ctx)
34+ root.AddChild(0, ah, listSurf)
35
36 segs := []vaxis.Segment{}
37 if m.confirm {