components

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2022 License: ISC Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Uint32Size    = 32 << (^uint32(0) >> 32 & 1) // 32 or 64
	MaxInt32      = 1<<(Uint32Size-1) - 1
	WalletsPageID = "Wallets"
)
View Source
const AccoutSelectorID = "AccountSelector"
View Source
const ModalAccountSelector = "AccountSelectorModal"
View Source
const VSPSelectorModalID = "VSPSelectorModal"

Variables

View Source
var MaxWidth = unit.Dp(800)

Functions

func CalculateTotalWalletsBalance added in v1.7.0

func CalculateTotalWalletsBalance(l *load.Load) (dcrutil.Amount, dcrutil.Amount, error)

func CoinImageBySymbol added in v1.7.0

func CoinImageBySymbol(l *load.Load, coinName string) *decredmaterial.Image

CoinImageBySymbol returns image widget for supported asset coins.

func ContextDone

func ContextDone(ctx context.Context) bool

done returns whether the context's Done channel was closed due to cancellation or exceeded deadline.

func CreateOrUpdateWalletDropDown

func CreateOrUpdateWalletDropDown(l *load.Load, dwn **decredmaterial.DropDown, wallets []*dcrlibwallet.Wallet, grp uint, pos uint) *decredmaterial.DropDown

createOrUpdateWalletDropDown check for len of wallets to create dropDown, also update the list when create, update, delete a wallet.

func CreateOrderDropDown

func CreateOrderDropDown(l *load.Load, grp uint, pos uint) *decredmaterial.DropDown

func DisableLog added in v1.7.0

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func DurationAgo added in v1.7.0

func DurationAgo(timestamp int64) string

func EndToEndRow

func EndToEndRow(gtx layout.Context, leftWidget, rightWidget func(C) D) layout.Dimensions

EndToEndRow layouts out its content on both ends of its horizontal layout.

func FormatDateOrTime

func FormatDateOrTime(timestamp int64) string

func GoToURL

func GoToURL(url string)

func LayoutBalance

func LayoutBalance(gtx layout.Context, l *load.Load, amount string) layout.Dimensions

LayoutBalance aligns the main and sub DCR balances horizontally, putting the sub balance at the baseline of the row.

func LayoutBalanceColor added in v1.7.0

func LayoutBalanceColor(gtx layout.Context, l *load.Load, amount string, color color.NRGBA) layout.Dimensions

func LayoutBalanceSize

func LayoutBalanceSize(gtx layout.Context, l *load.Load, amount string, mainTextSize unit.Value) layout.Dimensions

func LayoutBalanceSizeScale

func LayoutBalanceSizeScale(gtx layout.Context, l *load.Load, amount string, mainTextSize unit.Value, scale float32) layout.Dimensions

func LayoutTransactionRow

func LayoutTransactionRow(gtx layout.Context, l *load.Load, row TransactionRow) layout.Dimensions

transactionRow is a single transaction row on the transactions and overview page. It lays out a transaction's direction, balance, status.

func RetryFunc added in v1.7.0

func RetryFunc(retryAttempts int, sleepDur time.Duration, funcDesc string, errFunc func() error) (int, error)

RetryFunc implements retry policy for processes that needs to be executed after initial failure.

func SecondsToDays added in v1.7.0

func SecondsToDays(totalTimeLeft int64) string

SecondsToDays takes time in seconds and returns its string equivalent in the format ddhhmm.

func StringNotEmpty

func StringNotEmpty(texts ...string) bool

func TimeAgo

func TimeAgo(timestamp int64) string

func TimeFormat

func TimeFormat(secs int, long bool) string

func TranslateErr added in v1.7.0

func TranslateErr(err error) string

func TruncateString

func TruncateString(str string, num int) string

func TxConfirmations

func TxConfirmations(l *load.Load, transaction dcrlibwallet.Transaction) int32

func UniformHorizontalPadding added in v1.7.0

func UniformHorizontalPadding(gtx layout.Context, body layout.Widget) layout.Dimensions

func UniformPadding

func UniformPadding(gtx layout.Context, body layout.Widget) layout.Dimensions

func UseLogger added in v1.7.0

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

func WeekDayHourMinuteCalculator added in v1.7.0

func WeekDayHourMinuteCalculator(timestamp int64) string

Types

type AccountSelector

type AccountSelector struct {
	*load.Load
	*listeners.TxAndBlockNotificationListener
	// contains filtered or unexported fields
}

func NewAccountSelector

