Skip to content

Commit

Permalink
UI adjustments to wallet details, balance and titles
Browse files Browse the repository at this point in the history
add padding to wallet boxes and fix on sync button

fix balance spacing and transactions alignment

add capitalization to overview and transactions headers
  • Loading branch information
oshorefueled committed Jan 7, 2020
1 parent 44b628e commit 6d0c6cf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
33 changes: 22 additions & 11 deletions fyne/pages/handler/overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"fyne.io/fyne/layout"
"github.com/gen2brain/beeep"
"github.com/raedahgroup/godcr/fyne/pages/handler/values"
"image/color"
"log"
"sort"
Expand Down Expand Up @@ -212,10 +213,19 @@ func (handler *OverviewHandler) blockSyncStatus() (string, color.Color) {
}

func (handler *OverviewHandler) SyncTrigger(wallet *dcrlibwallet.MultiWallet) {
if wallet.IsSyncing() {
var notifyTitle, notifyMessage string
synced, syncing := wallet.IsSynced(), wallet.IsSyncing()
if wallet.ConnectedPeers() > 0 && (synced || syncing) {
if synced {
notifyTitle = "Wallet Disconnected"
notifyMessage = "wallet has been disconnected from peers"
} else if syncing {
notifyTitle = "Sync Canceled"
notifyMessage = "wallet sync stopped until wallet reconnect"
}
wallet.CancelSync()
handler.ConnectedPeers = 0
err := beeep.Notify("Sync Canceled", "wallet sync stopped until wallet reconnect", "assets/information.png")
err := beeep.Notify(notifyTitle, notifyMessage, "assets/information.png")
if err != nil {
log.Println("error initiating alert:", err.Error())
}
Expand Down Expand Up @@ -362,11 +372,11 @@ func newTransactionRow(transactionType, amount, fee, direction, status, date str
icon := canvas.NewImageFromResource(icons[transactionType])
icon.SetMinSize(fyne.NewSize(5, 20))
iconBox := widget.NewVBox(widgets.NewVSpacer(4), icon)
amountLabel := widget.NewLabel(amount)
feeLabel := widget.NewLabel(fee)
dateLabel := widget.NewLabel(date)
statusLabel := widget.NewLabel(status)
directionLabel := widget.NewLabel(direction)
amountLabel := widget.NewLabelWithStyle(amount, fyne.TextAlignTrailing, fyne.TextStyle{})
feeLabel := widget.NewLabelWithStyle(fee, fyne.TextAlignCenter, fyne.TextStyle{})
dateLabel := widget.NewLabelWithStyle(date, fyne.TextAlignCenter, fyne.TextStyle{})
statusLabel := widget.NewLabelWithStyle(status, fyne.TextAlignCenter, fyne.TextStyle{})
directionLabel := widget.NewLabelWithStyle(direction, fyne.TextAlignCenter, fyne.TextStyle{})
column := widget.NewHBox(iconBox, amountLabel, feeLabel, directionLabel, statusLabel, dateLabel)
return column
}
Expand Down Expand Up @@ -399,12 +409,13 @@ func walletSyncBox(name, status, headerFetched, progress string) fyne.CanvasObje
widgets.NewHSpacer(2),
)
background := canvas.NewRectangle(color.RGBA{0, 0, 0, 7})
background.SetMinSize(fyne.NewSize(250, 70))
walletSyncContent := fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(250, 70)),
fyne.NewContainerWithLayout(layout.NewVBoxLayout(), top, layout.NewSpacer(), middle, layout.NewSpacer(), bottom),
background.SetMinSize(fyne.NewSize(250, 80))
walletSyncContent := fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(250, 80)),
fyne.NewContainerWithLayout(layout.NewVBoxLayout(), widgets.NewVSpacer(values.SpacerSize2), top, layout.NewSpacer(),
middle, layout.NewSpacer(), bottom, widgets.NewVSpacer(values.SpacerSize2)),
)

return fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(250, 70)),
return fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(250, 80)),
fyne.NewContainerWithLayout(layout.NewBorderLayout(nil, nil, nil, nil),
background,
walletSyncContent,
Expand Down
2 changes: 2 additions & 0 deletions fyne/pages/handler/values/dimensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ const (

TextSize10 = 10
TextSize12 = 12
TextSize15 = 15
TextSize16 = 16
TextSize14 = 14
TextSize24 = 24
TextSize25 = 25
TextSize20 = 20
TextSize32 = 32
ConfirmationButtonTextSize = 18
Expand Down
22 changes: 11 additions & 11 deletions fyne/pages/overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fyne.io/fyne/layout"
"fyne.io/fyne/widget"
"github.com/raedahgroup/dcrlibwallet"
"github.com/raedahgroup/godcr/fyne/layouts"
"github.com/raedahgroup/godcr/fyne/pages/handler"
"github.com/raedahgroup/godcr/fyne/pages/handler/values"
"github.com/raedahgroup/godcr/fyne/widgets"
Expand All @@ -14,7 +15,7 @@ import (
)

const historyPageIndex = 1
const PageTitle = "overview"
const PageTitle = "Overview"

type overview struct {
app *AppInterface
Expand Down Expand Up @@ -72,7 +73,7 @@ func (ov *overview) recentTransactionBox() fyne.CanvasObject {
table.NewTable(overviewHandler.TableHeader)
overviewHandler.Table = table
overviewHandler.UpdateTransactions(ov.multiWallet, handler.TransactionUpdate{})
transactionsContainer := fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(515, 200)), table.Container)
transactionsContainer := fyne.NewContainerWithLayout(layout.NewFixedGridLayout(fyne.NewSize(520, 200)), table.Container)
overviewHandler.TransactionsContainer = transactionsContainer

return widget.NewVBox(
Expand Down Expand Up @@ -177,21 +178,20 @@ func title() fyne.CanvasObject {
}

func balance() fyne.CanvasObject {
dcrBalance := widgets.NewLargeText("0.00", color.Black)
dcrDecimals := widgets.NewSmallText("00000 DCR", color.Black)
dcrBalance := widgets.NewTextWithStyle("0.00", color.Black, fyne.TextStyle{}, fyne.TextAlignLeading, values.TextSize25)
dcrDecimals := widgets.NewTextWithStyle("00000 DCR", color.Black, fyne.TextStyle{}, fyne.TextAlignLeading, values.TextSize15)
overviewHandler.Balance = make([]*canvas.Text, 2)
overviewHandler.Balance[0] = dcrBalance
overviewHandler.Balance[1] = dcrDecimals
decimalsBox := fyne.NewContainerWithLayout(layout.NewVBoxLayout(), widgets.NewVSpacer(6), dcrDecimals)
return widget.NewHBox(widgets.NewVSpacer(10), dcrBalance, decimalsBox)
return fyne.NewContainerWithLayout(layouts.NewHBox(0, true), dcrBalance, dcrDecimals)
}

func transactionRowHeader() *widget.Box {
hash := widget.NewLabelWithStyle("#", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
amount := widget.NewLabelWithStyle("amount", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
fee := widget.NewLabelWithStyle("fee", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
direction := widget.NewLabelWithStyle("direction", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
status := widget.NewLabelWithStyle("status", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
date := widget.NewLabelWithStyle("date", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
amount := widget.NewLabelWithStyle("Amount", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
fee := widget.NewLabelWithStyle("Fee", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
direction := widget.NewLabelWithStyle("Direction", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
status := widget.NewLabelWithStyle("Status", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
date := widget.NewLabelWithStyle("Date", fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
return widget.NewHBox(hash, amount, fee, direction, status, date)
}

0 comments on commit 6d0c6cf

Please sign in to comment.