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

Update sync info #691

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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)
JustinBeBoy marked this conversation as resolved.
Show resolved Hide resolved
} 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
Loading