Skip to content

Commit

Permalink
update sync info
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed Oct 18, 2024
1 parent ea62a64 commit 6f0412a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
41 changes: 30 additions & 11 deletions ui/page/components/wallet_sync_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,37 @@ func (wsi *WalletSyncInfo) syncContent(gtx C, uniform layout.Inset) D {
syncIsScanning = wsi.wallet.(*dcr.Asset).IsSycnRescanning()
}
dp8 := values.MarginPadding8

totalStep := 2
if !wsi.isBtcOrLtcAsset() {
totalStep = 3
}
syncStep := 1
syncProgress1 := values.String(values.StrFetchingBlockHeaders)
if wsi.wallet.IsSyncing() {
if !wsi.isBtcOrLtcAsset() {
if isAddDiscovering {
syncStep = 2
syncProgress1 = values.String(values.StrAddressDiscovering)
} else if syncIsScanning {
syncStep = 3
syncProgress1 = values.String(values.StrRescanningBlocks)
}
}
} else if wsi.wallet.IsRescanning() {
syncStep = 2
syncProgress1 = values.String(values.StrRescanningBlocks)
} else if wsi.wallet.IsSynced() {
syncProgress1 = values.String(values.StrComplete)
}

return uniform.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return wsi.labelTexSize16Layout(values.StringF(values.StrSyncSteps, syncStep, totalStep), dp8, false)(gtx)
}),
layout.Rigid(wsi.labelTexSize16Layout(values.String(values.StrLatestBlock), dp8, true)),
layout.Rigid(func(gtx C) D {
if !isInProgress {
Expand Down Expand Up @@ -356,6 +383,9 @@ func (wsi *WalletSyncInfo) syncContent(gtx C, uniform layout.Inset) D {
layout.Flexed(1, func(gtx C) D {
return layout.E.Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.End}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return wsi.labelTexSize16Layout(syncProgress1, dp8, false)(gtx)
}),
layout.Rigid(func(gtx C) D {
latestBlockTitle := fmt.Sprintf("%d (%s)", bestBlock.Height, pageutils.TimeAgo(bestBlock.Timestamp))
return wsi.labelTexSize16Layout(latestBlockTitle, dp8, false)(gtx)
Expand All @@ -381,17 +411,6 @@ func (wsi *WalletSyncInfo) syncContent(gtx C, uniform layout.Inset) D {
syncProgress := values.String(values.StrWalletNotSynced)
if wsi.wallet.IsSyncing() {
syncProgress = values.StringF(values.StrSyncingProgressStat, daysBehind)
if !wsi.isBtcOrLtcAsset() {
if isAddDiscovering {
syncProgress = values.String(values.StrAddressDiscovering)
} else if syncIsScanning {
syncProgress = values.String(values.StrRescanningBlocks)
}
}
} else if wsi.wallet.IsRescanning() {
syncProgress = values.String(values.StrRescanningBlocks)
} else if wsi.wallet.IsSynced() {
syncProgress = values.String(values.StrComplete)
}

return wsi.labelTexSize16Layout(syncProgress, dp8, false)(gtx)
Expand Down
4 changes: 2 additions & 2 deletions ui/values/localizable/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const EN = `
"feeRateAPI" = "Fee Rates API"
"feerates" = "Fee Rates"
"fetchingAgenda" = "Fetching agendas..."
"fetchingBlockHeaders" = "Fetching block headers · %v%%"
"fetchingBlockHeaders" = "Fetching block headers"
"fetchingOrders" = "Fetching Orders"
"fetchingPolicies" = "Fetching policies"
"fetchingProposals" = "Fetching proposals..."
Expand Down Expand Up @@ -615,7 +615,7 @@ const EN = `
"syncingProgress" = "Syncing progress"
"syncingProgressStat" = "%s behind"
"syncingState" = "Syncing..."
"syncSteps" = "Step %d/3"
"syncSteps" = "Step %d/%d"
"takenAccount" = "Account name is taken"
"tapToCopy" = "(Tap to copy)"
"ticketVoted" = "A ticket just voted\nVote reward: %s DCR"
Expand Down

0 comments on commit 6f0412a

Please sign in to comment.