func NewAccountSelector(l *load.Load, selectedWallet *dcrlibwallet.Wallet) *AccountSelector

NewAccountSelector opens up a modal to select the desired account. If a nil value is passed for selectedWallet, then accounts for all wallets are shown, otherwise only accounts for the selectedWallet is shown.

func (*AccountSelector) AccountSelected

func (as *AccountSelector) AccountSelected(callback func(*dcrlibwallet.Account)) *AccountSelector

func (*AccountSelector) AccountValidator

func (as *AccountSelector) AccountValidator(accountIsValid func(*dcrlibwallet.Account) bool) *AccountSelector

func (*AccountSelector) Changed added in v1.7.0

func (as *AccountSelector) Changed() bool

func (*AccountSelector) Handle

func (as *AccountSelector) Handle()

func (*AccountSelector) Layout

func (as *AccountSelector) Layout(gtx C) D

func (*AccountSelector) ListenForTxNotifications added in v1.7.0

func (as *AccountSelector) ListenForTxNotifications(ctx context.Context)

func (*AccountSelector) SelectFirstWalletValidAccount

func (as *AccountSelector) SelectFirstWalletValidAccount(selectedWallet *dcrlibwallet.Wallet) error

SelectFirstWalletValidAccount selects the first valid account from the first wallet in the SortedWalletList If selectedWallet is not nil, the first account for the selectWallet is selected.

func (*AccountSelector) SelectedAccount

func (as *AccountSelector) SelectedAccount() *dcrlibwallet.Account

func (*AccountSelector) SetSelectedAccount added in v1.7.0

func (as *AccountSelector) SetSelectedAccount(account *dcrlibwallet.Account)

func (*AccountSelector) Title

func (as *AccountSelector) Title(title string) *AccountSelector

func (*AccountSelector) UpdateSelectedAccountBalance added in v1.7.0

func (as *AccountSelector) UpdateSelectedAccountBalance()

type AccountSelectorModal

type AccountSelectorModal struct {
	*load.Load
	// contains filtered or unexported fields
}

func (*AccountSelectorModal) Dismiss

func (asm *AccountSelectorModal) Dismiss()

func (*AccountSelectorModal) Handle

func (asm *AccountSelectorModal) Handle()

func (*AccountSelectorModal) Layout

func (asm *AccountSelectorModal) Layout(gtx C) D

func (*AccountSelectorModal) ModalID

func (asm *AccountSelectorModal) ModalID() string

func (*AccountSelectorModal) OnDismiss

func (asm *AccountSelectorModal) OnDismiss()

func (*AccountSelectorModal) OnResume

func (asm *AccountSelectorModal) OnResume()

func (*AccountSelectorModal) SetCancelable

func (asm *AccountSelectorModal) SetCancelable(min bool) *AccountSelectorModal

func (*AccountSelectorModal) Show

func (asm *AccountSelectorModal) Show()

type C

type C = layout.Context

type ConsensusItem added in v1.7.0

type ConsensusItem struct {
	Agenda     dcrlibwallet.Agenda
	VoteButton decredmaterial.Button
}

func LoadAgendas added in v1.7.0

func LoadAgendas(l *load.Load, selectedWallet *dcrlibwallet.Wallet, newestFirst bool) []*ConsensusItem

type Container

type Container struct {
	Padding layout.Inset
}

Container is simply a wrapper for the Inset type. Its purpose is to differentiate the use of an inset as a padding or margin, making it easier to visualize the structure of a layout when reading UI code.

func (Container) Layout

type D

type D = layout.Dimensions

func AgendaItemWidget added in v1.7.0

func AgendaItemWidget(gtx C, l *load.Load, consensusItem *ConsensusItem) D

func LayoutNoAgendasFound added in v1.7.0

func LayoutNoAgendasFound(gtx C, l *load.Load, syncing bool) D

func LayoutNoProposalsFound added in v1.7.0

func LayoutNoProposalsFound(gtx C, l *load.Load, syncing bool, category int32) D

func MixerInfoContentWrapper added in v1.7.0

func MixerInfoContentWrapper(gtx C, l *load.Load, content layout.Widget) D

func MixerInfoLayout added in v1.7.0

func MixerInfoLayout(gtx C, l *load.Load, mixerActive bool, button layout.Widget, mixerInfo layout.Widget) D

func ProposalsList added in v1.7.0

func ProposalsList(gtx C, l *load.Load, prop *ProposalItem) D

func WalletLabel

func WalletLabel(gtx layout.Context, l *load.Load, walletName string) D

