Skip to content

Commit 461e4cd

Browse files
authored
Merge pull request #47 from algorandfoundation/feat-url-shortener-network-fix
shortener: fix network for lora; txn styling: add spacing
2 parents 856a43a + db72b94 commit 461e4cd

File tree

7 files changed

+67
-55
lines changed

7 files changed

+67
-55
lines changed

ui/app/url.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package app
22

33
import (
44
"encoding/base64"
5+
"strings"
6+
57
"github.com/algorandfoundation/algorun-tui/api"
68
"github.com/algorandfoundation/algorun-tui/internal"
79
tea "github.com/charmbracelet/bubbletea"
@@ -11,10 +13,16 @@ func EmitCreateShortLink(offline bool, part *api.ParticipationKey, state *intern
1113
if part == nil || state == nil {
1214
return nil
1315
}
16+
17+
var loraNetwork = strings.Replace(strings.Replace(state.Status.Network, "-v1.0", "", 1), "-v1", "", 1)
18+
if loraNetwork == "dockernet" || loraNetwork == "tuinet" {
19+
loraNetwork = "localnet"
20+
}
21+
1422
if offline {
1523
res, err := internal.GetOfflineShortLink(state.Http, internal.OfflineShortLinkBody{
1624
Account: part.Address,
17-
Network: state.Status.Network,
25+
Network: loraNetwork,
1826
})
1927
if err != nil {
2028
return func() tea.Msg {
@@ -34,7 +42,7 @@ func EmitCreateShortLink(offline bool, part *api.ParticipationKey, state *intern
3442
VoteFirstValid: part.Key.VoteFirstValid,
3543
VoteLastValid: part.Key.VoteLastValid,
3644
KeyDilution: part.Key.VoteKeyDilution,
37-
Network: state.Status.Network,
45+
Network: loraNetwork,
3846
})
3947
if err != nil {
4048
return func() tea.Msg {

ui/modal/testdata/Test_Snapshot/TransactionModal.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121

2222

2323

24-
2524

2625

2726
╭──Register Offline──────────────────────────────────────────╮
28-
│ Sign this transaction to register your account as offline:
27+
Sign this transaction to register your account as offline │
2928
│ │
3029
│ Scan the QR code with Pera or Defly │
3130
│ (make sure you use the testnet-v1.0 network) │
@@ -48,6 +47,7 @@
4847
│ -or- │
4948
│ │
5049
│ Open this URL in your browser: │
50+
│ │
5151
│ https://b.nodekit.run/1234 │
5252
│ │
5353
│ Note: this will take effect after 320 rounds (~15 min.) │
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
Sign this transaction to register your account as online:
2-
3-
Mobile QR is available but it does not fit on screen.
4-
Adjust terminal dimensions or font size to display.
5-
6-
-or-
7-
Open this URL in your browser:
8-
https://b.nodekit.run/1234
1+
Sign this transaction to register your account as online
2+
3+
Mobile QR is available but it does not fit on screen.
4+
Adjust terminal dimensions or font size to display.
5+
6+
-or-
7+
Open this URL in your browser:
8+
9+
https://b.nodekit.run/1234

ui/modals/transaction/testdata/Test_Snapshot/Offline.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Sign this transaction to register your account as offline:
1+
Sign this transaction to register your account as offline
22

33
Scan the QR code with Pera or Defly
44
(make sure you use the testnet-v1.0 network)
@@ -21,6 +21,7 @@ Sign this transaction to register your account as offline:
2121
-or-
2222

2323
Open this URL in your browser:
24+
2425
https://b.nodekit.run/1234
2526

2627
Note: this will take effect after 320 rounds (~15 min.)
Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
Sign this transaction to register your account as online:
2-
3-
Scan the QR code with Pera or Defly
4-
(make sure you use the testnet-v1.0 network)
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-
-or-
32-
33-
Open this URL in your browser:
34-
https://b.nodekit.run/1234
1+
Sign this transaction to register your account as online
2+
3+
Scan the QR code with Pera or Defly
4+
(make sure you use the testnet-v1.0 network)
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+
-or-
32+
33+
Open this URL in your browser:
34+
35+
https://b.nodekit.run/1234
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
2-
Sign this transaction to register your account as online:
3-
4-
Open this URL in your browser:
5-
https://b.nodekit.run/1234
6-
1+
2+
Sign this transaction to register your account as online
3+
4+
Open this URL in your browser:
5+
6+
https://b.nodekit.run/1234
7+

ui/modals/transaction/view.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ func (m ViewModel) View() string {
2828
} else {
2929
adj = "online"
3030
}
31-
intro := fmt.Sprintf("Sign this transaction to register your account as %s:", adj)
31+
intro := fmt.Sprintf("Sign this transaction to register your account as %s", adj)
3232
link := internal.ToShortLink(*m.Link)
3333
loraText := lipgloss.JoinVertical(
3434
lipgloss.Center,
35-
"Open this URL in your browser:",
35+
"Open this URL in your browser:\n",
3636
style.WithHyperlink(link, link),
3737
)
3838
if isOffline {

0 commit comments

Comments
 (0)