Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brclient: update bubbletea dependencies #312

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions brclient/embedwidget.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type embedWidget struct {

sharing bool
sharedFiles []clientdb.SharedFileAndShares
selSharedFiles *selection.Model
selSharedFiles *selection.Model[string]
idxSharedFile int

addEmbedCB func(id string, data []byte, embedStr string) error
Expand All @@ -43,7 +43,7 @@ func (ew *embedWidget) listSharedFiles() tea.Cmd {
return nil
}

choices := make([]*selection.Choice, 0, len(files))
choices := make([]string, 0, len(files))
sharedFiles := make([]clientdb.SharedFileAndShares, 0, len(files))
for _, file := range files {
if !file.Global {
Expand All @@ -53,9 +53,8 @@ func (ew *embedWidget) listSharedFiles() tea.Cmd {
txt := fmt.Sprintf("%s - %s - %s (%s)",
file.SF.Filename, hbytes(int64(file.Size)),
dcrutil.Amount(int64(file.Cost)), file.SF.FID.ShortLogID())
c := selection.NewChoice(txt)

choices = append(choices, c)
choices = append(choices, txt)
sharedFiles = append(sharedFiles, file)
}

Expand Down Expand Up @@ -134,9 +133,9 @@ func (ew *embedWidget) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch {
case msg.Type == tea.KeyEnter:
ew.sharing = false
choice, err := ew.selSharedFiles.Value()
choice, err := ew.selSharedFiles.ValueAsChoice()
if err == nil {
ew.idxSharedFile = choice.Index
ew.idxSharedFile = choice.Index()
}
return ew, nil

Expand Down Expand Up @@ -257,7 +256,7 @@ func newEmbedWidget(as *appState, addEmbedCB func(string, []byte, string) error)
),
)

sel := selection.New("Select shared file", selection.Choices([]string{""}))
sel := selection.New("Select shared file", []string{""})
selSharedFiles := selection.NewModel(sel)
selSharedFiles.Filter = nil
//selSharedFiles.Update(tea.WindowSizeMsg{Width: as.winW, Height: 10})
Expand Down
24 changes: 12 additions & 12 deletions brclient/setupwizard.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ type setupWizardScreen struct {
crashStack []byte
styles *theme

selNetwork *selection.Model
selWalletType *selection.Model
selNewOrRestore *selection.Model
selNetwork *selection.Model[string]
selWalletType *selection.Model[string]
selNewOrRestore *selection.Model[string]

connCtx context.Context
connCancel func()
Expand Down Expand Up @@ -291,7 +291,7 @@ func (sws setupWizardScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return sws, nil
}

v, err := sws.selNetwork.Value()
v, err := sws.selNetwork.ValueAsChoice()
if err != nil {
sws.err = sws.selNetwork.Err
sws.connCancel()
Expand All @@ -304,7 +304,7 @@ func (sws setupWizardScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return sws, tea.Quit
}

sws.net = v.Value.(string)
sws.net = v.Value
sws.stage = swsStageWalletType

case swsStageWalletType:
Expand All @@ -313,7 +313,7 @@ func (sws setupWizardScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return sws, nil
}

v, err := sws.selWalletType.Value()
v, err := sws.selWalletType.ValueAsChoice()
if err != nil {
sws.err = sws.selWalletType.Err
sws.connCancel()
Expand All @@ -326,7 +326,7 @@ func (sws setupWizardScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return sws, tea.Quit
}

sws.walletType = v.Value.(string)
sws.walletType = v.Value
switch sws.walletType {
case "internal":
sws.stage = swsStageNewOrRestore
Expand All @@ -347,7 +347,7 @@ func (sws setupWizardScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return sws, nil
}

v, err := sws.selNewOrRestore.Value()
v, err := sws.selNewOrRestore.ValueAsChoice()
if err != nil {
sws.err = sws.selNewOrRestore.Err
sws.connCancel()
Expand All @@ -360,7 +360,7 @@ func (sws setupWizardScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return sws, tea.Quit
}

sws.newOrRestore = v.Value.(string)
sws.newOrRestore = v.Value
switch sws.newOrRestore {
case "new":
sws.stage = swsStageWaitingRunForWalletPass
Expand Down Expand Up @@ -618,13 +618,13 @@ func newSetupWizardScreen(cfgFilePath string) setupWizardScreen {
walletTypes := []string{"internal", "external"}
newOrRestore := []string{"new", "restore"}

selNetwork := selection.New("Network", selection.Choices(networks))
selNetwork := selection.New("Network", networks)
selNetwork.Filter = nil

selWalletType := selection.New("Wallet Type", selection.Choices(walletTypes))
selWalletType := selection.New("Wallet Type", walletTypes)
selWalletType.Filter = nil

selNewOrRestore := selection.New("New or Restore", selection.Choices(newOrRestore))
selNewOrRestore := selection.New("New or Restore", newOrRestore)
selNewOrRestore.Filter = nil

connCtx, connCancel := context.WithCancel(context.Background())
Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ go 1.18
require (
github.com/atotto/clipboard v0.1.4
github.com/bahlo/generic-list-go v0.2.0
github.com/charmbracelet/bubbles v0.15.0
github.com/charmbracelet/bubbletea v0.23.1
github.com/charmbracelet/lipgloss v0.6.0
github.com/charmbracelet/bubbles v0.16.1
github.com/charmbracelet/bubbletea v0.24.2
github.com/charmbracelet/lipgloss v0.7.1
github.com/companyzero/sntrup4591761 v0.0.0-20220309191932-9e0f3af2f07a
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/bech32 v1.1.3
Expand All @@ -22,16 +22,17 @@ require (
github.com/decred/dcrlnlpd v0.0.0-20230616144508-d84160568398
github.com/decred/go-socks v1.1.0
github.com/decred/slog v1.2.0
github.com/erikgeiser/promptkit v0.7.0
github.com/erikgeiser/promptkit v0.9.0
github.com/fsnotify/fsnotify v1.5.4
github.com/gorilla/websocket v1.5.0
github.com/jrick/flagfile v1.0.0
github.com/jrick/logrotate v1.0.0
github.com/lib/pq v1.10.7
github.com/mattn/go-runewidth v0.0.14
github.com/mattn/go-runewidth v0.0.15
github.com/mitchellh/go-homedir v1.1.0
github.com/muesli/reflow v0.3.0
github.com/pelletier/go-toml v1.9.5
github.com/puzpuzpuz/xsync/v2 v2.4.1
github.com/rogpeppe/go-internal v1.10.0
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec
Expand All @@ -40,8 +41,8 @@ require (
golang.org/x/mobile v0.0.0-20230427221453-e8d11dd0ba41
golang.org/x/net v0.9.0
golang.org/x/sync v0.3.0
golang.org/x/term v0.7.0
golang.org/x/text v0.9.0
golang.org/x/term v0.11.0
golang.org/x/text v0.12.0
google.golang.org/grpc v1.56.0
google.golang.org/protobuf v1.30.0
gopkg.in/macaroon.v2 v2.1.0
Expand All @@ -53,11 +54,11 @@ require (
github.com/NebulousLabs/go-upnp v0.0.0-20181203152547-b32978b8ccbf // indirect
github.com/Yawning/aez v0.0.0-20211027044916-e49e68abd344 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/aymanbagabas/go-osc52 v1.0.3 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcwallet/walletdb v1.4.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/coreos/bbolt v1.3.3 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
Expand Down Expand Up @@ -112,21 +113,20 @@ require (
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/matheusd/etcd v0.5.0-alpha.5.0.20230215150709-cb359727eca4 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.53 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/muesli/ansi v0.0.0-20211031195517-c9f0611b6c70 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.13.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/prometheus/client_golang v1.15.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/puzpuzpuz/xsync/v2 v2.4.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
Expand All @@ -141,7 +141,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.8.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
Expand Down
Loading