walletLabel displays the wallet which a transaction belongs to. It is only displayed on the overview page when there // are transactions from multiple wallets

type NavDrawer struct {
	*load.Load

	AppBarNavItems []NavHandler
	DrawerNavItems []NavHandler
	CurrentPage    string

	MinimizeNavDrawerButton decredmaterial.IconButton
	MaximizeNavDrawerButton decredmaterial.IconButton
	// contains filtered or unexported fields
}
func (nd *NavDrawer) DrawerToggled(min bool)
func (nd *NavDrawer) LayoutNavDrawer(gtx layout.Context) layout.Dimensions
func (nd *NavDrawer) LayoutTopBar(gtx layout.Context) layout.Dimensions
type NavHandler struct {
	Clickable     *decredmaterial.Clickable
	Image         *decredmaterial.Image
	ImageInactive *decredmaterial.Image
	Title         string
	PageID        string
}

type ProposalItem added in v1.7.0

type ProposalItem struct {
	Proposal dcrlibwallet.Proposal
	// contains filtered or unexported fields
}

func LoadProposals added in v1.7.0

func LoadProposals(category int32, newestFirst bool, l *load.Load) []*ProposalItem

type SubPage

type SubPage struct {
	*load.Load
	Title        string
	SubTitle     string
	WalletName   string
	Back         func()
	Body         layout.Widget
	InfoTemplate string
	ExtraItem    *decredmaterial.Clickable
	Extra        layout.Widget
	ExtraText    string
	HandleExtra  func()

	BackButton decredmaterial.IconButton
	InfoButton decredmaterial.IconButton
}

func (*SubPage) EventHandler

func (sp *SubPage) EventHandler()

func (*SubPage) Header

func (sp *SubPage) Header(gtx layout.Context) layout.Dimensions

func (*SubPage) Layout

func (sp *SubPage) Layout(gtx layout.Context) layout.Dimensions

func (*SubPage) SplitLayout

func (sp *SubPage) SplitLayout(gtx layout.Context) layout.Dimensions

type TransactionRow

type TransactionRow struct {
	Transaction dcrlibwallet.Transaction
	Index       int
	ShowBadge   bool
}

type TxStatus

type TxStatus struct {
	Title string
	Icon  *decredmaterial.Image

	// tx purchase only
	TicketStatus       string
	Color              color.NRGBA
	ProgressBarColor   color.NRGBA
	ProgressTrackColor color.NRGBA
	Background         color.NRGBA
}

func TransactionTitleIcon

func TransactionTitleIcon(l *load.Load, wal *dcrlibwallet.Wallet, tx *dcrlibwallet.Transaction, ticketSpender *dcrlibwallet.Transaction) *TxStatus

type VSPSelector added in v1.7.0

type VSPSelector struct {
	*load.Load
	// contains filtered or unexported fields
}

func NewVSPSelector added in v1.7.0

func NewVSPSelector(l *load.Load) *VSPSelector

func (*VSPSelector) Changed added in v1.7.0

func (v *VSPSelector) Changed() bool

func (*VSPSelector) Layout added in v1.7.0

func (v *VSPSelector) Layout(gtx layout.Context) layout.Dimensions

func (*VSPSelector) SelectVSP added in v1.7.0

func (v *VSPSelector) SelectVSP(vspHost string)

func (*VSPSelector) SelectedVSP added in v1.7.0

func (v *VSPSelector) SelectedVSP() *dcrlibwallet.VSP

func (*VSPSelector) Title added in v1.7.0

func (v *VSPSelector) Title(title string) *VSPSelector

type VoteBar added in v1.7.0

type VoteBar struct {
	*load.Load
	// contains filtered or unexported fields
}

VoteBar widget implements voting stat for proposals. VoteBar shows the range/percentage of the yes votes and no votes against the total required.

func NewVoteBar added in v1.7.0

func NewVoteBar(l *load.Load) *VoteBar

func (*VoteBar) Layout added in v1.7.0

func (v *VoteBar) Layout(gtx C) D

func (*VoteBar) SetProposalDetails added in v1.7.0

func (v *VoteBar) SetProposalDetails(numComment int32, publishedAt int64, token string) *VoteBar

func (*VoteBar) SetVoteValidityParams added in v1.7.0

func (v *VoteBar) SetVoteValidityParams(eligibleVotes, requiredPercentage, passPercentage float32) *VoteBar

func (*VoteBar) SetYesNoVoteParams added in v1.7.0

func (v *VoteBar) SetYesNoVoteParams(yesVotes, noVotes float32) *VoteBar

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL